Main Content


Read occupancy grid data from ROS or ROS 2 message structure

Since R2021a


map = rosReadOccupancyGrid(msg) returns an occupancyMap (Navigation Toolbox) object by reading the data inside a ROS or ROS 2 message structure, msg, which must be a 'nav_msgs/OccupancyGrid' message. All message data values are converted to probabilities from 0 to 1. The unknown values (-1) in the message are set as 0.5 in the map.

Input Arguments

collapse all

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

Output Arguments

collapse all

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

Extended Capabilities

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

Version History

Introduced in R2021a