readOccupancyGrid

Read occupancy grid message

Description

example

map = readOccupancyGrid(msg) returns an occupancyMap object by reading the data inside a ROS message, 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.

Examples

collapse all

Create a nav_msgs/OccupancyGrid ROS message.

msg = rosmessage('nav_msgs/OccupancyGrid');

Populate the ROS occupancy grid message with data.

msg.Info.Height = 10;
msg.Info.Width = 10;
msg.Info.Resolution = 0.1;
msg.Data = 100*rand(100,1);

Read the msg data and convert to an OccupancyGrid object.

map = readOccupancyGrid(msg);

Input Arguments

collapse all

'nav_msgs/OccupancyGrid' ROS message, specified as an OccupancyGrid (ROS Toolbox) ROS message object handle.

Output Arguments

collapse all

Occupancy map, returned as an occupancyMap object handle.

Introduced in R2016b