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

/world frame in stage simulation [closed]

asked 2013-02-22 14:54:14 -0500

updated 2013-07-19 18:00:28 -0500

Hi, i'm new to tf and rviz. I have a simulation in stage with an array of lasers and robots. I want to see all laser scans in rviz but, as far as i know, i need to have a correct tree of frames (related between them), but simulating that, i have frame for every position model, but don't have a /world frame in which other frames can be related and connected.

Is there a way in which i could add a /world frame and parent it with another frames?

EDIT:

these are the frames I get: frames.pdf

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by gustavo.velascoh
close date 2014-02-17 09:04:14

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-02-22 15:37:19 -0500

joq gravatar image

updated 2013-02-23 03:23:56 -0500

What transforms are you getting?

$ rosrun tf tf_monitor

Stage should be providing transforms to the /odom frame.

Can rviz display them in /odom?

EDIT: I see stage is providing separate /robot_N/odom frames. That is actually reasonable, since neither is presumed to be exact.

If you wish to display them as if the odom frames were ground truth, you can define static transforms from /map to /robot_N/odom:

$ rosrun tf static_transform_publisher 0 0 0 0 0 0 /map /robot_0/odom 1000
$ rosrun tf static_transform_publisher 0 0 0 0 0 0 /map /robot_1/odom 1000

That is not really correct, since there should be a certain amount of noise added to your simulated odometry. But it should work well enough for viewing in the /map frame.

A more accurate solution would involve writing your own transform broadcaster that subscribes to the stage base_pose_ground_truth topic, broadcasting the exact pose in some convenient frame of reference. That may be tricky to get working.

edit flag offensive delete link more

Comments

I have transforms /robot_0/odom through /robot_n/odom

gustavo.velascoh gravatar image gustavo.velascoh  ( 2013-02-22 16:01:13 -0500 )edit

Thanks Jack!

gustavo.velascoh gravatar image gustavo.velascoh  ( 2013-02-23 03:43:28 -0500 )edit
1

answered 2013-02-22 17:41:47 -0500

kalectro gravatar image

I just started with tf today and this tf tutorial helped me understand it and I would guess you need exactly that

All you need to do is create a link between every robot and the world frame

tf::TransformBroadcaster br;
tf::Transform transform;
transform.setOrigin( tf::Vector3(x,y,z)); // position in respect to the world frame
transform.setRotation( tf::Quaternion(x,y,z,w) ); // orientation in respect to the world frame
br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "world", "robot_n"));

This assumes you can somehow get an absolute pose from any robot in respect to the world frame. If you only get relative measurements between the robots, you do not need a world frame and create the transform broadcaster between robot_n and robot_m.

edit flag offensive delete link more

Comments

Thanks for your answer. As you said, I could create a transform between robots, but the frames would be relative to a only robot. Instead of that i would like to have a fixed frame for all robots to relate to

gustavo.velascoh gravatar image gustavo.velascoh  ( 2013-02-23 01:53:57 -0500 )edit

Question Tools

Stats

Asked: 2013-02-22 14:54:14 -0500

Seen: 2,627 times

Last updated: Jul 19 '13