Main Content

ROS Read Scan, ROS 2 Read Scan

Extract scan data from ROS or ROS 2 laser scan message

Since R2022a

  • ROS Read Scan Block

Libraries:
ROS Toolbox / ROS
ROS Toolbox / ROS 2

Description

The Read Scan block extracts range, scan and intensity data from a ROS or ROS 2 laser scan message. You can select the message parameters of a topic active on a live ROS or ROS 2 network, or specify the message parameters separately. The input messages are specified as a nonvirtual bus. Use the ROS Subscribe or the ROS 2 Subscribe block to receive a message from the network and input the message to the Read Scan block. For ROS and ROS 2 models, you must use the blocks in the respective ROS and ROS 2 library.

Examples

Ports

Input

expand all

ROS 2 laser scan message, specified as a nonvirtual bus. You can use the ROS Subscribe or the ROS 2 Subscribe blocks to get a message from the network.

Data Types: bus

Output

expand all

Range values for each point in the scan, returned as an array of length M.

Data Types: single

Angle values for each point in the scan, returned as an array of length M.

Dependencies

Enable Show Angles output port parameter.

Data Types: single

Intensity values for each point in the scan, returned as an array of length M.

Dependencies

Enable Show Intensities output port parameter.

Data Types: single

Error code for message parsing, returned as a scalar. The error code values are:

  • 0 — Successfully parsed the laser scan message.

  • 1 — The Data field of the laser scan message was truncated.

Dependencies

Enable Show ErrorCode output port parameter.

Data Types: uint8

Parameters

expand all

Maximum length of the laser scan array, specified as a positive scalar.

Select Configure using ROS... to set this parameter automatically using an active topic on a ROS or ROS 2 network. You must be connected to the network.

Select this parameter to enable the Angles port. If you enable this parameter, the message must contain RGB data or the block returns an error code.

Select this parameter to enable the Intensity port. If you enable this parameter, the message must contain intensity data or the block returns an error code.

Select this parameter to enable the ErrorCode port and monitor errors.

Toggle whether to output a variable-size signal. Use variable-sized signals only if you expect the image size to change over time. For more information about variable-size signals, see Variable-Size Signal Basics (Simulink).

Extended Capabilities

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

Version History

Introduced in R2022a