Main Content

readScanAngles

(To be removed) Return scan angles for laser scan range readings

readScanAngles will be removed in a future release. Use rosReadScanAngles instead. For more information, see ROS Message Structure Functions.

Description

angles = readScanAngles(scan) calculates the scan angles, angles, corresponding to the range readings in the laser scan message, scan. Angles are measured counterclockwise around the positive z-axis, with the zero angle along the x-axis. The angles is returned in radians and wrapped to the [ –pi, pi] interval.

example

Examples

collapse all

Load sample ROS messages including a ROS laser scan message, scan.

exampleHelperROSLoadMessages

Read the scan angles from the laser scan.

angles = readScanAngles(scan)
angles = 640×1

   -0.5467
   -0.5450
   -0.5433
   -0.5416
   -0.5399
   -0.5382
   -0.5364
   -0.5347
   -0.5330
   -0.5313
      ⋮

Input Arguments

collapse all

'sensor_msgs/LaserScan' ROS message, specified as a LaserScan object handle.

Output Arguments

collapse all

Scan angles for laser scan data, returned as an n-by-1 matrix in radians. Angles are measured counter-clockwise around the positive z-axis, with the zero angle along the x-axis. The angles is returned in radians and wrapped to the [ –pi, pi] interval.

Version History

Introduced in R2019b

collapse all

R2021a: ROS Message Structure Functions

You can now create messages as structures with fields matching the message object properties. Using structures typically improves performance of creating, updating, and using ROS messages, but message fields are no longer validated when set. Message types and corresponding field values from the structures are validated when sent across the network.

To support message structures as inputs, new functions that operate on specialized ROS messages have been provided. These new functions are based on the existing object functions of message objects, but support ROS and ROS 2 message structures as inputs instead of message objects.

The object functions will be removed in a future release.

Message TypesObject Function NameNew Function Name

Image

CompressedImage

readImage

writeImage

rosReadImage

rosWriteImage

LaserScan

readCartesian

readScanAngles

lidarScan

plot

rosReadCartesian

rosReadScanAngles

rosReadLidarScan

rosPlot

PointCloud2

apply

readXYZ

readRGB

readAllFieldNames

readField

scatter3

rosApplyTransform

rosReadXYZ

rosReadRGB

rosReadAllFieldNames

rosReadField

rosPlot

QuaternionreadQuaternion

rosReadQuaternion

OccupancyGrid

readBinaryOccupanyGrid

readOccupancyGrid

writeBinaryOccupanyGrid

writeOccupanyGrid

rosReadOccupancyGrid

rosReadBinaryOccupancyGrid

rosReadOccupancyGrid

rosWriteBinaryOccupancyGrid

rosWriteOccupancyGrid

OctomapreadOccupancyMap3D

rosReadOccupancyMap3D

PointStamped

PoseStamped

QuaternionStamped

Vector3Stamped

TransformStamped

apply

rosApplyTransform

All messagesshowdetails

rosShowDetails