motion - focusrobotics/explorer GitHub Wiki

Parts Used

PWM and PID

By default you can use the arduino analogWrite() function to set output PWM, but that gives a very low PWM frequency which is whiny. Setting up high frequency PWM varies a little by microcontroller.

Motors

Pololu 37mm metal gear motors: https://www.pololu.com/product/4755 6533 encoder counter per rev, or about 21 encoder counts per mm with the skate wheels I'm using voltage no-load performance stall extrapolation 12 V 100 RPM, 150 mA 34 kg⋅cm (470 oz⋅in), 5.5 A

Motor Drivers

I'm planning to drive it with this motor driver: https://www.pololu.com/product/2507 It will drive 12A continuous per channel. PWM up to 20KHz to limit noise. The library they supply only does the high speed PWM on an UNO (or a couple others) and I was going to use a mega2560

Odometry

  • 21 ticks per mm means 21000 ticks/sec if moving at 1m/s or 21 ticks/ms or ~50us per tick per wheel. Probably too fast of an interrupt rate for Arduino.
  • Probably need FPGA to track odometry position and velocity. Might as well generate PWM from the FPGA as well, if it's going to be there.
  • Actually, max speed is 100RPM or 1.6666 revs/sec so 10888 ticks/sec, so more like 100us per tick per wheel.
  • But wait! It's not really 64 ticks per rev. It's 16 ticks per rev with quadrature encoders. They said 64 because they were counting both edges of both phases.
  • The gear ratio is exactly 102.083:1 so at 16 ticks per motor rev it's 1633.328 ticks per output rev. That makes 612us per tick at max speed. Much more reasonable for an Arduino running at 16MHz.
  • Of course that means it's more like 5 ticks per mm, but that should still be more than fine for odometer resolution.
  • I can still switch to an FPGA solution in the future if I find limitations.
  • The Arduino probably talks to a Raspberry Pi via a serial connection. That same Arduino or another one could handle bumpers and/or IR or sonar or other simple sensors.

Microcontroller(s)

  • From the discussion above about odometry I can see that I might be processor limited with an 8 bit AVR so I'm looking at 32 bit microcontrollers
    • ESP32 is very inexpensive and fast (240Mhz dual core) and I have bought a couple
    • STM32 "blue pill" is quite fast and cheap and doesn't have the wifi that I probably don't need, the black pill (stm32F411) is even faster and I bought 10 from AliExpress
    • Teensy 4.0 (or earlier) is very fast (up to 600Mhz) and not too expensive: $20. I bought two.