1

I would like to do an evaluation of the localization of the robot which is pose estimation between the SLAM algorithm (gmapping package) and the ground truth. I've acquired the ground truth data from the /ground_truth/state topic and I got the data like this. I got pose.position.xyz and orientation.xyzw for the ground truth data.

ground truth data

But now I dont know how to get the pose estimation data from the gmapping package. Where I can get the data? Is it in the /tf topic? If in the /tf topic which frame (base_link, base_scan, caster_back_link or imu_link) is the estimation data from the gmapping package? And how can I echo the data in the terminal same as the ground truth data? Thank you! Figure below is the frame data from the rviz application.

/tf data from the rviz application

AmirulJ
  • 118
  • 1
  • 11

1 Answers1

1

The gmapping package does not directly publish any pose. It will publish a topic /map which is an occupancy grid. It will also publish a transform to the map frame from odom; this is essentially a roundabout way of getting a pose. If you want a pose in this frame you need to create another node that takes in the current pose, most recent transform produced from gmapping, and apply it to the pose. This can be done with the tf package, for example:

listener = tf.TransformListener()
trans,rot = listener.lookupTransform('map', 'odom', rospy.Time(10))
listener.transformPose('odom', your_pose)
BTables
  • 4,413
  • 2
  • 11
  • 30
  • I have run this code, but there is an Exception AttributeError: "TransformListener instance has no attribute 'tf_sub'". If you dont mind can you help me with the full code? – AmirulJ Oct 01 '21 at 08:24
  • @AmirulJ the complete code here is relative to what your code actually looks like. Based on the error you're getting I think something else is wrong with how you're trying to use my example. Are you importing the `tf` module? Are you sure the transforms you're trying to get are available? – BTables Oct 01 '21 at 15:24
  • Yeah I've importing `tf` module. my code is like this `#! /usr/bin/env python import rospy import tf listener = tf.TransformListener() while not rospy.is_shutdown(): try: trans,rot = listener.lookupTransform('map', 'odom', rospy.Time(10)) listener.transformPose('odom', your_pose) except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException): continue rate.sleep()`. Actually I dont know much how to use this code. Do you have some link or class that I can subscribe to learn more about this? – AmirulJ Oct 01 '21 at 17:05
  • 1
    @AmirulJ Assuming all transforms are available that code looks correct. There is tons of good info on the ROS wiki about the `tf2` package: http://wiki.ros.org/tf2/Tutorials – BTables Oct 02 '21 at 18:17
  • Hi @BTables if you dont mind can you help me with this question related to real robot https://stackoverflow.com/q/69466939/16594158 – AmirulJ Oct 06 '21 at 13:45
  • Hi @BTables can you help me with this question related to multiple robot for real environment https://stackoverflow.com/q/69766018/16594158 – AmirulJ Oct 29 '21 at 08:48