Ask Your Question
0

How to add the map => odom tf to encoder coordinates

asked 2019-08-19 09:05:28 -0500

Tima1995 gravatar image

updated 2019-08-19 09:39:39 -0500

Hello,

I am just trying to analyse the accurancy of my robots localization in comparison to the simulation model (in the end I want to compare the simulation vs. real robot for odom, map position and perfect data from gazebo Modelstates). Right now, it was enough for me to get my location data from the encoder (or odometry). Now, due to some longer tests and longer distances, the robot moved away from its actual perfect location due to drifting etc.. That´s why I now try to visualize the differences between the odom, map and perfect data. Here, I ran rosrun tf tf_echo map odom to see the difference between the coordinate systems with the follwing result:

At time 312.790
- Translation: [0.309, -0.188, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 0.001, 1.000]
            in RPY (radian) [0.000, -0.000, 0.001]
            in RPY (degree) [0.000, -0.000, 0.082]

Now I want to get that map-odom coordinates into my simulation. Is there an easy way to do that, if I already have the odom data, for example by just adding them?

Here is a picture of my tf_tree: C:\fakepath\rqt_tf_tree_world.jpeg

Do I need to write an additional node, or can I get the map/odom information directly from the slam node into my localization node?

Thanks for your help!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-08-19 10:09:59 -0500

Tima1995 gravatar image

Okay, answered it by myself with this:

listener = tf.TransformListener()
        while not rospy.is_shutdown():
            try:
                (trans,rot) = listener.lookupTransform('/map', '/odom', rospy.Time(0))
            except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException):
                continue
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-08-19 09:05:28 -0500

Seen: 15 times

Last updated: Aug 19