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

Reading data from the shifted laser, as if it was in the middle

asked 2019-02-04 08:11:52 -0500

grzegorz.f-16 gravatar image

updated 2019-02-05 01:26:43 -0500

I have algorithms that use raw data from laser [-pi/2;pi/2]. Earlier, the laser was in the middle of the robot. Now it has been moved closer to the left front edge and rotated by pi/4.

What is the best way to transform data from a shifted laser so that it would be visible like the laser was in the middle? I suppose, I have to use tf, but I don't know how exactly.

I'm using ROS Kinetic.


One of the algorithm are used raw data from laser (LaserScan/ranges) for simple avoiding obstacles, that react different depending on the occupied area. I have one treshold that qualifies thing as an obstacle in area and return if its free or not. Very similar to this image:

image description

And now the laser is shifted, and I want to use my old algorithm to work, as if it was in the middle. Know I'm using the law of cosines to change the tresholds, but maybe there is a way, to "just" tranform the data from laser.

edit retag flag offensive close merge delete


You are correct that TF is the way to do this, however you will need to tell us more about your application before we can help you. What are you using to process the laser data and what is it being used for?

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-02-04 10:47:43 -0500 )edit

I've added some description.

grzegorz.f-16 gravatar image grzegorz.f-16  ( 2019-02-04 16:51:13 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-02-04 18:08:13 -0500

The laser scan message effectively stores a type of 2D point cloud in a compressed way. If your algorithm is working with this type of message directly then I don't think there is an easy way of adjusting it's position and not changing the algorithm.

You have two options that I can see:

1, Change the algorithm to use a point cloud message type and translate the points into the original frame the sensor was in.

2, Change the algorithm so that the segments it detects obstacles in can be shifted based upon a translation from the TF system.

I would think option 1 would be the easiest to implement, there are already nodes to convert laser scan messages into point clouds. So you would only have to modify the input stage of your algorithm.

Hope this makes sense.

edit flag offensive delete link more

Question Tools


Asked: 2019-02-04 08:11:52 -0500

Seen: 188 times

Last updated: Feb 05 '19