ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

X Y and Z coordinates in LaserScan

asked 2018-10-01 03:49:16 -0500

S.Yildiz gravatar image

How can I get the three points from the LaserScan?

edit retag flag offensive close merge delete


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

Delb gravatar image Delb  ( 2018-10-01 03:58:19 -0500 )edit

@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.

l4ncelot gravatar image l4ncelot  ( 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.

S.Yildiz gravatar image S.Yildiz  ( 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.

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

1 Answer

Sort by ยป oldest newest most voted

answered 2018-10-01 07:05:40 -0500

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-10-01 03:49:16 -0500

Seen: 2,820 times

Last updated: Oct 01 '18