Odrive PID update frequency?

I’m trying to find the PID update frequency of the odrive. How fast does the PID loop run?

It runs at 8kHz for all loops (position, velocity, current).

Is 8kHz chosen for a specific reason and not much faster eg 100-200kHz? The STM runs at 168Mhz (210 DMIPS) and you would think a PID loop is only the sum of 3 multiply accumulates.

Isn’t a 12bit encoder position = 4096 counts per revolution at 60,000 rpm = 1000 rps => 4Mhz update?

  1. The motor doesn’t respond that fast (mechanical bandwidth is low)
  2. Nobody’s encoder at this price point is rated to 60krpm or anything near it
  3. It’s true that we could run the PID that fast but you can only run the PID as fast as your switching frequency since your output can’t change fast enough, and 24kHz is about as high as we want to go on switching frequency - it’s not audible, but it also reduces switching losses. A 200kHz switching frequency would be extremely inefficient.

The PID is close to just 3 macs but the FOC itself is significantly harder to process (although it’s not SUPER heavy load).

1 Like
  • There’s no point in running the position loop faster than the velocity loop
  • There’s no point in running the velocity loop faster than the current loop
  • There’s no point in running the current loop faster than the half PWM frequency
  • You don’t want to run the PWM too fast or you will warm up the FETs and lose efficiency and current capacity, and will also cause excess EM noise
  • There’s no point in running the current loop faster than the current-sense bandwidth
  • The current loop (FOC) is relatively expensive to compute, and it’s nice to have spare CPU cycles for things like USB communications
1 Like