Main loop speed

I just wondered why the main loop in the ACM code is only executed at 100Hz

NG code runs at 200Hz (which is slow for a quad)

 

if you take a look at Aeroquad and Mikrokopter code: they all run at 500Hz

 

I now that the ADC on APM runs at 400Hz, but I also know that it is capable of 2000Hz readings.

So why not speed the ADC up and let the code run at 200 (or maybe more) Hz ?

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • ok thanks for your information =)
  • Developer

    Like Randy and Jason said, we are using DCM others mostly using Kalman and other methods to estimate angles. DCM is much more efficient on those. We have tested on earlier ArduCopter 100Hz and even that gave really good results. Speed up from 100 to 200Hz did not give any great change on stability.  Also most of ESCs will filter out updates that are coming faster than 150Hz. So it's rather useless to send updates faster than that to motors.

     

    NG main loop actually runs with 160Hz.

     

  • Developer
    We sample the ADC at a higher rate so we don't need to have such a high loop. If you want to, feel free to up it to the amount you'd like. It's hard coded at the main loop. Just lower the number. You can even try and assign it to a radio channel to explore different rates until you feel comfortable that you found something that works for you. I've kept it to 100 because I needed the headroom for future code execution.
  • Developer

     

        I believe this is at least partially because we use DCM which gives us a quick and accurate estimation of attitude which means we don't need to update as quickly to get stable results.  I read somewhere that once you get up to really high rates (like 2000hz) you're updating the instructions to the engines every quarter turn of the prop.  It's hard to imagine that that's really necessary... in fact, it's hard to imagine that it's useful to cycle at anything above the update frequency of the gyros and ESCs.

This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…