Ok. To summarize.
I just run the code above to calibrate the motors and encoders. But it seems not working well.
I don’t have oscilloscope.
Here is my wiring structure:
Ok. To summarize.
I just run the code above to calibrate the motors and encoders. But it seems not working well.
I don’t have oscilloscope.
Here is my wiring structure:
can you make a better connection with your motor leads?
show us a picture of the encoder mounted on the back of the motor so we can check the wiring.
did you try to erase config and redo everything clean, following the getting started guide and nothing else?
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
Btw, the resistor connection is ok?
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:
odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
followed by an error dump
I did everything from the beginning and I’ve just changed odrv0.axis0.motor.config.pole_pairs=6
because the 5065 has 12 magnet poles
just rotate to the left… and this is the error:
axis0
axis: Error(s):
ERROR_ENCODER_FAILED
motor: no error
encoder: Error(s):
ERROR_CPR_OUT_OF_RANGE
controller: no error
Wait… I’ve changed odrv0.axis0.motor.config.pole_pairs
to 7 and now rotate both sides
it’s a 14 magnet rotor, so 7 pole pairs, not 6.
you had 7 yesterday in your first post.
You should be good then, no error after the encoder did the full calibration cycle?
Indeed no errors… and position control is working well. Thanks a lot. I will examine what was wrong
Awesome. You may want to go through the guide for encoders with indexes, there are steps to do before putting the precalibrated parameter to true.
Cheers
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
Can you show your code?
Have you verified this particular calibration routine (offset) works with odrivetool? On both motors
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?
I can’t see dump errors from Arduino.
When the motor runs and I try to stop the motor,it doesn’t mean that the motor has to increase it’s torque?
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()
axis0
axis: Error(s):
ERROR_CONTROLLER_FAILED
motor: Error(s):
ERROR_CONTROL_DEADLINE_MISSED
encoder: no error
controller: Error(s):
ERROR_OVERSPEED
But when running with Arduino the motor doesn’t fight and died and I can’t reboot from Arduino, this command odrive.write("sb",'\n');
doesn’t work.
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?
ok. To summarize…
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.
so the error gets triggered as soon as you start holding the motors? and it does without applying much resistance?
can you use the liveplotter on the current and see at what point it does trigger the error
May I ask you why when I run odrive.SetPosition(0, pos_m0, 200, 20)
the motor stack?
running this command Serial1 << "r axis" << 0 << ".motor.current_control.Iq_measured" << "\n"; Serial << "current_control: " << odrive.readFloat() << "\n";
I have this answer:
current_control: -17.8825
current_control: -17.8825
current_control: -17.8825
current_control: -17.8825
current_control: -17.8825
Done