This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

readOccupancyMap3D

Read 3-D map from Octomap ROS message

Syntax

map = readOccupancyMap3D(msg)

Description

example

map = readOccupancyMap3D(msg) reads the data inside a ROS 'octomap_msgs/Octomap' message to return an OccupancyMap3D object. All message data values are converted to probabilities from 0 to 1.

Examples

collapse all

Load Octomap ROS messages and read them into MATLAB® as an OccupancyMap3D object.

Load the Octomap ROS messages. The Octomap map messages were previously recorded in a rosbag and read into MATLAB® as ROS message objects. You could also get these ROS messages live on a network.

load octomap_msgs
disp(octomapMsgs{1})
  ROS Octomap message with properties:

    MessageType: 'octomap_msgs/Octomap'
         Header: [1x1 Header]
         Binary: 0
             Id: 'OcTree'
     Resolution: 0.0500
           Data: [1175340x1 int8]

  Use showdetails to show the contents of the message

Read the data from the ROS messages into an occupancyMap3D object. Display each map.

for i = 1:length(octomapMsgs)
    msg = octomapMsgs{i};
    map{i} = readOccupancyMap3D(msg);
    figure
    show(map{i});
end    

Input Arguments

collapse all

'octomap_msgs/Octomap' ROS message, specified as an Octomap object handle. Get this message by subscribing to an 'octomap_msgs/Octomap' topic using rossubscriber on a live ROS network or by creating your own message using rosmessage.

Output Arguments

collapse all

3-D occupancy map, returned as an OccupancyMap3D object handle.

Introduced in R2018a