Free fall detection in firmware (stabilizer.c)
Posted: Tue Jul 21, 2015 3:30 pm
Hello,
I am currently trying to implement a very basic free fall detection. I basically just check the current value of vSpeedAcc and after a certain threshold I set the actuatorThrust to the maximum.
Flashing the firmware works fine, but even though I log values above the threshold, the Crazyflie does not increase the thrust.
Code in stabilizerAltHoldUpdate:
Code in stabilizerTask (before distributePower is called):
Any ideas on what might be the problem?
I am currently trying to implement a very basic free fall detection. I basically just check the current value of vSpeedAcc and after a certain threshold I set the actuatorThrust to the maximum.
Flashing the firmware works fine, but even though I log values above the threshold, the Crazyflie does not increase the thrust.
Code in stabilizerAltHoldUpdate:
Code: Select all
if (vSpeedAcc < -0.04) {
falling = true;
}
else if (vSpeedAcc > 0.00) {
falling = false;
}
Code: Select all
if (!altHold || !imuHasBarometer() || !falling)
{
// Use thrust from controller if not in altitude hold mode
commanderGetThrust(&actuatorThrust);
}
else
{
// Added so thrust can be set to 0 while in altitude hold mode after disconnect
commanderWatchdog();
if (falling) {
actuatorThrust = altHoldMaxThrust;
}
}