Ask Your Question
1

Base_link frame is not connected to odom frame

asked 2015-04-05 09:23:36 -0600

nouf gravatar image

updated 2015-04-06 11:13:25 -0600

hello,

I'm using Ubuntu 14.04 and ROS Indigo

I used the following block of code to publish the transformation of base_link frame and odom frame:

geometry_msgs::TransformStamped odom_trans;
    odom_trans.header.stamp = current_time;
    odom_trans.header.frame_id = "odom";
    odom_trans.child_frame_id = "base_link";

    odom_trans.transform.translation.x = x;
    odom_trans.transform.translation.y = y;
    odom_trans.transform.translation.z = 0.0;
    odom_trans.transform.rotation = odom_quat;

    //send the transform
    odom_broadcaster.sendTransform(odom_trans);

Also, I used this launch file to publish the other frames:

<launch>
<node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="0 0 1 0 0 0 1 base_link camera_link 100" />
</launch>

When the robot start moving I run rviz and it shows the odom frame moving, but the base_link and camera_link are fixed in their initial position. I think I missed something but I don't know what is it.

UPDATE:

1) current_time is set inside the loop while(nodehandle.ok()) and is set to current_time = ros::Time::now();

2) odom_broadcaster is created outside the loop and at the beginning of the main as tf::TransformBroadcaster odom_broadcaster;

3) This is running live

4) When I run rosrun tf tf_echo odom base_link it shows values like:

At time 1428335473.731
- Translation: [-0.338, 1.148, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 0.295, 0.955]
            in RPY [0.000, -0.000, 0.600]
At time 1428335474.787
- Translation: [-1.613, 3.059, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 0.223, 0.975]
            in RPY [0.000, -0.000, 0.449]

5) This is my tf tree:

tf tree

Also I have this transformation in the launch file: <node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="0 0 1 0 0 0 1 base_link camera_link 100" />

edit retag flag offensive close merge delete

Comments

When do you set the current_time variable, and with what value? Also, where are you creating odom_broadcaster? Are you running this live or against a bag file? What happens if you run rosrun tf tf_echo odom base_link?

Tom Moore gravatar imageTom Moore ( 2015-04-06 08:32:46 -0600 )edit

please find the update in the question

nouf gravatar imagenouf ( 2015-04-06 10:57:00 -0600 )edit

what does roswtf tell you?

l0g1x gravatar imagel0g1x ( 2015-04-06 11:19:36 -0600 )edit
1

Wait, are you expecting odom and base_link to move with one another? odom is a world-fixed frame, and base_link is attached to the robot. As your robot moves through the world, they will not remain "with" one another in rviz.

Tom Moore gravatar imageTom Moore ( 2015-04-06 11:56:30 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-04-25 11:59:57 -0600

Andromeda gravatar image

Did you solve? Be sure in your code to update all frames with the most recent time stamp. I mean, every loop you should be sure that the broadcast information is updated:

odom_trans.header.stamp = ros::Time::now();

From the tutorial you see that that line of code is inside a loop. maybe you forgot to update all the frames for the camera and so on... I hope I helped you.

Regards

edit flag offensive delete link more
0

answered 2015-04-06 06:00:55 -0600

Pat gravatar image

Use odom as Fixed frame in rviz (Global options -> Fixed frame).

edit flag offensive delete link more

Comments

Already did that, but still the odom and the base_link are not connected

nouf gravatar imagenouf ( 2015-04-06 08:23:50 -0600 )edit

Hm, you mentioned that your odom is moving. So when your transform will be published correctly (and this seems to be the case when I see your code) base_link should move when rviz's Fixed Frameis is set to odom. What tells your tree?

cd /var/tmp && rosrun tf view_frames && evince frames.pdf
Pat gravatar imagePat ( 2015-04-06 10:49:40 -0600 )edit

Please find the update n the question

nouf gravatar imagenouf ( 2015-04-06 11:13:47 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2015-04-05 09:23:36 -0600

Seen: 1,817 times

Last updated: Apr 25 '15