1)
My understanding is that robot_pose_ekf is a deprecated/orphaned package. Considering that, and how active the support for robot_localization is, you should use robot_localization. It does exactly what I think you are asking for and the wiki page is super well documented and there is a lot of discussion here on RA about how to setup and debug the package.
Personally I learned by installing the Clearpath Husky simulator and learning from there. You can see here in the husky_control package how they set up robot_localization to generate the transform from odom to base_link by fusing odom and imu measurements.
2)
Generally, it is my understanding, that the tf tree should be used by every application that needs to understand its location. So in my opinion looking up transforms between things is a good way to find location, but may not translate perfectly into every single specific use case you can imagine.
Originally posted by JackB with karma: 977 on 2020-11-29
This answer was ACCEPTED on the original site
Post score: 3
Original comments
Comment by tryan on 2020-11-30:
To add to the second answer, you probably don't want to find the transform between odom_frame
and base_frame
if you're trying to calculate a distance on a map. The transform between map_frame
and base_farme
is generally more useful. The difference can be small, but odom_frame
can move relative to the map.
Comment by bfdmetu on 2020-12-01:
Also amcl_pose topic publishes a coordinate system. Why we don't use amcl_pose topic to calculate distance.
Maybe there is a misconception in my head....
if i subscribe amcl_pose and take the x and y coordinate, will it equals the <map_frame and base_frame > calculation.
Another thing i confused ....
My odom file publish odom0 topic and odom_frame-->base_link transformation... My ekf file subscribe odom0 topic and imu/data topic and publish odom topic... And also publish odom_frame-->base_link transformation.
In that way 2 different node publish same transfer function odom_frame--> base_link... Is this right way or do i need to change frames name , tf.
Comment by tryan on 2020-12-01:
Using the amcl_pose
topic is probably fine and should yield similar results for simple applications, but using the transform tree tends to be more versatile and robust; you can control the timing more easily for example.
Yes, renaming the frame(s) to avoid redundancy is a good idea. You will have issues if multiple sources publish conflicting transforms. Your robot may start jumping around the map.