Arducopter maximum loop speed

Hi,

I'm just starting out with my Arducopter project and still have a lot to learn about the code, so pardon me if this question has been addressed before.

I understand that the autopilot main loop runs at 100 or 200 Hz, I read this in another topic. My question is this: what is the maximum possible loop speed that the code can be run at?

Reason I'm asking:

- I am trying to implement a control algorithm that needs computations as fast as possible to guarantee convergence of its solution.

- HOWEVER: sensor data and output to the ESC does not have to be that fast. It is enough to have sensor data and control output at the frequency currently implemented in the code. But for each of these cycles I want to have a number of 'internal' calculations to have convergence of my algorithm.

What are the limitations of the system? Can this be done? Thanks!

 

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

Join diydrones

Email me when people reply –

Replies

  • Developer

    You may need to make a tiny state machine to break your tasks up across many loops. That's what we do for GPS and other periodic tasks. An RTOS would do this more granularly, but we do it ok by hand.

     

  • you can slow down main loop a bit (maybe to 100Hz), and then add your own loop which runs next to the main loop

    depending on how much you want to add you could go to very fast loop speeds (but always keep in mind that your main loop needs one cycle every 10ms)

     

    it depends on the functions you enable in code (like GPS, magnetometer, telemetry, battery monitor, navigation,...) how many time each cycle takes

  • Developer

     

    I think you need to be very cautious when adding complex code, so that you don't add to much jitter to the ACM loops.

    Real time programming is a complex task, not only to design code, but to debug and check jitter as well.

     

    I'm a very beginer with the ACM code, so i can't help more, but all i can say is that you need to be extremely prudent when adding complex code. And if your code is too complex, you need to put it inside a non realtime loop, so that it can give back processor time to realtime loops.

     

    The tip is to use timers and flags to measure ressources. Perhaps that such timers flags are implemented in the code, experienced ACM coders will confirm this.

     

    Using a realtime kernel could be a solution, don't know if it's possible with Arduino. Some realtime kernels add only a small overhead and simplify realtime programming.

     

     

This reply was deleted.

Activity