This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

writeOccupancyGrid

Write values from grid to ROS message

Syntax

writeOccupancyGrid(msg,map)

Description

example

writeOccupancyGrid(msg,map) writes occupancy values and other information to the ROS message, msg, from the occupancy grid, map.

Examples

collapse all

The 'nav_msgs/OccupancyGrid' ROS message contains data for a 2-D occupancy grid with probabilistic values for occupancy. Convert a MATLAB® OccupancyGrid object into a ROS message using writeOccupancyGrid.

Create an occupancy grid with random data and an empty ROS message to put data into.

map = robotics.OccupancyGrid(rand(10));
msg = rosmessage('nav_msgs/OccupancyGrid');

Write the data from the occupancy grid into the message.

writeOccupancyGrid(msg, map);

Input Arguments

collapse all

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

Occupancy grid, returned as an robotics.OccupancyGrid object handle.

Introduced in R2016b