Main Content

rosWriteBinaryOccupancyGrid

Write values from binary occupancy grid to ROS or ROS 2 message structure

Description

msgOut = rosWriteBinaryOccupancyGrid(msg,map) writes occupancy values from the occupancy grid map and other information from the ROS or ROS 2 message structure msg to an output message msgOut.

Input Arguments

collapse all

ROS or ROS 2 'nav_msgs/OccupancyGrid' message, specified as a message structure.

Binary occupancy grid, specified as a binaryOccupancyMap object handle. The object stores a grid of binary values, where 1 indicates an occupied location and 0 indications an unoccupied location.

Outputs

collapse all

ROS or ROS 2 'nav_msgs/OccupancyGrid' message, specified as a message structure.

You can use the same variable for the input and output argument to directly assign to the existing message.

map = occupancyMap(rand(10));
msg = rosmessage("nav_msgs/OccupancyGrid","DataFormat","struct");
msg = rosWriteBinaryOccupancyGrid(msg,map)

Extended Capabilities

Version History

Introduced in R2021a