In [162]: odrv0.axis0.controller.config.control_mode = 0
In [163]: odrv0.axis0.encoder.config.cpr=8192
In [164]: odrv0.axis0.motor.config.current_lim =20
In [166]: odrv0.axis0.motor.config.calibration_current=20
In [167]: odrv0.axis0.motor.config.pole_pairs=7
In [168]: odrv0.config.brake_resistance=0.5
In [169]: odrv0.axis0.motor.config.motor_type=MOTOR_TYPE_HIGH_CURRENT
In [170]: dump_errors(odrv0, True)
In [171]: odrv0.save_configuration
In [172]: odrv0.reboot()
In [172]: odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
The motor just rotate cw. And dump_errors(odrv0) returns:
axis0
axis: Error(s):
ERROR_ENCODER_FAILED
motor: no error
encoder: Error(s):
ERROR_NO_RESPONSE
controller: no error
Did you check your wiring? Can you share pictures of your setup?
Do you have an oscilloscope?
you can also use the live-plotter of the position estimate. Not sure if you tried that
I’ll connect the motor directly to the Odrive and I’ll erase the configuration and try again… Btw I followed the getting started guide and nothing happened… As you see my encoders has Z index… So in the getting started guide they don’t configure the z axis to True
the Z index can be there and wired, but you don’t need to enable it in ODrivetool. You’re just adding one more element into the equation. Get the encoder to calibrate without the Z index configured, and then you can re-enable it and go from there.
Same goes with the resistor, although I don’t think it could cause these errors. It doesn’t hurt to take it off and put the brake resistor value to 0 (to disable it).
your wiring is correct, I mean aside from the taped motor wires I don’t see anything obviously wrong.
Yes, erase config, reboot. power cycle if needed. Then get into Odrivetool and check that all parameters went back to default. Once that’s done go with the most basic config: Pole pairs and Motor type (default should be good for both). Current, 10 limit, 5 cal limit (those numbers are what I remember from when I got started with a 5065). Brake resistance to 0 if you removed it. save config, and finish with:
Thank you for your help. May I ask you something?
I run code in Arduino and is working well but every time when I calibrate the motors by odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
First motor 0 calibrate without problems but when the motor 1 starts to calibrate, motor 0 starts moving a few steps forward and back. Do you know why? It only happens whit Arduino and not with Odrive Tool
Hello Zytra. Now it is working well but I have one more question.
When the motor is running for instance odrive.SetPosition(0, pos_m0);
if I try to stop the motor with my hand definitely the motor stops but I have to reset the power supply to run again the motor.
I need to read by Arduino that the velocity or torque is increasing because my hand and from the Arduino program I have to stop the motor.
What do you recommend?
After you “stop” the motor by hand and before you reset power can you dump the errors?
By applying an external torque, the current may be reaching the limit you’ve set?
Yes the torque increases as you apply external forces. But the current is also increasing. So perhaps your current limit is too low for what you’re doing.
You should be able to read errors in ascii, not sure if the arduino lib has some prebuilt error reading functions though.
I did the same experiment using odrivetool and when I try to stop the motor indeed the motor increases its force but after a few seconds died and I have to reboot odrv0.reboot()
that overspeed error is weird, especially if the motor was not spinning while you are holding it.
the control deadline missed is not something I have ever seen personally.
what control mode are you using? position control?
I am using position control to move the motors.
The motors runs well. I want to implement a function to detect collison of the motor. So, if the motor hit a surface it’s mean the current will increase and this increment I need to measure to stop the motor from arduino. The problem is when running the motor with arduino I try to stop the motor with my hand and the motor stop without fight and died, I can’t reboot the odrive because there is not command to that from arduino. I’d like to know why the motor died without fight even if the current is 50A.