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

X Y and Z coordinates in LaserScan

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

S.Yildiz gravatar image

How can I get the three points from the LaserScan?

edit retag flag offensive close merge delete

Comments

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 -0600 )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.

l4ncelot gravatar image l4ncelot  ( 2018-10-01 07:48:31 -0600 )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 -0600 )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 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
5

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

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

Question Tools

2 followers

Stats

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

Seen: 3,385 times

Last updated: Oct 01 '18