So, I’ve got my hands on the Odrive controller. for those who don’t know what an Odrive is, it’s a controller that let you control not only the speed of a hobby brushless motor , but also it’s position. this thing is really great, since we can achieve high precision with cheap motors… let’s take a look on how to set it up.
I have done the setup in windows, but it really is the same on Linux.
once you have installed the Odrive’s python library:
you have to calibrate your motor, and for that you need to know the number of Pole the rotor has. I used a brushless motor for a multirotor, linked to a 3D printed planetary gear of a 9:1 ratio:
here are the commands to run:
As I stated before, my motor’s number of poles is 22 so it should be divided by 2:
odrv0.axis0.motor.config.pole_pairs=11 #Save the configuration so you don't have to set it at every boot odrv0.save_configuration() #run the calibration process: odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE #Enter closed loop state to control the motor odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL #you can control you motor by giving it a vel odrv0.axis0.controller.config.control_mode = CTRL_MODE_VELOCITY_CONTROL odrv0.axis0.controller.vel_setpoint = 40000 odrv0.axis0.controller.vel_setpoint = 0