ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange

# X Y and Z coordinates in LaserScan

How can I get the three points from the LaserScan?

edit retag close merge delete

Do you mean the X Y Z coordinates of an obstacle detected by your laser ?

( 2018-10-01 03:58:19 -0500 )edit
1

@S.Yildiz sorry if I sound rude but I saw you posting a lot of questions and it seems to me like you're not even trying to search for the answer first by yourself. There is a chance somebody else has already asked this question in the past. This applies for any other forum like stackoverflow etc.

( 2018-10-01 07:48:31 -0500 )edit

No I'm searching for answers but can't find any. Then my last hope is the forum. And I'm also a newby, so please understand my position.

( 2018-10-02 01:17:34 -0500 )edit

@S.Yildiz ok no problem, I get it. I was at the same place some time ago. I was just ensuring you're at least trying on your own. Wish you luck with your project.

( 2018-10-02 01:43:25 -0500 )edit

Sort by ยป oldest newest most voted

The points in the LaserScan message are stores in polar coordinates in a fairly compressed way to save space.

You'll need to loop through the ranges array calculating the angle for that specific point using the equation:

angle = angle_min + (i * angle_increment)


where i is the index within the ranges array.

This will give you the polar coordinate of the point which you can convert to a 2D Cartesian point using the usual method here. The Z coordinates of laser scan points are always zero because this message type stores 2D horizontal laser scan data.

Hope this helps.

more