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

Writing tf baselink -> laser with laser point data

asked 2019-02-15 06:01:40 -0500

charliew135 gravatar image


I have been following the tf tutorial on the ROS wiki page and have managed to complete both the broadcaster and listener and have it output the sample data.

I am now in the process of changing the code for my current robot I have built, so far i have edited the broadcaster and changed all of the rotations and distances for the position of my Lidar on the robot.

Im now stuck on editing the listener script. during the demo it just creates a laser point x y z and uses that however, i would like to use the data from my Lidar and am unsure of how to do so.

My Lidar currently publishes to the /scan topic laserscan data showing a header and an array of points. How do i go about adding all of these points to the demo listener script shown in the tutorial?

I'm got about a years experience with ROS, therefore if you could help me in as basic terms as possible it would be much appreciated.

Thanks Charliew135

tf tutorial:

edit retag flag offensive close merge delete


What are you trying to do with this laser scan data? Without knowing that we can't really help you too much.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-02-15 08:45:40 -0500 )edit

I was just following the navigation stack guide and the first thing to complete was the transforms. Therefore I started the tf tutorial and noticed they make up fake laser data for the purpose of the demo, so i am trying to replace this with my real laser data.

charliew135 gravatar image charliew135  ( 2019-02-15 09:39:23 -0500 )edit

My understanding was that for every laser scan a transform is conducted using the real laser data?

charliew135 gravatar image charliew135  ( 2019-02-15 09:41:46 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-02-17 15:20:39 -0500

billy gravatar image

Answer to what your intent likely is:

Since you're going through the Navigation Tutorials, I will assume your main goal is to get a robot navigating. With that assumption I'll say you do not need to do what you are trying to do. The navigation nodes AMCL/move_base will do any transforming required between the laser scan info and the laser to base transform. The TF tutorial was showing you how to do a single point as an example. You don't need to do this to get Navigation Stack working. You need to publish the TF of laser to base for NAV stack, but you do not need to write any listener for NAV stack (if memory serves).

Answer to your direct question:

If you really want to convert the entire laser scan to the base_link frame point by point then you'd have to do it point by point.

To start, convert first laser data point from polar to rectangular coordinates and then add/subtract off the transform between laser and base. Then store that back into an array. Move to next point and start again.

edit flag offensive delete link more


Thankyou very much for your answer.

This has helped me massively!

charliew135 gravatar image charliew135  ( 2019-02-18 05:20:06 -0500 )edit

Question Tools

1 follower


Asked: 2019-02-15 06:01:40 -0500

Seen: 660 times

Last updated: Feb 17 '19