Sensor Data

Collect and analyze sensor data utilizing ROS messages

Robotics System Toolbox™ enables you to communicate over ROS networks with ROS messages. You can publish or subscribe to specific ROS message topics, access transformations, or set server parameter information. To send and receive messages, see Exchange Data with ROS Publishers and Subscribers.

Specific sensors, including laser scans and point clouds, have ROS messages that can be converted to MATLAB® data types for analysis. See Work with Specialized ROS Messages for an overview of specific sensor message types.


expand all

rosinitConnect to ROS network
rostopicRetrieve information about ROS topics
rosmsgRetrieve information about ROS messages and message types
rosmessageCreate ROS messages
rospublisher Publish message on a topic
rossubscriber Subscribe to messages on a topic
rosparamAccess ROS parameter server values
rosrateExecute loop at fixed frequency
rosmessageCreate ROS messages
readMessagesRead messages from rosbag
receiveWait for new ROS message
sendPublish ROS message to topic
showdetailsDisplay all ROS message contents
selectSelect subset of messages in rosbag
transformTransform message entities into target coordinate frame
waitForTransformWait until a transformation is available
getTransformRetrieve transformation between two coordinate frames
sendTransformSend transformation to ROS network
rostfReceive, send, and apply ROS transformations
applyTransform message entities into target frame
readBinaryOccupancyGridRead binary occupancy grid
writeBinaryOccupancyGridWrite values from grid to ROS message
readOccupancyGridRead occupancy grid message
writeOccupancyGridWrite values from grid to ROS message
readOccupancyMap3DRead 3-D map from Octomap ROS message
readImageConvert ROS image data into MATLAB image
writeImageWrite MATLAB image to ROS image message
lidarScanCreate object for storing 2-D lidar scan
plotDisplay laser or lidar scan readings
removeInvalidDataRemove invalid range and angle data
readCartesianRead laser scan ranges in Cartesian coordinates
readScanAnglesReturn scan angles for laser scan range readings
transformScanTransform laser scan based on relative pose
readXYZExtract XYZ coordinates from point cloud data
readRGBExtract RGB values from point cloud data
readAllFieldNamesGet all available field names from ROS point cloud
readFieldRead point cloud data based on field name
scatter3Display point cloud in scatter plot
robotics.RateExecute loop at fixed frequency
rosrateExecute loop at fixed frequency


Blank MessageCreate blank message using specified message type
Get ParameterGet values from ROS parameter server
PublishSend messages to ROS network
Read DataPlay back data from log file
Set ParameterSet values on ROS parameter server
SubscribeReceive messages from ROS network


CompressedImageCreate compressed image message
ImageCreate image message
LaserScanCreate laser scan message
lidarScanCreate object for storing 2-D lidar scan
OccupancyGridCreate occupancy grid message
PointCloud2Access point cloud messages


Exchange Data with ROS Publishers and Subscribers

The primary mechanism for ROS nodes to exchange data is to send and receive messages.

Work with Basic ROS Messages

Messages are the primary container for exchanging data in ROS.

Built-In Message Support

List of supported message types in MATLAB ROS.

Work with Specialized ROS Messages

Some commonly used ROS messages store data in a format that requires some transformation before it can be used for further processing.

Transform Laser Scan Data From A ROS Network

Transform laser scan data using a ROS transformation tree.

Execute Code at a Fixed-Rate

Using the robotics.Rate object or the rosrate function allows you to time iterations of your robotics applications.

ROS Log Files (rosbags)

Summary of the structure of rosbags and the workflow for selecting subsets of messages in a rosbag.

Work with rosbag Logfiles

A rosbag or bag is a file format in ROS for storing message data.