# Fusing IMU and GPS to the map frame using robot_localization

Similar to the question asked here with respect to fusing GPS and IMU sensor data when those are the only two sensors available. My question is with respect to creating the odom and map frames. Based on the dual_ekf_navsat_example, an ekf_localization_node1 fuses odom and IMU data inputs and generates an output odometry/filtered and creates the odom->base_link transform. The second ekf_localization_node2 takes the IMU, odom, and odometry/gps inputs and generates an output odometry/filtered_map and creates the odom->map transform. Finally, the navsat_transform_node takes the gps, imu, and odometry/filtered_map inputs and generates an output odometry/gps.

If I don't have an odometry source for the ekf_localization_node1 what is best practice to provide that node with odometry. Also, should the output from ekf_localization_node1 be an input to ekf_localization_node2?

Once this is set up properly, what is the correct output to use for estimating my robot's current position in the map frame?

Thank you for the help!

edit retag close merge delete

Sort by » oldest newest most voted

The approach you are describing consists of running two instances of an EKF. One with odometry and GPS (ekf_localization_node2) and one only with odometry (ekf_localization_node1). This is done because the GPS data is subject to discrete discontinuities (jumps) and it is likely to be unfit for use by navigation modules. Therefore, we would use odometry/filtered for navigation and odometry/filtered_map for localization.

If you are operating the robot manually with a remote and you do not need navigation, you can only use one instance. The odom and map frames are fix frames. Typically, the map frame is fixed at a specific location and the odom frame starts wherever you start robot localization. If you are not navigating autonomously, you can provide a static transform between map to odom and you can have the EKF2 publishing odom->base_link. For example:

<node pkg="tf2_ros" type="static_transform_publisher" name="map_odom" args="0 0 0 0 0 0 map odom" />


You will have to bear in mind that this can have jumps and it is not desirable to have a transform that can jump around. But for instance, if you have RTK GPS with high precision, maybe this is not as problematic.

As for your specific questions: (1) Depending on the robot you have but you can add wheel odometry or visual odometry. (2) No, you should provide the odometry inputs separately for both EKF instances.

more

Thank you for the answer. My application is marine, so neither visual nor wheel odometry are reliable. I will be using this for navigation as well as other tasks that require the vessel to have fairly accurate localization.

( 2021-04-13 15:09:48 -0500 )edit

If you do some research on odometry applied to underwater/vessel robots there is an extensive use of stereo cameras that perform visual odometry extracting landmarks in image sequences. It also depends on how close to the floor you navigate, where it will be easier to extract features. If you will be navigating, it is then recommended to use the 2 EKF implementations. For navigation purposes, you would use the output from ekf_localization_node1. To obtain a precise localization for other purposes you would use the output from ekf_localization_node2. I do not know the exact implementation of your robot and the application, but if you do not need a super robust control and precise trajectory, you might try using just EKF2 and use this ouput that includes GPS for navigation.

( 2021-04-15 05:32:58 -0500 )edit

Hi, I am trying to fuse odometry, imu and RTK GPS (data freq: 1Hz) to obtain a continuous GPS coordinates, is it necessary to have two ekf nodes?

( 2021-06-25 02:18:42 -0500 )edit