Hello everybody,
I have some questions about the DCM. I tried to understand the code in the file AP_DCM.cpp but there is some part that i can't understand. (ps I also read the pdf DCMDraft)
#define GRAVITY 418 //this equivalent to 1G in the raw data coming from the accelerometer
Those values, have they been choosen by testing ?
#define Kp_ROLLPITCH 0.05967 // .0014 * 418/9.81 Pitch&Roll Drift Correction Proportional Gain
#define Ki_ROLLPITCH 0.00001278 // 0.0000003 * 418/9.81 Pitch&Roll Drift Correction Integrator Gain
#define Kp_YAW 0.8 // Yaw Drift Correction Porportional Gain
#define Ki_YAW 0.00004 // Yaw Drift CorrectionIntegrator Gain
In the roll pitch error in constrains between -1.17 and 1.177 where those values come from?
_error_roll_pitch.x = constrain(_error_roll_pitch.x, -1.17f, 1.17f);
_error_roll_pitch.y = constrain(_error_roll_pitch.y, -1.17f, 1.17f);
_error_roll_pitch.z = constrain(_error_roll_pitch.z, -1.17f, 1.17f);
I'm asking these questions because I would like to implement a DCM in Android (using the Gyro, accel and compass sensors). I have a first draft of it but it's not working !
Thank you for your help !
Replies
The gravity value is based on the accelerometer sensitivity and ADC scaling.
The drift correction values were chosen experimentally for the hardware and loop speed.
The roll pitch constraints are somewhat arbitrary.
I think it's awesome what you're doing so I hesitate to mention this, but don't the InvenSense Sensor Fusion libraries in the Gingerbread API provide this sort of functionality via a Kalman filter?
https://www.youtube.com/watch?v=C7JQ7Rpwn2k
I can tell you right off that the GRAVITY constant value is the ADC value of 1G from the IMU's accelerometers, the rest look like they're a combination of hardware specifications and experiance with tuning the PID compensator..
I think the _error_roll_pitch values are in relation to the I term to prevent it from going beyond that value, although it does seem to be a rather small value...
This might be a good question for the algorithms forum, too. I think ArduIMU is mainly about the legacy ArduIMU+ hardware?