arduino-libraries / MadgwickAHRS

Arduino implementation of the MadgwickAHRS algorithm
457 stars 190 forks source link

Centrifugal Force Compensation IMU #43

Closed brightproject closed 11 months ago

brightproject commented 11 months ago

I am developing a prototype attitude indicator. I use a board LSM6DS3 as accel + gyro sensors + STM32 as microcontroller for mathematics and ESP32 for graphics generation. I do not enter the values of the magnetometer axes, and according to the library code https://github.com/arduino-libraries/MadgwickAHRS/blob/e5905733bee11ba5866cdb8305d3de4379007a4b/src/MadgwickAHRS.cpp#L56 in the case of mx = 0, my = 0, mz = 0 the filter will only take the value of accelerations and angular velocities of the gyroscope. On the ground this filter works great. photo1692643955 (2) https://disk.yandex.ru/i/vr-5XOem67E0WQ But in flight it behaves like a glass of water - i.e. useless. left_turn https://disk.yandex.ru/i/w4hdS5hw0NJngw What is being measured is not gravity, but centripetal acceleration. Accordingly, you need to compensate for this somehow. I found only theoretical materials, but no one implemented it in code, except perhaps iNavFlight. What do these coefficients give?

#define sampleFreqDef   512.0f          // sample frequency in Hz
#define betaDef         0.1f            // 2 * proportional gain

https://github.com/arduino-libraries/MadgwickAHRS/blob/e5905733bee11ba5866cdb8305d3de4379007a4b/src/MadgwickAHRS.cpp#L28 My knowledge of programming is not very good, and I cannot implement any ideas in the program, although there are many different options for solving the problem. As far as I understand this process - it is necessary, at the beginning of a right or left roll, to give priority to the data from the gyroscope, and “mute” the accelerometer data, when the turn ends, the data from the accelerometer again takes priority over the angular velocity data from the gyroscope. Can anyone explain whether it is possible to implement compensation for centrifuge forces in MadgwickAHRS or is this filter not capable of working in flight? I found and use a more “advanced” filter, which adds the magnetometer signal. I haven't tested it in flight yet. I wanted to refine and test the MadgwickAHRS filter. After all, even filtering only using an accelerometer and magnetometer gives the roll, pitch and yaw angles.

per1234 commented 11 months ago

Hi @brightproject. Thanks for your interest in this open source project. This issue tracker is only to be used to report bugs or feature requests specific to the project. This topic is more appropriate for the Arduino Forum. I'm sure we will be able to help you out over there:

https://forum.arduino.cc/