Main Content

rosWriteOccupancyGrid

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

Since R2021a

Description

msgOut = rosWriteOccupancyGrid(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.

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

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 = rosWriteOccupancyGrid(msg,map)

Extended Capabilities

Version History

Introduced in R2021a