This repo consists of the code for fusing acceleration, gyroscope and magnetometer data using simple publisher and subscriber in ROS. You can also visualize the raw and filtered data after performing required calibration and applying fusion algorithms.
Use following command to clone the repository.
git clone https://github.com/love481/sensor_fusion_IMU
Make sure you have ros installed along with needed packages to communicate with arduino. For more info, visit this page on how to communicate via ros_serial_package.
Use following .ino code in the arduino of the examples folder and then run the following command:
mkdir -p <your_project_name>/src
Now, go to the 'src' dir and copy 'filters_algorithms' folder over there. Go back to your <your_project_name> directory and run:
catkin_make
Don't forget to source the devel folder and run the following command to communicate with arduino.
rosrun rosserial_python serial_node.py _port:=/dev/ttyACM1 _baud:=115200
rosrun filters_algorithms imu_node
For visualization run:
rosrun filters_algorithms visualization_imu_data.py
Red plot denotes yaw data from magnetometer before applying kalman filter and blue plot denotes filtered yaw data
Magnetometer data before Calibration
Magnetometer data after Calibration
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.