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

listener lookupTwist producting wrong velocity for turns.

asked 2016-06-29 19:31:04 -0500

uwleahcim gravatar image

I'm trying to extract linear velocity from an object's tf frame using lookupTwist.

I simulate an object moving around on a 400m track. I used simple line and circle equations to describe its position at time t at fixed velocity.

Looking at the tf in rviz, it performs correctly and moves in a smooth oval.

Now when I try and extract velocity using lookupTwist, the linear velocities are all messed up. In straight lines the linear velocities are correct, but in the turns the velocities values sky rocket. For example if I set my simulated object to move at 10 m/s, on a turn the velocity would instantly shoot up to 50m/s go back down halfway way through the turn, shoot back up to 50 just before the straight away.

This is because the code I'm using to extract the velocity from a tf. Is there something I should be aware of or is my environment bugged?

geometry_msgs::Twist objectTwist;
tf::TransformListener listener;
listener.lookupTwist("/map", "/sim_object", ros::Time(0), ros::Duration(0.1), objectTwist);

cout << sqrt(objectTwist.linear.x * objectTwist.linear.x + objectTwist.linear.y * objectTwist.linear.y) << endl;
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2016-06-29 22:15:17 -0500

uwleahcim gravatar image

updated 2016-06-29 22:24:02 -0500

I think I might have fixed my issue

Anyways, after playing around with the parameters, I think I finally have the correct velocity values.

listener.lookupTwist("/sim_object", "/map", "sim_object", tf::Point(), "map", ros::Time(0), ros::Duration(0.1), objectTwist);

I really don't have an idea what "tf::Point()" is suppose to do. I would love if someone can explain to me exactly what the above code is doing.

edit flag offensive delete link more

Comments

Be a little careful when using this function. I believe there is a bug that in some cases may result in incorrect values. I spent some time looking into it, but never got to the bottom of it: https://github.com/ros/geometry/issue...

jarvisschultz gravatar image jarvisschultz  ( 2016-06-30 08:10:47 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-06-29 19:31:04 -0500

Seen: 945 times

Last updated: Jun 29 '16