[ros-users] [Discourse.ros.org] [TurtleBot] OpenCR and encoders

Chris Albertson ros.discourse at gmail.com
Sun Jul 30 00:04:04 UTC 2017



I have experimented with the STM32 processor and did want to use it's builtin ability to read quadrature encoders.   I had to give up because of a conflict over timber use.

But I did find the CPU has zero trouble at all with VERY high interrupt rates  I have four motors each spins up to about 11,000 PRM and has 64 pulses per revolution.   The processor can handle the maximum rate and still do quite a lot else.  that would be (4 x 11,000 x 64)/60 interrupts per second.    That said the interrupt handler in C++ is very short and fast.

You can further speed  up the  processing by a large factor if you remember the last time the motor changed directions and then you can ignore that the encoder is using quadrature.  And your handler becomes "i = i + direction"  Just one statement.   

So the simplest way to to do the encoder handing inside an interrupt handler in software.

But if you can use the STM32 counter hardware that just seems so much more efficient but in my case I ran out of timers





---
[Visit Topic](https://discourse.ros.org/t/opencr-and-encoders/2335/4) or reply to this email to respond.




More information about the ros-users mailing list