Robotics StackExchange | Archived questions

difference in the out of /rtabmap/localization_pose AND tf_echo base_link map

hi everyone,

why does the output of "rostopic echo /rtabmap/localizationpose" is not nearly the same as the output of "rosrun tf tfecho base_link map"??

rostopic echo /rtabmap/localization_pose
    header: 
      seq: 196
      stamp: 
        secs: 1635782243
        nsecs: 203865051
      frame_id: "map"
    pose: 
      pose: 
        position: 
          x: -1.5592828989
          y: 0.962841153145
          z: -0.0775390192866
        orientation: 
          x: 0.00117897975686
          y: -0.0111340316652
          z: 0.250081671479
          w: 0.968160011232

rosrun tf tf_echo base_link map
    At time 1635782334.518
    - Translation: [-11.030, -1.230, -0.004]
    - Rotation: in Quaternion [0.004, -0.005, -0.217, 0.976]
                in RPY (radian) [0.011, -0.009, -0.438]
                in RPY (degree) [0.615, -0.492, -25.083]

image description

Does anybody have any idea? any suggestion? thanks

Asked by Delbina on 2021-11-01 12:26:25 UTC

Comments

I'm not very familiar with rtabmap, but looking at your timestamps, it seems the outputs are about 90 seconds apart. A cursory search tells me that

localization_pose is published only on loop closures in mapping mode

To me, it sounds like the difference is just due to motion between the two times. Does that seem plausible?

Asked by tryan on 2021-11-01 12:47:01 UTC

@tryan, thanks for replying to my message, sorry, now i have provided the output of these two command in the nearly the same timestamp: but you can see that the pose are showing comletely different!!!

header: 
  seq: 52
  stamp: 
    secs: 1635782304
    nsecs:  50256014
  frame_id: "map"
pose: 
  pose: 
    position: 
      x: 6.37265491486
      y: 5.29913377762
      z: 3.52734804153
    orientation: 
      x: -0.00370800378964
      y: 0.0037309657959
      z: 0.240399621874
      w: 0.970659757754


At time 1635782303.548
- Translation: [-11.750, -1.924, -0.069]
- Rotation: in Quaternion [0.003, -0.007, -0.194, 0.981]
            in RPY (radian) [0.009, -0.013, -0.391]
            in RPY (degree) [0.502, -0.748, -22.430]

Asked by Delbina on 2021-11-01 12:54:28 UTC

Does localization_pose match the /map -> /odom transform?

Asked by tryan on 2021-11-01 13:39:55 UTC

i think they should be nearly the same. because localization-pose is also publishing when the robot moves in the mapping mode, and on the other side the tf between map and base_link shows the transform between these two.

Asked by Delbina on 2021-11-02 04:51:50 UTC

Answers

What is your TF tree? Normally it should give the same pose if it is rtabmap that is publishing the map frame. As @tryan said in the comment, in mapping mode it is only published when a loop closure happens. Example from the mapping demo:

$ rostopic echo /rtabmap/localization_pose
header: 
  seq: 77
  stamp: 
    secs: 1368730236
    nsecs: 134734750
  frame_id: "map"
pose: 
  pose: 
    position: 
      x: 5.55326509475708
      y: 0.23269307613372803
      z: 0.0
    orientation: 
      x: 0.0
      y: 0.0
      z: 0.12789368571831303
      w: 0.9917878825503819
  covariance: [0.010061253030561875, 1.0726019974909155e-08, 0.0, 0.0, 0.0, 2.1881313138980934e-07, 1.0726019974909155e-08, 0.01006118062633855, 0.0, 0.0, 0.0, 2.4385704188259004e-07, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 2.1881313138980934e-07, 2.4385704188259004e-07, 0.0, 0.0, 0.0, 6.1001109372668455e-06]

$ rosrun tf tf_echo map base_footprint
At time 1368730235.810
- Translation: [5.552, 0.219, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 0.072, 0.997]
            in RPY (radian) [0.000, -0.000, 0.145]
            in RPY (degree) [0.000, -0.000, 8.305]
At time 1368730236.798
- Translation: [5.553, 0.233, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 0.226, 0.974]
            in RPY (radian) [0.000, -0.000, 0.457]
            in RPY (degree) [0.000, -0.000, 26.158]

They are the same, minor the tf echo not exactly showing the transform at the same stamp than the topic.

Asked by matlabbe on 2021-11-04 16:47:39 UTC

Comments

thanks @matlabbe yes i am using rtabmap to publish the map,but i do not have camera to be able to have loop closure (in this case we will have proximity detection) Can these two outputs be the same in proximity detection or not? . The only thing that I can see is that map frame orientation is not matched with base-link and Odom frame in the initial step. I mean after turning on the vehicle and launching rtabmap, I can see that map-frame has a rotation of 90 degree from base_link!!! I really do not know they should be matched with each other or not, if yes, how can I modify the map frame.?

Asked by Delbina on 2021-11-05 03:02:59 UTC

@matlabbe @ tryan you mean that in the middle the of the path, these two may be different from each other, and only when loop closure happens, they are nearly the same. Am i correct?

Asked by Delbina on 2021-11-07 17:20:19 UTC

@matlabbe, I have attached the tf tree, would you please guide me how can i solve this issue? thanks

Asked by Delbina on 2021-11-23 08:57:55 UTC