Subtracting Board's Angular Velocity from ERPM to Improve ATR

One of the things I’ve been testing, I believe it noticeably isolates ATR to hills only.

What’s the Issue?

ERPM is measured in reference to the board’s frame, which can have negative side effects like ATR making tunes stiffer. Imagine this:

You’re at a standstill, then push the nose down - the actual acceleration forward isn’t instant (wheel is stationary on the ground), and compared to the board’s frame, the pitch change looks like negative speed and negative acceleration for a moment, which in combination with large positive current creates an ATR response, making the tune feel stiffer even on flat ground.

Possible Solution

I believe that pitch change shouldn’t affect ERPM and only the tire moving on the ground should count as “speed”. We can correct for this by using gyro pitch data, only thing we need to do is convert deg/s to ERPM.

Here’s the ERPM / gyro ratio: 60.0f * (MOTOR_POLES * 0.5f) / 360.0f (or simply motor poles divided by 12). Coincidentally, Lukáš recently added motor poles to the VESC interface!

Then, subtract gyro_pitch * erpm_gyro_ratio from ERPM and use that as the new ERPM for any following calculations.


I tried it and tested these variants:

  • ATR off
  • ATR on
  • ATR on + correction

On flat ground, ATR with the correction felt more or less the same as no ATR, regular ATR felt stiffer, so it seems to work (although improperly configured ATR could do the same thing…). I imagine there could be small benefits in more places, e.g. more precise wheelslip detection.


I’m not riding stock Re/Float (for example not using fmaxf() for ATR/TT sum, more symmetric TT…), but hopefully the theory is valid regardless. Or is it? I don’t have a working board at the moment, so I can’t do more testing. I already had this write up mostly done though, so here it is anyway… What do you think?

1 Like