<p>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 <em>accelerometer</em>-based attitude calculations and not <em>gyroscope</em>-based calculations.</p>
<p>From line 274 to line 280 in the file you link to (<a href="https://github.com/betaflight/betaflight/blob/master/src/main/fc/tasks.c" rel="nofollow noreferrer">tasks.c</a>), the <code>TASK_ATTITUDE</code> task is said to be enabled if the accelerometer device is enabled (<em>in the Betaflight Configurator</em>):</p>
<pre><code>#if defined(USE_ACC)
    if (sensors(SENSOR_ACC) &amp;&amp; acc.sampleRateHz) {
        setTaskEnabled(TASK_ACCEL, true);
        rescheduleTask(TASK_ACCEL, TASK_PERIOD_HZ(acc.sampleRateHz));
        setTaskEnabled(TASK_ATTITUDE, true);
    }
#endif
</code></pre>
<p>Given that these are the only times that the <code>TASK_ATTITUDE</code> task is mentioned in this file, I doubt that this 100 Hz task is related to gyroscopic sampling.</p>

CC BY-SA 4.0
2021-02-18T17:46:13.437Z
2021-02-18T21:25:18.373Z
2021-02-18T21:25:18.373Z
ifconfig
<p>In the <a href="https://github.com/betaflight/betaflight/blob/master/src/main/fc/tasks.c" rel="noreferrer">tasks.c</a> file, this line in particular</p>
<pre><code>[TASK_ATTITUDE] = DEFINE_TASK(&quot;ATTITUDE&quot;, NULL, NULL, imuUpdateAttitude, TASK_PERIOD_HZ(100), TASK_PRIORITY_MEDIUM)
</code></pre>
<p>If I understood this correctly, attitude is updated at 100hz only by default. Why then do we need gyros which update at 8kHz rates?</p>

<betaflight><imu>
Betaflight attitude update rate only 100hz?
enginEEr
# Betaflight attitude update rate only 100hz?

(Asked by: username_0 on 2021-02-18)

In the tasks.c file, this line in particular
[TASK_ATTITUDE] = DEFINE_TASK("ATTITUDE", NULL, NULL, imuUpdateAttitude, TASK_PERIOD_HZ(100), TASK_PRIORITY_MEDIUM)

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

**Tags:** betaflight, imu

---

## 1 answers

### Answer by username_1 on 2021-02-18. Score: 3 | Accepted answer

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);
    }
#endif

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.


---

