I have a very bizzar issue : holding position is not a problem, but when I try to spin the motor (with move_incremental in 0.4.12 and with input_pos in 0.5.1), the controller starts the move, but then freaks out and accelerates wildly and causes an ERROR_CURRENT_UNSTABLE on the motor.
Here are the plots for position, velocity and current that I got.
I can’t seem to understand where the problem stems from. Any help would help.
Have you tried adjusting motor.config.current_control_bandwidth?
Perhaps reduce that to 500 from the default 1000
Yes I have tried that. I also tried reducing the encoder bandwidth, without any success.
What’s strange is that it behaves adequately for the first few turns, but at some point, the current send through the coils makes the motor accelerate in the wrong direction, witch obviously leads to divergence.
This typically happens when you have slippage between the encoder and the motor, or significant electrical noise to look like slippage. Also we’re working on a slippage detector for faster shut-downs
I can here that, but it would be quite surprising since the encoder is directly linked to the motor with a solid coupling. Is there a way to be sure that slipping is the issue ? Some kind of test that I could undertake to remove any doubt ?
Also slippage detection is quite interesting ! How would you go about implementing such a thing ? Maybe detecting a change in the measured dynamics ?
Well it’s a bit tricky. You have to measure the output of the encoder vs a known reference, so like… a known good encoder or have it drive to a particular position and mark that it’s repeatable.
You could also have your pole_pairs or encoder.cpr off just a little bit (like 4069 instead of 4096) which would be enough to make it pass calibration but it would do exactly this after a few revolutions.
You were right : the encoder was slipping ! Thank you very much.
For anyone stumbling into this thread : Do NOT couple your encoder to your motor using a piece of heat shrink ! The heat shrink will slip, leading to this extreme acceleration.
Glad you got it sorted out!