Best error recovery behavior in position control

I’m using odrive in a position control scenario. In the corexy machine i’m building, i will sometimes face collisions during normal operations. By collision, I mean a move that cannot be executed because of a physical contraint that the motors cannot surpass.

I’m developping a monitoring algorithm to detect such collisions before odrive starts triggering errors (ex: when the set point and encoder counts difference starts growing too much, )

I would also like to explore what should be done in case of odrive triggering errors, but without having to make another encoder calibration sequence

Is that even possible? Does it depend on error types? what is the best way to achieve this?
Basically i would like some guidance instead of just asking people to power on/off the whole thing when “something does not work as intended”.

Two examples I observed below for illustration purposes

thanks


13:18:19.527 -> ok G0 X55 Y-65
13:18:19.560 -> MOTOR_INFO STATE_A=8 STATE_B=8 ERROR_A=0 ERROR_B=0
==> axis state 8 is closed loop control (AXIS_STATE_CLOSED_LOOP_CONTROL = 8) / motor error 0 means “all ok (ERROR_NONE)”
(I read definitions here => https://github.com/madcowswe/ODrive/blob/master/tools/odrive/enums.py)

I would typically get those values with
serial_ << “r axis” << axis << “.current_state\n”;
serial_ << “r axis” << axis << “.motor.error\n”;

if i purposely accept coordinates outside the limits (-800 on Y) to create a collision of the gantry again the frame (outch!)

13:18:27.633 -> ok G0 X55 Y-800
13:18:31.277 -> MOTOR_INFO STATE_A=1 STATE_B=1 ERROR_A=64 ERROR_B=64
13:18:31.277 -> ok M40

Then i get a motor error 64 (ERROR_BRAKE_CURRENT_OUT_OF_RANGE = 0x0040 ???)
and axis.current_state to 1 (AXIS_STATE_IDLE = 1)

Trying out other collisions, I observe
13:18:31.277 -> MOTOR_INFO STATE_A=8 STATE_B=1 ERROR_A=0 ERROR_B=1024

When that happens, odrive ignores position commands (because it should be in state 8 for closed loop control and it’s not)