Cyclic interrupt faster than 10 ms

Hello,
for our current application, we would like to evaluate certain constraint conditions in a cyclic interval as fast as possible (we are aiming for something like 4-6 ms) to use the result in a SearchL command. However, the conditions contain some calculations so using a simple CyclicBool would not work. We tried using timed interrupts with an ITimer and a TRAP routine, but the minimum cyclic time here is 100ms for cyclic interrupts. Even if we use the Single attribute, we can only go down to 10ms. The conditions itselfs highly depend on the program we are running, so hardcoding them in a background task is probably not an option either.

Finally, we came up with a bit of a silly approach now: We use a background task to update a persistent variable every 6 ms and subscribe to this variable using an IPers in our foreground task, so our TRAP routine gets called periodically with that frequency. This seems to work, but we do have some concerns about the performance cost of this approach.
Is it likely that this will have a negative impact on the robots runtime performance? And is there a better way to do this?

TLDR; Is there a feasible way to cyclically call TRAP routines faster than 10 ms?

Thanks & Kind Regards

Comments

  • I heard about EGM option that exists on Robotware 6, it could log data at 4 ms.
  • MickyMicky Germany ✭✭✭
    Hello,
    if you use a single timer interrupt, you could use 0.01s for the time value 
    At the end of the TRAP routine, you have to redefine the timer interrupt.
  • Thank for the answers!
    We tried the option of using single interrupts with 10ms and then setting up the next single interrupt in the TRAP routine, which worked in general but ended up taking more like 15ms in reality due to some execution overhead, I guess.
    In the end, we decided to use a background task with an infinite loop instead, which we can activate and deactivate from the main task, giving us cycle times of ~5ms.
Sign In or Register to comment.