Motor stops after 45 revolutions

A strange thing is happening to my motor in velocity control mode. It rotates for 45 revolutions (around 370k encoder counts) and then stops spinning. Setting the velocity in the reverse directions causes it to spin -90 revolutions until it reaches -370k and then stops spinning again!

What is happening?!

Hi There! Can you answer a couple questions that will help us get to the root of the problem:

What software version are you on? What are the exact commands you’re sending?

Hardware version: the new batch of v3.5
Software: ODrive control utility v0.4.1
Motor: GARTT ML5210 (24N22P)
Encoder: CUI AMT102
Commands:

odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
odrv0.axis0.controller.config.control_mode = CTRL_MODE_VELOCITY_CONTROL

odrv0.axis0.controller.vel_setpoint = 200000
# motor spins up a few seconds (drawing 0.1A), 
# then stops after ~45 revolutions (draws 1.5A when stopped)

print(odrv0.axis0.encoder.pos_estimate)  # returns around 370000

odrv0.axis0.controller.vel_setpoint = -200000
# motor spins the other way, then stops again

print(odrv0.axis0.encoder.pos_estimate)  # returns around -370000

Ok great

Can you tell me what you have for the following values:

odrv0.config.brake_resistance
odrv0.axis0.motor.config.pole_pairs
odrv0.axis0.motor.config.motor_type
odrv0.axis0.motor.config.cpr

Thanks

Thanks for the reply.

In [27]: odrv0.config.brake_resistance
Out[27]: 2.0

In [28]: odrv0.axis0.motor.config.pole_pairs
Out[28]: 11

In [29]: odrv0.axis0.motor.config.motor_type
Out[29]: 0

# did you mean this?
In [31]: odrv0.axis0.config.counts_per_step
Out[31]: 2.0

I think he intended to ask for the .encoder.config.cpr, which is also what I’m wondering.

1 Like

Ah, my .encoder.config.cpr was set to 8196. Changing it to 8192 fixed the problem. Thanks!!

2 Likes