Main Content

rosWriteOccupancyGrid

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

Description

msgOut= rosWriteOccupancyGrid(msg,map)writes occupancy values from the occupancy gridmapand other information from the ROS or ROS 2 message structure,msg, to an output messagemsgOut.

Input Arguments

collapse all

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

Occupancy map, specified as anoccupancyMap(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