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

rviz returns no transform between frames, but view_frames says otherwise

asked 2014-02-21 13:02:15 -0600

Orgrim gravatar image

In my project, I cannot get rviz to "center" the map based on the base_link's position. I have a node that publishes two transforms, one between base_link and a frame containing the corrected odometry position, and the other between this odometry frame and the map frame. However, I tried checking the tf tree using view_frames, and everything seems in order: the odometry frame is child to base_link and the map frame is child to the odometry's. The only odd thing I noticed is that if I try and echo the transform between base_link and the map, or viceversa, it fails once and then starts returning the transform. anyway, the code I use to publish these two transforms is:

ros::Time current_time=ros::Time::now();
tf::Transform l_to_o=tf::Transform(tf::createQuaternionFromYaw(theta_best), tf::Vector3(x_best, y_best, 0.0));
l_to_o=l_to_o.inverse();
odom_broadcaster.sendTransform(tf::StampedTransform(l_to_o, current_time, "/base_link", "/slam_gpu/odom"));
tf::Transform o_to_l=tf::Transform(tf::createQuaternionFromYaw(theta_old), tf::Vector3(x_old, y_old, 0.0));
tf::Transform o_to_m=(o_to_l*l_to_o);
odom_broadcaster.sendTransform(tf::StampedTransform(o_to_m, current_time, "/slam_gpu/odom", "/slam_gpu/map"));
edit retag flag offensive close merge delete

Comments

It sounds like your tf tree is probably OK. Are you seeing any error messages from rviz?

ahendrix gravatar image ahendrix  ( 2014-02-21 13:11:40 -0600 )edit

anything suspicious in tf_monitor?

demmeln gravatar image demmeln  ( 2014-02-24 09:10:17 -0600 )edit

also, what exactly do you mean by "center" the map?

demmeln gravatar image demmeln  ( 2014-02-24 09:13:30 -0600 )edit

I'm sorry, in the end the problem didn't have anything to do with the tf.. I just forgot to set the frame id of the map upon publishing it. So the tf was there, but the map wasn't connected to the frame.

Orgrim gravatar image Orgrim  ( 2014-02-24 09:28:29 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-02-21 13:18:06 -0600

ahendrix gravatar image

I would take a look at the Views section of the manual and make sure your view is attached to your base_link frame.

I think rviz has changed a little since the manual was written, so things may be in slightly different places, but you should still be able to find the Views panel and set the frame to base_link.

edit flag offensive delete link more

Comments

nope, I tried setting the target frame of the view but it didn't change anything. And there's no error from rviz either in rqt_console.

Orgrim gravatar image Orgrim  ( 2014-02-21 14:17:15 -0600 )edit

so fixed_frame is `map` and target_frame is `base_link`?

demmeln gravatar image demmeln  ( 2014-02-24 09:13:50 -0600 )edit

Question Tools

Stats

Asked: 2014-02-21 13:02:15 -0600

Seen: 947 times

Last updated: Feb 21 '14