In the tasks.c file, this line in particular


If I understood this correctly, attitude is updated at 100hz only by default. Why then do we need gyros which update at 8kHz rates?


I haven't quite dug into the source code to confirm my suspicions, but this file lends credence to the idea that this task facilitates accelerometer-based attitude calculations and not gyroscope-based calculations.

From line 274 to line 280 in the file you link to (tasks.c), the TASK_ATTITUDE task is said to be enabled if the accelerometer device is enabled (in the Betaflight Configurator):

#if defined(USE_ACC)
    if (sensors(SENSOR_ACC) && acc.sampleRateHz) {
        setTaskEnabled(TASK_ACCEL, true);
        rescheduleTask(TASK_ACCEL, TASK_PERIOD_HZ(acc.sampleRateHz));
        setTaskEnabled(TASK_ATTITUDE, true);

Given that these are the only times that the TASK_ATTITUDE task is mentioned in this file, I doubt that this 100 Hz task is related to gyroscopic sampling.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.