Welcome to GPS Module repository
3.3 Fusion of IMU and GPS data
Fusion of IMU and GPS data
This function fuses IMU and GPS data and displays the fused data in Rviz.
1. Run
terminal input
roslaunch imu_gps_localization imu_gps_localization.launchrosbag play gps.bag
After running, with the playback of data packets, in Rviz the green track is also continuously extended, representing the position after fusion,

In this case, we use the data package in the folder as a demonstration. In actual development, we need to use the rosbag tool to record the data of IMU and GPS.
We can view the contents of this packet through rosbag info gps.bag ,

The content of the topic part is the topic recorded by this data packet. It can be seen that IMU (/imu/data and /imu/mag and GPS (/nmea_sentence) data are included.
During operation, we can also view the node graph to see the topic transmission between nodes, terminal input
xxxxxxxxxxrosrun rqt_graph rqt_graph

2、launch file
x<launch> <param name="acc_noise" type="double" value="1e-2" /> <param name="gyro_noise" type="double" value="1e-4" /> <param name="acc_bias_noise" type="double" value="1e-6" /> <param name="gyro_bias_noise" type="double" value="1e-8" />
<param name="I_p_Gps_x" type="double" value="0.0" /> <param name="I_p_Gps_y" type="double" value="0.0" /> <param name="I_p_Gps_z" type="double" value="0.0" />
<param name="log_folder" type="string" value="$(find imu_gps_localization)" />
<node name="nmea_topic_driver" pkg="nmea_navsat_driver" type="nmea_topic_driver" output="screen" /> <node name="imu_gps_localization_node" pkg="imu_gps_localization" type="imu_gps_localization_node" output="screen" />
<node pkg="rviz" type="rviz" name="rviz" output="screen" args="-d $(find imu_gps_localization)/ros_wrapper/rviz/default.rviz" required="true"> </node>
</launch>Among them, the node imu_gps_localization_node is used to fuse IMU and GPS data. Its source code is located in imu_gps_localization-master/ros_wrapper/src. The focus is on localization_wrapper.cpp , which includes subscription topics, fusion data and publishing topic data.