Main Content

rosWriteOccupancyGrid

Write values from grid to ROS message

Description

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

Input Arguments

collapse all

'nav_msgs/OccupancyGrid' ROS message, specified as an OccupancyGrid message structure.

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

Outputs

collapse all

'nav_msgs/OccupancyGrid' ROS message, specified as an OccupancyGrid 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

Introduced in R2021a