0
$\begingroup$

Rosanswers logo

Hi all,

I am starting to set up awesome robot_localization package and I am using rotary encoders (nav_msgs/Odometry, both pose and twist) and IMU (sensor_msgs/Imu) which provides continuous data and Ultrawide band sensor which provides global absolute position data as a nav_msgs/Odometry message (only pose, (x,y and yaw)) . As suggested on the wiki page of the package, I can fuse data from the encoders and the IMU in the odom_frame which gives the transform odom_frame -> base_link_frame. For the map_frame, I can fuse data from rotary_encoders, IMU and Ultrawide band sensor (It is similar to GPS in the sense that it provides global absolute position data) and it gives the transfrom from map_frame -> odom_frame but next I am using amcl to improve the pose_estimate and amcl also provides map_frame->odom_frame transformation. So, I want to ask how should I deal with the transformations (specifically map_frame->odom_frame), Should I just not use the map_frame->odom_frame transformation from robot_localization and let amcl take care of it, If yes how can I not use the transformation? Or is there any better way to deal with it?

Update 1:
If I give output of AMCL and UWB to second instance of ekf_localization_node, it will give me the required transformation (map_frame -> odom_frame) and will publish the output odometry message on odometry/filtered topic but I am using move_base which expects robot pose on /amcl_pose topic. So, I can remap the output on odometry/filtered to amcl_pose and change the message type from nav_msgs/Odometry to geometry_msgs/PoseWithCovarianceStamped, Does that sound okay?

Also, another approach which I am thinking is to run the first instance of ekf_localization_node (in odom_frame) with rotary encoders and IMU as input which will give odom_frame->base_link_frame transformation and then run second instance of ekf_localization_node (in map_frame) with UWB, rotary encoders and IMU as input. I am slightly confused about how the second instance will work. Will it modify the odom_frame -> base_link_frame tf by considering (or changing) the data from UWB in the odom_frame? If yes, then I can directly use the modified odom_frame->base_link_frame tf (which includes UWB, encoders and IMU) (and ignore map_frame->odom_frame tf from second instance of ekf_localization_node) in amcl and everything should be fine, right?

Update 2:
Thanks @Tom Moore for the answer! So just to clarify, run the first instance of ekf_localization_node in odom_frame with wheel odometry and IMU data as input which will give us the odom_frame -> base_link_frame transformation. Then run the second instance of the ekf_localization_node in the map_frame with wheel odometry, IMU data, UWB data (it is in map_frame) and amcl_pose which will give us the map_frame -> odom_frame transformation using existing odom_frame -> base_link_frame tf.

Thanks in advance.
Naman Kumar


Originally posted by Naman on ROS Answers with karma: 1464 on 2015-09-23

Post score: 3


Original comments

Comment by Tom Moore on 2015-09-25:
Re: edit 2, yes, sounds correct.

Comment by Naman on 2015-09-25:
Thanks a lot! :)

Comment by Punith on 2015-11-19:
@Naman In this case, How are you setting the initial pose in amcl? I mean do you use Rviz 2D Pose estimate or update the initial pose from UWB sensor as both are in map frame.

Comment by asimay_y on 2016-06-14:
hi, dear @Naman, did you solve this issue in reality? I'm doing same study on real UAV, but got very bad effect. could you please instruct me on this? thank you very much!

Comment by asimay_y on 2016-06-14:
dear @Naman, my issue is at here, i'm doing real experiment on UAV: http://answers.ros.org/question/236403/tf-problems-when-combine-robot_localization-gps-navigation-amcl-stack/

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

One option would be to turn off the map->odom transform broadcast in amcl, and then include both amcl and the UWB sensor output as inputs to the second instance of ekf_localization_node. As long as they both report data in the same coordinate frame (or you provide the necessary transforms so they can), it should work.

If I give output of AMCL and UWB to second instance of ekf_localization_node, it will give me the required transformation (map_frame -> odom_frame) and will publish the output odometry message on odometry/filtered topic but I am using move_base which expects robot pose on /amcl_pose topic. So, I can remap the output on odometry/filtered to amcl_pose and change the message type from nav_msgs/Odometry to geometry_msgs/PoseWithCovarianceStamped, Does that sound okay?

Yes, that's really the point of topic remapping. I would advise not remapping the output of the EKF to /amcl_pose, because you're using /amcl_pose as an input to the filter. Instead, do the remapping within the launch file for move_base, such that move_base now expects /odometry/filtered.

As far as your second question, read the frame descriptions here. Both instances actually generate a transform from the world_frame to the base_link_frame, so internally, you have map->base_link and odom->base_link. But tf doesn't allow a frame to have two parents, so the second EKF instance automatically detects this situation (because world_frame and map_frame match) and uses its internal map->base_link transform, along with the existing odom->base_link transform that is broadcast by the first EKF instance, to produce a map->odom transform, which it then broadcasts. For your use case, I would make sure the UWB data has a frame_id of map.


Originally posted by Tom Moore with karma: 13689 on 2015-09-24

This answer was ACCEPTED on the original site

Post score: 4


Original comments

Comment by Naman on 2015-09-24:
Thanks @Tom Moore for the answer. I have updated my original question, Can you look at it. Thanks!

Comment by asimay_y on 2016-06-12:
hi, dear @Tom Moore, i do as your instruction:

  1. turn off map->odom tf transform in amcl; 2.include amcl_pose topic and /odometry/gps topic as input to the second ekf_localization_global node;
  2. remap move_base odom topic to /odometry/filtered; but get very bad effect. could you please instruct me
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.