Main Content

rosPlot

Display lidar scan or point cloud from ROS or ROS 2 message structures

Description

rosPlot(scanMsg) plots the laser scan readings specified in the input ROS or ROS 2 sensor_msgs/LaserScan message structure. Axes are automatically scaled to the maximum range of the sensor.

rosPlot(ptcloudMsg) plots the point cloud readings specified in the input sensor_msgs/PointCloud2 message structure.

rosPlot(___,Name,Value) provides additional options specified by one or more Name,Value pair arguments.

linehandle = plot(___) returns a column vector of line series handles, using any of the arguments from previous syntaxes. Use linehandle to modify properties of the line series after it is created.

When plotting ROS laser scan messages, MATLAB® follows the standard ROS convention for axis orientation. This convention states that positive x is forward, positive y is left, and positive z is up. For more information, see Axis Orientation on the ROS Wiki.

Input Arguments

collapse all

ROS or ROS 2 message of type sensor_msgs/LaserScan, specified as a message structure.

ROS or ROS 2 message of type sensor_msgs/PointCloud2, specified as a message structure.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: "MaximumRange",5

Parent of axes, specified as the comma-separated pair consisting of "Parent" and an axes object in which the laser scan is drawn. By default, the laser scan is plotted in the currently active axes.

Range of laser scan, specified as the comma-separated pair consisting of "MaximumRange" and a scalar. When you specify this name-value pair argument, the minimum and maximum x-axis and the maximum y-axis limits are set based on a specified value. The minimum y-axis limit is automatically determined by the opening angle of the laser scanner.

This name-value pair works only when you input scanMsg as the laser scan.

Outputs

collapse all

One or more chart line objects, returned as a scalar or a vector. These are unique identifiers, which you can use to query and modify properties of a specific chart line.

Version History

Introduced in R2021a