Main Content

readBinaryOccupancyGrid

(To be removed) Read binary occupancy grid

readBinaryOccupancyGrid will be removed in a future release. Use rosReadBinaryOccupancyGrid (ROS Toolbox) instead. For more information, see ROS Message Structure Functions.

Description

map = readBinaryOccupancyGrid(msg) returns a binaryOccupancyMap object by reading the data inside a ROS message, msg, which must be a 'nav_msgs/OccupancyGrid' message. All message data values greater than or equal to the occupancy threshold are set to occupied, 1, in the map. All other values, including unknown values (-1) are set to unoccupied, 0, in the map.

Note

The msg input is an 'nav_msgs/OccupancyGrid' ROS message. For more info, see OccupancyGrid (ROS Toolbox).

map = readBinaryOccupancyGrid(msg,thresh) specifies a threshold, thresh, for occupied values. All values greater than or equal to the threshold are set to occupied, 1. All other values are set to unoccupied, 0.

map = readBinaryOccupancyGrid(msg,thresh,val) specifies a value to set for unknown values (-1 ). By default, all unknown values are set to unoccupied, 0.

Input Arguments

collapse all

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

Threshold for occupied values, specified as a scalar. Any value greater than or equal to the threshold is set to occupied, 1. All other values are set to unoccupied, 0.

Data Types: double

Value to replace unknown values, specified as either 0 or 1. Unknown message values (-1) are set to the given value.

Data Types: double | logical

Output Arguments

collapse all

Binary occupancy grid, returned as a binaryOccupancyMap object handle. map is converted from a 'nav_msgs/OccupancyGrid' message on the ROS network. The object is a grid of binary values, where 1 indicates an occupied location and 0 indications an unoccupied location.

Version History

Introduced in R2015a

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 (ROS Toolbox)

rosWriteImage (ROS Toolbox)

LaserScan

readCartesian

readScanAngles

lidarScan

plot

rosReadCartesian (ROS Toolbox)

rosReadScanAngles (ROS Toolbox)

rosReadLidarScan (ROS Toolbox)

rosPlot (ROS Toolbox)

PointCloud2

apply

readXYZ

readRGB

readAllFieldNames

readField

scatter3

rosApplyTransform (ROS Toolbox)

rosReadXYZ (ROS Toolbox)

rosReadRGB (ROS Toolbox)

rosReadAllFieldNames (ROS Toolbox)

rosReadField (ROS Toolbox)

rosPlot (ROS Toolbox)

QuaternionreadQuaternion

rosReadQuaternion (ROS Toolbox)

OccupancyGrid

readBinaryOccupanyGrid

readOccupancyGrid

writeBinaryOccupanyGrid

writeOccupanyGrid

rosReadOccupancyGrid (ROS Toolbox)

rosReadBinaryOccupancyGrid (ROS Toolbox)

rosReadOccupancyGrid (ROS Toolbox)

rosWriteBinaryOccupancyGrid (ROS Toolbox)

rosWriteOccupancyGrid (ROS Toolbox)

OctomapreadOccupancyMap3D

rosReadOccupancyMap3D (ROS Toolbox)

PointStamped

PoseStamped

QuaternionStamped

Vector3Stamped

TransformStamped

apply

rosApplyTransform (ROS Toolbox)

All messagesshowdetails

rosShowDetails (ROS Toolbox)

See Also

Objects

Functions