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

Moving frames in 3D (6dof)

asked 2011-05-11 01:00:57 -0500

updated 2011-05-11 06:49:22 -0500

Hi everybody, I have a question about frames , transforms and TF. I would like to extend the simples Turtle tf tutorials ( ) based on a 2D space but I'm having a lot of troubles doing it. Unfortunately I didn't find (yet) something on the mailing list or on ros-answers... I have this 3 frames:

  • world_frame
  • odom_frame (with a fixedtransform respect to world)
  • cart_frame (I move this frame with the odometry data)

Here is the code:

static tf::TransformBroadcaster br;
static tf::TransformListener tf_;

and this

while (ros::ok()){

br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "/world", "/odom"));

here, with updateOdom I calculate the x,y,theta position from the odometry (like the tutorial)

    br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "/odom", "/cart_frame"));
}  catch(tf::TransformException e)
{   ROS_WARN("errore transformpose (%s)", e.what()); }

Now what I'm trying to do is move the cart_frame not only with the x+y+th params but with a full 6-dof transform, as if the the cart_frame was moving on a circular garage car ramp, and here starts my question: the simplest way is to add the information to the odometry, so I can call the sendtransform() directly, but what if I had a situation where the odometer always sends only 2D transforms? In the example I tried to send a transform with a small pitch at the beginning of the while (ros ok())

br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "/world", "/odom"));

and this is the outcome, not properly what I want...

Ok, probably I am very tired and confused today but if someone can tell me where I'm wrong I'll be infinitely grateful =) Thank you


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-05-11 19:55:46 -0500

tfoote gravatar image

From the video it looks to me like you are updating the orientation and position in x and y, but you are not increasing the z height. Without doing that it's going to form circles not a spiral.

Also, you will need to compute the orientation of each point as a combination of the rotation and the incline.

edit flag offensive delete link more

answered 2011-05-12 02:48:04 -0500

Miguel Prada gravatar image

Your problem here is that you are supposing that the odometry data corresponds directly to the transform between the robot and the odometry frames. This is true for robots that move on a planar surface, but your case is more complicated than that and you'll need to calculate somehow the projection of the odometry data onto a spiralling ramp, which is no easy task in a general case.

You can get a result more similar to what you need by removing the pitch rotation between the world and odom frames, and modifying the transform between the odom and robot frames to something like this.

br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "/odom", "/cart_frame"));

By varying the slope variable you'll see the robot move upward at different speeds.

However this is a really crappy simplification, will restart the height at each turn (unless th can grow bigger than 2*pi) and is far from representing the real movement of a robot on a ramp.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2011-05-11 01:00:57 -0500

Seen: 1,242 times

Last updated: May 12 '11