Main Content

rosWriteBinaryOccupancyGrid

Write values from grid to ROS message

Description

msgOut = rosWriteBinaryOccupancyGrid(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 a OccupancyGrid 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

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

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2021a