0
$\begingroup$

Rosanswers logo

Hi, I'm using ROS kinetic on ubuntu 16.04.

I'm working on multi-sensors conditions. (one RGB-D sensor and 2D-Lidar sensor)

As you might expect I have to fuse these two scan data for robustness measurement.

And unfortunately, each of these two topics has different frame names.

In detail, laser topic has "laser" frame but RGB-D topic's frame name is "base_footprint".

As I'm still new to ROS tools, I'm suffering from modifying the two topics.

Below is the warning I got

[ WARN] [1569927078.948303952]: Failed to lookup transform from frame laser into target frame base_footprint! Dropping input DetectedPersons message on topic /spencer/perception_internal/detected_persons/laser_front. Reason: "laser" passed to lookupTransform argument source_frame does not exist. 

If anyone happened to know how to do it, can I get some advice? (I decided to modify frame name of "laser" to "base_footprint")

Thanks in advance :)


Originally posted by kane_choigo on ROS Answers with karma: 195 on 2019-10-01

Post score: 0


Original comments

Comment by LeoE on 2019-10-01:
Sorry, but why do you want to modify the frame names? It is meant to have a different name, since they probably are two different frames, right? It's not like a pub/sub topic, it is a coordinate frame in which the data is received. You should transform your data from laser into base_footprint or the other way aoround.

Have a look at this and this

Comment by Vignesh_93 on 2021-07-01:
It would also be helpful for others if the way to change the frame id in a particular message is explained. As stated by the person in the question, if we want to fuse the readings of the camera and a lidar sensor into a single pointcloud / message type by concatenating both the messages into a single message, then we should have the final message frame id to be something common for both the parent messages.

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Hello !

First you should take a look at @LeoE link in the comment, there is all you need to know about tf, take a look at this answers if you want some image.

I you want to fuse the sensor data, you don't want them to have the same Frame as they don't have the same location.

When you publish a Frame, you actually tell Tf that there is 2 frames : The source frame and target frame.

For example, here is the frame from the "rgbd_launch" package (you can see it with rosrun tf view_frames: image description

each broadcaster is broadcasting the target and the source. The Camera link, the source of all frame, is never broadcasted, instead ROS is waiting for an another node (the application node) to tell where is this frame.

If you launch your lidar node, you should have something like this (I don't have a lidar so I just assumed a single tf was published, I used static_transform_publisher :

image description

In this case, lookuptransform will fail, as the tf tree are not connected.

In your application you should tell Tf where are located the camera to the lidar (or the inverse), or even better if you have a reference point (A robot chassis ?) for the camera and the lidar

For example, I can tell TF that the lidar is 20cm above the camera (Z-axis) with rosrun tf static_transform_publisher 0 0 0.2 0 0 0 camera_link laser_base 10: image description

Or if both the camera and the lidar are connected to the same robot, I can tell tf too : image description

You can use different way to tell tf the transform between your sensors, the best way (I think) is an URDF with robot_state_publisher :

http://wiki.ros.org/tf/Tutorials

http://wiki.ros.org/robot_state_publisher/Tutorials

http://wiki.ros.org/urdf/Tutorials


Originally posted by lmathieu with karma: 591 on 2019-10-01

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by Petros ADLATUS on 2022-04-02:
very helpful merci beaucoup. As you have mentioned rosrun tf static_transform_publisher 0 0 0.2 0 0 0 camera_link laser_base 10 It should be also possible to do this in a launch file or not?

$\endgroup$
0
$\begingroup$

Rosanswers logo

For the question, First you need to transform from one source frame to target frame using the available functions. For example if you are working with pointcloud data then the function would be something like below:

tf::StampedTransform transform;
try{
        transform_listener.lookupTransform(target frame as a string, source frame as a string, ros::Time(0), transform);
    }
    catch (tf::TransformException ex){
        ROS_ERROR("%s",ex.what());
    } 

pcl_ros::transformPointCloud(message_without_transformed, final_transformed_message, transform);

The you need to change the frame if of the transformed message which is final_transformed_message.header.frame_id = "your required name"

Hope that helps and I am not too late!!


Originally posted by Vignesh_93 with karma: 43 on 2021-07-02

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Petros ADLATUS on 2022-04-02:
@Vignesh_93 hey very helpfuln because I'm working with Pointcloud data. Might you help me to use it for a special node I want to use?

Comment by Vignesh_93 on 2022-05-05:
Apologies for a late reply. Can you be more specific on the node ? Like giving details like what does the node do, what are all the different frames used in the node ?

Comment by Petros ADLATUS on 2022-05-09:
no problem, seems that it does not work with the old node. I tried a new one, which produces me the right output ;)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.