Why TF2 transform affects odometry accuracy but Tf transform does not

asked 2022-03-29 21:20:19 -0500

chm007 gravatar image

updated 2022-04-01 09:21:49 -0500

Good Day all,

I have a 3 wheel omni-wheel triangular robot with an RPlidar that I am trying to set up navigation. However, I am seeing a weird issue..... I recently changed my tf publisher which publishes my base to laser transform to a TF2 static publisher using "static_transform_publisher x y z yaw pitch roll frame_id child_frame_id" (because TF is depreciated).

BUT when I use the TF2 static publisher, my odometry is terrible ( here I use teleop, driving the robot straing forward for 1 meters in a corridor at .2m/s and observe very bad rotational drift).However if I use regular TF amd create a publisher as you see in my code below.. and drive the robot forward in the corridor for 1 meter at the same speed the odometery looks good showing only little rotational drift..

See here https://drive.google.com/folderview?i...

Any Idea why?

TF Publisher :

/////////////////////////////////////////////////////////

int main(int argc, char** argv){ ros::init(argc, argv, "robot_tf_publisher"); ros::NodeHandle n;

ros::Rate r(100);

tf::TransformBroadcaster broadcaster;

while(n.ok()){ broadcaster.sendTransform( tf::StampedTransform( tf::Transform(tf::Quaternion(0, 0, 1.57, 1.571), tf::Vector3(0.0, 0.025, 0.2)), ros::Time::now(),"base_link", "base_laser")); r.sleep(); }

TF2 Static Transform :

///////////////////////////////////////////////////////////////

node pkg="tf2_ros" type="static_transform_publisher" name="omnisTF" args="0 0.025 0.2 1.571 0 0 base_link base_laser"

edit retag flag offensive close merge delete

Comments

Please edit your question to add enough details to be able to reproduce your problem. As well as what you're seeing and what you expect to see differently. Without more description it's impossible to much but guess what's your doing differently.

tfoote gravatar image tfoote  ( 2022-03-30 19:51:44 -0500 )edit

@ tfoote, Thanks. I edited my question to include additional details.

chm007 gravatar image chm007  ( 2022-03-30 21:36:47 -0500 )edit

Can you show the difference in odometry? A gif of both cases maybe? You're only showing the inputs, and not the outputs that you talk about. Also I'll note that your first implementation the transform quaternion appears to be non-normalized which is potentially a problem.

tfoote gravatar image tfoote  ( 2022-03-31 03:02:28 -0500 )edit

@tfoote thanks again. Added images

chm007 gravatar image chm007  ( 2022-04-01 09:20:04 -0500 )edit

The end result aggregated images are not very informative. Can you show the output of the coordinate frames in the visualization and an animation of them as you drive? Also it would be helpful to use tf_echo or view_frames to see what you're actually publishing.

tfoote gravatar image tfoote  ( 2022-04-01 12:41:39 -0500 )edit

Numerically the two broadcasters look equivalent to me. What's not the same is how often the messages are sent: 100 Hz vs once (ever). One of your ros nodes may have code that relies on being woken up every 10 milliseconds, and that is not happening after the change you made.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-04-02 11:00:07 -0500 )edit