-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a part to produce pose estimates using an IMU #1060
Comments
Here are some links for integrating IMU and for fusing IMU with GPS
|
Here is some python code I generated with ChatGPT to use an MPU9250 to generate pose. Note that I specifically asked to use the mpu9250_jmdev package because that is what we have installed in Donkeycar already, but perhaps there is a better package?
|
Here is code that only assumes a a 6 axis acc/gyro like an MPU6050 (so no magnetometer). In integrates (x, y, z) position. Note that we can simply use prior position and the new position to estimate the orientation. The code is in Rust, but it's obvious what it is doing.
|
Here is an alternative the explicity calculates orientation (pitch, roll, yaw) by integrating the gyro. Note this is not based on a specific library.
|
code to convert a quaternion to euler angles (pitch, roll, yaw)
|
Here is code that used the Madgewick algorithm to fuse acc/gyro/mag into a more accurate orientation. This can be combined with prior examples and integrate acc to produce position so we can estimate a full (x, y, orientation) pose with a more accurate orientation. Note that the Madgewick.update() method is not in the mpu9250 package that we used. There are a number of python implementations (see comment above). This package includes a version that can handle magnetometer or no magnetometer; Note that he For instance, this micropython package is more recent and include the Madgewick algorithm to calculate a better orientation using the magnetometer/gyro/acc fusion; https://github.com/micropython-IMU/micropython-fusion/blob/master/fusion.py
|
Note that the prior examples do not include necessary calibration. See this issue #1071 |
|
Create a part to produce pose estimates use acc/gyro/mag values from an IMU. Output is pose (x, y, angle) and accelerations (x_d, y_d, angle_d) where (x, y) is position in meters, x-axis is positive in the east direction, y axis is positive in north direction and angle is the orientation of the vehicle in radians where zero degrees is east and angles increase counterclockwise. The output should be in the same format as the kinematics pose estimators;
returns a tuple whose contents is:
We support 6 degrees of freedom, like MPU6050 (3-axis accelerometer and 3 axis gyro) and 9 degrees of freedom, like MPU9250 (3-axis accelerometer, 3 axis gyro, 3 axis magnetometer).
Include unit tests. Hint: make sure the run() method takes an optional timestamp in addition to the IMU values; if this is None the part should use time.time(), otherwise use the provided time. That allows unit tests to control the time.
Integrate this as a source of pose in the path_follow template and measure it's accuracy.
The text was updated successfully, but these errors were encountered: