Main Content

readOccupancyGrid

(To be removed) Read occupancy grid message

readOccupancyGrid will be removed in a future release. Use rosReadOccupancyGrid instead. For more information, see ROS Message Structure Functions.

Description

map = readOccupancyGrid(msg) returns an occupancyMap (Navigation Toolbox) object by reading the data inside a ROS message, msg, which must be a 'nav_msgs/OccupancyGrid' message. All message data values are converted to probabilities from 0 to 1. The unknown values (-1) in the message are set as 0.5 in the map.

Input Arguments

collapse all

'nav_msgs/OccupancyGrid' ROS message, specified as an OccupancyGrid ROS message object handle.

Output Arguments

collapse all

Occupancy map, returned as an occupancyMap (Navigation Toolbox) object handle.

Version History

Introduced in R2016b

collapse all

R2021a: ROS Message Structure Functions

You can now create messages as structures with fields matching the message object properties. Using structures typically improves performance of creating, updating, and using ROS messages, but message fields are no longer validated when set. Message types and corresponding field values from the structures are validated when sent across the network.

To support message structures as inputs, new functions that operate on specialized ROS messages have been provided. These new functions are based on the existing object functions of message objects, but support ROS and ROS 2 message structures as inputs instead of message objects.

The object functions will be removed in a future release.

Message TypesObject Function NameNew Function Name

Image

CompressedImage

readImage

writeImage

rosReadImage

rosWriteImage

LaserScan

readCartesian

readScanAngles

lidarScan

plot

rosReadCartesian

rosReadScanAngles

rosReadLidarScan

rosPlot

PointCloud2

apply

readXYZ

readRGB

readAllFieldNames

readField

scatter3

rosApplyTransform

rosReadXYZ

rosReadRGB

rosReadAllFieldNames

rosReadField

rosPlot

QuaternionreadQuaternion

rosReadQuaternion

OccupancyGrid

readBinaryOccupanyGrid

readOccupancyGrid

writeBinaryOccupanyGrid

writeOccupanyGrid

rosReadOccupancyGrid

rosReadBinaryOccupancyGrid

rosReadOccupancyGrid

rosWriteBinaryOccupancyGrid

rosWriteOccupancyGrid

OctomapreadOccupancyMap3D

rosReadOccupancyMap3D

PointStamped

PoseStamped

QuaternionStamped

Vector3Stamped

TransformStamped

apply

rosApplyTransform

All messagesshowdetails

rosShowDetails