Robotics StackExchange | Archived questions

X Y and Z coordinates in LaserScan

How can I get the three points from the LaserScan?

Asked by S.Yildiz on 2018-10-01 03:49:16 UTC

Comments

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

Asked by Delb on 2018-10-01 03:58:19 UTC

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

Asked by l4ncelot on 2018-10-01 07:48:31 UTC

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.

Asked by S.Yildiz on 2018-10-02 01:17:34 UTC

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

Asked by l4ncelot on 2018-10-02 01:43:25 UTC

Answers

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.

Asked by PeteBlackerThe3rd on 2018-10-01 07:05:40 UTC

Comments