I found a post about a similar issue to the 2-second thunk Periodic Jerk in velocity control mode
Which links to this reddit post https://www.reddit.com/r/arduino/comments/1iuwcdq/psa_arduino_with_single_core_esp32s_adds_5ms/
I’m not sure I fully understand what the solution is, but I’ll play with it and report back.