Skip to content
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

Solved my skyrocket issue by adding 2 new features #10308

Closed
wants to merge 1 commit into from

Conversation

ultrazar
Copy link

I'm using the following setup:

  • 1S 18650 battery
  • FLYWOO F405 ERVT 1-2S 5-in-1 FC ( with overheating issues )
  • 1202.5 11500KV motors

I basically solved a skyrocket behavior by applying temperature corrections to the accelerometer measurements. I don't know if this will be helpful for anyone but I'd like to share my story.
Here's the full story:

My drone couldn't maintain a good AltHold (it had a skyrocket behavior) and I tried almost everything to get it to work. After analyzing several times all the data from the Blackbox with the INAV Blackbox Explorer I found the following things:
image
As you can see in the above image, the navAccel[2] variable which is used to calculate navVel[2] (estimated vertical speed) was just drifted downwards just as if it were badly calibrated (but it was properly calibrated) and therefore the estimated speed was always at a negative value. This caused the drone to think it was always falling down.

image
Later then I found there was a relationship between that accelerometer drifting and the temperature ( using the integrated temperature sensor of the barometer which is in the FC, where the accelerometer is located ). The thing is that my all-in-one board overheats a lot and it's temperature oscillates more than 30ºC (from 45ºC to 75ºC) and instead of just buying another one I tried to fix this someway

image
So I performed a test flight hovering stable in the air, took the values of the drifting and the temperature, and put them in a spreadsheet. Therefore I found that the relationship between the accelerometer drifting and the temperature was linear and very precise.
Once I got the values for the relationship I got into programming that compensation and after struggling with the code and debugging for a while (my first time touching INAV source code) I finally made it work and the results were incredible.

image
As you can see the drone now achives accurate vertical position estimation ( just 10-20cm away from baro readings without adding more baro weight) and there's no accelerometer drifting apparently.

I changed the least lines of code I could and programmed it so that no corrections are made unless you set those settings in the CLI.

image
Apart from that I also found that the dynamic accelerometer weighting just wasn't pretty helpful as my quad also has severe vibrations and its weight is always at the lowest value except when the drone is falling (the motors are spinning slower). Therefore, the accel weight is only increased when the drone descends and that doesn't help in estimating the vertical position. In the above image the blue line represents the accelerometer weight.

With these changes I created 3 new settings and now you can:

  • Disable the dynamic accelerometer weight to set it to constant 0.3 ( dynamic_acc_weight --> ON/OFF)
  • Add temperature compensation for the accelerometer using the baro temperature sensor. ( temp_correction_a and temp_correction_b as for the f(x) = ax +b formula )

 - Now you can disable the dynamic accelerometer weight to set it to stable 0.3
 - Added a temperature compensation for the accelerometer using the baro temperature sensor. (This drastically improved the altHold performance on my quad)
temp_correction_a = 4.834
temp_correction_b = -217.53
*/
const float acc_z_offset = ( positionEstimationConfig()->temp_correction_a * ( baroTemperature / 10.0f ) ) + positionEstimationConfig()->temp_correction_b; // f(x) = ax + b
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be using the accelerometer temps, not the baro temps for this. The baro could be very far from the accelerometer and not be exposed to the same local temperature gradients.

@@ -385,7 +388,11 @@ static void updateIMUTopic(timeUs_t currentTimeUs)
}
else {
/* Update acceleration weight based on vibration levels and clipping */
updateIMUEstimationWeight(dt);
if (positionEstimationConfig()->dynamic_acc_weight) {
Copy link
Collaborator

@mmosca mmosca Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it this is needed. And if it is, it should not be hard coded to 0.3f when off.

@breadoven
Copy link
Collaborator

Sounds like the problem I'm getting related to #10243.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants