Motor stops after 45 revolutions


#1

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?!


#2

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?


#3

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

#4

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


#5

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

#6

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


#7

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