Sudden change in behaviour - Severe 'cogging' now happens

After a week of behaving perfectly, our ODrive has starting behaving strangely and I am hoping there is someone out there who recognises the symptoms.

When running in torque control mode, previously you could set input_torque = 0.5 and watch the motor spin up to speed as a result.

Now, on setting input_torque:

  • the motor sometimes begins turning, then its speed sort of dies off as it seizes up.
  • sometimes motor never turns and is simply locked in place straight away.
  • in both cases, when you try to turn it manually, it’s held in place by the applied torque.
  • at low torque settings, you can force it around, in which case you feel a very strong ‘cogging’.
  • at high settings the torque is too strong to do that so you just have a fixed shaft.

On setting torque to 0 and recording a graph of pos_estimate and vel_estimate while I just turn the shaft this way and that, I see that position seems perfectly smooth, while velocity is highly weird and oscillatory.


Yesterday we did a short test that at one point involved driving the motor with high torque, while not letting it move. This didn’t go on for very long.

There was a hot smell, at which point we immediately stopped and powered everything off.

There was no trip or error from Odrive. The FETs were warm but not massively so. We just wanted to err on the side of caution.

We didn’t do anything further yesterday, so didn’t see whether the motor worked normally or went wrong after that test.


Today I replaced the mount for our encoder’s magnet with a proper 3D printed one. (Our previous one was pretty dodgy. Blutack was involved.)

Previously our magnet visibly wobbled around as you turned the shaft, which we all knew was shit, but it didn’t seem to affect the Odrive’s performance at all. It actually did fine until the 3D printed one arrived and we were able to make the switch.

It was only after that that we turned it on and noticed the motor’s behaviour has now changed.

This was on axis M0, so we prompty swapped to axis M1 and saw the exact same behaviour.

I can’t account for why the motor is now behaving like it does. I have two vague theories:

  • somehow our badly mounted encoder was hiding a problem which has now shown itself. This seems rather unlikely to me.
  • somehow our experiment yesterday damaged something, so now the ODrive is broken in some way that affects both M0 and M1 axes. Quite what that might be, I have no idea.

I am at a loss for what to do next. Does anyone have any ideas?

Definitely sounds like your encoder offset is not correct. Did you redo the motor and encoder calibration, and save_configuration() after modifying the encoder?

1 Like

I went through this page again when I swapped axes, changing current_lim, pole pairs, motor constant, and encoder cpr on M1 to match the M0 values.

As far as I understand it, the encoder calibration has to run at startup and nothing happens without it. So I have run that, several times.

I’m not sure what motor calibration entails. Because we’re working in torque mode, I assumed the PID tuning step was irrelevant in my case.

Modifying the encoder was simply the act of taking off one bodged mount and sticking on a nicer one. Only the magnet was affected - the encoder itself went right back where it came off. As far as it’s concerned, nothing should have changed. At least, as far as I can see.

Is there anything else I should have altered?

Hmmmm. If you are running Encoder Calibration then it must be something else. Just to be sure, make sure you run odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE everytime you connect to be sure.

Also check that you are not mixing axis0 and axis1. It can help to backup your configuration and then compare axis0 and axis1 with a diff compare to track down any deviant settings.

Two other things you can look at are.

  1. Perhaps you need to tune you gains. If you set the integrator gains to 0, does the behaviour change?
  2. Can you check that there are not shorts between the phases of your motor? Maybe some stray wires are touching at the ODrive terminals?

Thanks for your suggestions.

I took the motor out, inspected it (saw nothing wrong), put it back in, and now it works fine. So, your guess is as good as mine what happened there.

I did the diff compare anyway, and see very few differences between the two.

  • controller.config.load_encoder_axis was different. Does this value imply I could have told the ODrive to use M0’s encoder, rather than manually switching the wires around? Or is this setting doing something else.
  • encoder.config.offset was obviously different, since the magnet had been moved.
  • motor.config.phase_inductance and motor.config.phase_resistance were almost identical but slightly different. (0.09653420746326447 versus 0.09318007528781891 for phase resistance.) This is on the same motor, but I’m guessing those tiny differences are within acceptable boundaries for variation?

I am going to have a look at tuning the motor now. I am still not clear on whether these values are used, if I never use position or velocity control modes?

1 Like

You are correct, they are probably not needed in torque mode.

My best guess is that there was a small wire making contact between the phases somewhere.

Yes. Load_encoder_axis lets you use two encoders, one for commutation of the motor and the other for tracking speed and position on the far side of a gearbox, to compensate for backlash etc. Both encoders have to be plugged in, but it’ll only do calibration of the commutation encoder (the normal one)

Just to follow up:

I have decided to blame the motor for everything. It worked for a while, then once again refused to calibrate, throwing seemingly unrelated errors (claiming pole pairs mismatch and that phase resistance was out of range.)

The phase resistance can’t have been out of range, since I checked it and it was only 0.12 ish. However, since previously it had been reading as 0.09 ish, I took that as a cue that something was wrong inside the motor. I assumed that if there was a short between two coils, that would account for a changing resistance and also explain why the ODrive saw it as not having the right number of pole pairs.

I tool the motor actually apart this time so I could properly inspect the coils, and found… nothing, everything looked fine. So I just sort of cleaned it a bit and put it back together.

It works again, but I know I’m on borrowed time til it doesn’t. Mystery solved as far as the Odrive is concerned though.

@Wetmelon cheers for that explanation, that explains the name ‘load_encoder’.

Do you have a mounting screw that’s too long and touching the coils? :smiley: