I have a few problems with odrivetool. I’m using the 188W NEMA23 motor and a 2400 counts encoder. I connected everything as instructed by getting started guide. The only thing I was not super sure about is setting pole pairs - I set it to 4 as the motor’s page mentions 8 magnet poles.
When I’m running the odrivetool I’m able to trigger calibration from time to time. Sometimes it will turn on and sometimes it won’t. I tried doing the following a few times:
Disconnect power supply and USB, exit odrivetool
Connect everything, run odrivetool
Wait 10 seconds after connecting to the motor
Try to run calibration
Sometimes it will beep and turn the motor twice in one direction and twice in the other, sometimes it won’t do anything.
And even after running the calibration successfully it doesn’t behave predictably. When setting position control it will usually turn after setting pos_setpoint for the first time, but then it will not do anything for subsequent runs. When trying velocity control, it will turn, but not in an expected way, for example it will go slowly for quarter of a turn and then it will speed up for a short period of time and then get back to slow rotation.
Does it sound like some known or common issue? How can I troubleshoot it? Is it likely that the encoder is faulty?
The problem is that when calibration does work all of the error codes are set to 0. When it doesn’t work it says 0x41, which seems to be a motor error (not sure what that’s about).
Apologies, I agree that’s unclear. I’ve updated the documentation to be a bit more clear about that. I added:
The axis error may say that some other component has failed. Say it reports ERROR_ENCODER_FAILED, then you need to go check the encoder error: hex(<axis>.encoder.error).
Sorry, I guess I should have included more info. I plugged in the motor again and here’s what I get after trying to run calibration:
Connected to ODrive 367233693037 as odrv0
In [1]: odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
In [2]: bin(odrv0.axis0.error)
Out[2]: '0b1000001'
In [3]: bin(odrv0.axis0.encoder.error)
Out[3]: '0b0'
When calibration succeeds both values are 0b0
All that said, I believe it might be a problem with the encoder. I found out about shadow_count property when searching the forum and it doesn’t change when I move the encoder’s shaft.
Your axis error says that the motor failed, can you please provide the motor error code?
Yes shadow_count should increment when you move the shaft, so you may also need to check the encoder wiring or if it’s faulty.
When the system is powered down it’s easy to rotate the shafts, the only noticable friction is created by magnets. Also, I’m not sure if you’ve seen the other video as I was editing my previous post, here’s a bigger velocity setting: https://www.youtube.com/watch?v=G4cmsRnpsh0 - so I don’t think it’s a problem with friction.
One other thought is that the motor is faulty. I’m not sure what error 0x11 means, but since encoder works each time, it might be some kind of a problem with the motor.
After changing the resistance_calib_max_voltage value to 2 it works somewhat better, ie. it works each time I restart the controller. Setting velocity to 2400 also works better, ie. it does 10 or so revolutions before it stops, but it still stops.
After it stops the axis0.error shows 0x31, other errors are empty.
In [1]: odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
In [2]: odrv0.axis0.motor.config.phase_inductance
Out[2]: 8.904561400413513e-05
In [3]: odrv0.axis0.motor.config.phase_resistance
Out[3]: 0.14168408513069153
In [4]: odrv0.axis0.motor.current_control.p_gain
Out[4]: 0.08904561400413513
In [5]: odrv0.axis0.motor.current_control.i_gain
Out[5]: 141.68408203125
Hm looks reasonable to me. Can you try to set the gains to half of their current value and then try closed loop control without running the calibration between? (If you run the calibration again they will be reset to what they are now again).
Setting them to half of their value improved things a bit, but it still stopped. Setting it to 1/4th and then to 1/8th improved things even further. With 1/8th it was running without stopping on 2 revolutions per second, but it still stops at 4 revolutions per second (according to the datasheet the motor is rated for 3000rpm, so it’s still an order of magnitude smaller).
Should I try to decrease it further? I could also try to run the tuning procedure manually as pointed out here: https://docs.odriverobotics.com/commands (update: ah, it seems that it’s for something a bit different)
I’m pretty confident this is the cause of the issue. This value is way too big, and you probably mean to enter 0.47 ohms which is the value included with the 24V ODrives.