This project leverages the Raspberry Pi's capability to interface with an MPU6050 sensor via I2C/smbus. It utilizes the sensor's Digital Motion Processor (DMP) to deliver fully filtered readings of orientation, linear acceleration, and angular velocity.
The DMP employs a suite of proprietary MotionFusion algorithms as an alternative to the algorithms offered as part of the imu_tools package. The processed values are published as standard sensor_msgs/Imu
messages, ready for use in ROS applications.
This implementation builds upon the foundational work from thisisG's MPU6050-I2C-Python-Class, with added support for ROS Noetic and compatibility for the Raspberry Pi platform.
- A Raspberry Pi with ROS Noetic installed (Ubuntu 20.04)
- A valid version of Python 3
- An MPU6050 sensor
Image Source: MPU6050 | Live Graph | Raspberry Pi
- Clone the Repository:
Navigate to your catkin workspace's src
directory and clone the repository:
cd ~/catkin_ws/src
git clone https://github.com/apojomovsky/mpu6050-dmp-ros-raspberry.git
- Install ROS Dependencies:
Use rosdep to install the dependencies declared in the package.xml
file:
cd ~/catkin_ws
rosdep install --from-paths src --ignore-src -r -y
- Install Python Dependencies:
Navigate to the cloned repository and install the required Python packages:
cd mpu6050-dmp-ros-raspberry
pip3 install -r requirements.txt
- Build the Package:
Go back to your catkin workspace and build the package:
cd ~/catkin_ws
catkin_make
- Source the Setup File:
Source the setup.bash
file to update your environment:
source ~/catkin_ws/devel/setup.bash
- Launch the ROS Node:
To start the MPU6050 sensor node, use the provided launch file:
roslaunch mpu6050_dmp_ros mpu6050.launch
This will start publishing sensor data to the imu_data
topic.
Follow these steps to run the MPU6050 DMP ROS demo with integrated RViz visualization:
- Launch the Demo:
Open a terminal and execute the following command to start the demo:
roslaunch mpu6050_dmp_ros demo.launch
Take into account this assumes the computer has an X server up and running, which might not always be the case for an embedded SBC.
- You can modify the
imu_config.yaml
file in theconfig
directory to change settings like frame ID, I2C bus, and device address. - Ensure that the I2C interface of your Raspberry Pi is enabled and configured to communicate with the MPU6050 sensor.
This project is licensed under the LICENSE file included in the repository.