What would cause current spikes in Torque Mode?

I am seeing occasional current spikes in torque mode which I can’t explain.

As I understand it, torque is directly proportional to current. So if I set a torque, there is exactly one value for the current that I should be seeing in response.

I am looking at the Iq current here, because obviously the ‘real’ currents in the phases are all spinning around. I have plotted Iq and input_torque against time and, while Iq is much noisier, it does plot basically a scaled version of the input_torque graph, as I expect it should.

Except for every so often, when it lurches up past current_lim and trips an error on the ODrive.

In a more simple situation, if the motor is moving or being backdriven, then there is a back emf happening which will lower the voltage across the coils and that will reduce the current. But with the Odrive, the controller will act to increase the input voltage to counteract this - because it always wants to keep the current at the constant value that gets you your setpoint torque.

So - to my naive understanding - it shouldn’t matter how fast or how hard you’re driving the motor. In torque control mode, the current should stay constant.

This is clearly not what I’m seeing, so can anyone explain what it is I’m missing?

Question 2:

What happens at present is that I see a sudden lurch in current that takes me over the current_lim value in my settings, and the Odrive goes into an error state.

For my application, I would actually prefer to truncate the current and experience a weaker torque for a few tenths of a second, rather than trip the error and have everything bomb out.

I haven’t seen an obvious setting for doing this. Does the ODrive have the ability to do it?

The odrive loses track of the current control, and Iq/Id aren’t really accurate anymore. Since ODrive has no control over the motor torque anymore, it faults out.

This is usually because the motor is accelerating too fast, or it has fast dynamics but the current_control_bandwidth on odrive isn’t set high enough, etc. It can also be caused by poor encoder alignment, encoder slipping, or noise on the encoder lines.

Thanks for your response.

In this case the motor may experience sudden bursts of rapid acceleration, but they won’t ever last longer than a few tenths of a second, and in normal operation the acceleration is much more mild.

These current lurches have all coincided with those little acceleration peaks, so I think your explanation is dead on the money.

But as I said, I don’t mind if we very briefly truncate the current during those accel peaks, if that means effectively letting the ODrive have a moment to gather its bearings.

What does current_control_bandwidth actually do? Can I fiddle with that number to get the behaviour I want?

It can also be electrical noise causing errors in the current sensor measurement which causes the real current to change in response to the noise. A ferrite ring choke can help with that.
But the most common cause for me has been encoder issues. What encoder are you using?

We are using an AS5047P. We’re using its ABI interface and that hasn’t really given us any problems at all so far.