Explanation about stabilizer.c

Firmware/software/electronics/mechanics
Post Reply
wasabi8888
Beginner
Posts: 1
Joined: Wed Sep 09, 2015 7:35 pm

Explanation about stabilizer.c

Post by wasabi8888 »

Hi, i want to know more about the stabilizer.c especially the altitude hold mode.
I have some question about the code, why does CF fuse the accmeter and barometer to do the althold? why not only use barometer?

Code: Select all

    // Get control from PID controller, dont update the error (done above)
    // Smooth it and include barometer vspeed
    // TODO same as smoothing the error??
    altHoldPIDVal = (pidAlpha) * altHoldPIDVal + (1.f - pidAlpha) * ((vSpeedAcc * vSpeedAccFac) +
                    (vSpeedASL * vSpeedASLFac) + pidUpdate(&altHoldPID, asl, false));

    // compute new thrust
    actuatorThrust =  max(altHoldMinThrust, min(altHoldMaxThrust,
                          limitThrust( altHoldBaseThrust + (int32_t)(altHoldPIDVal*pidAslFac))));

  }
and then about the code, as i read in the code, altHoldPIDVal is the output of pid value, can someone explain the formula above? because i dont get the concept of determine the output for Thrust speed.

Regards,
Justin
Post Reply