Skip calibration/Startup procces

Hello community,
I am learning with odrive right now. I use oDrive for 3D printer (X, Y axis), i use Step/Dir mode (Arduino mega 2560 + ramps shield 1.4). It works wery well, but i must do calibration by myself in every start up oDrive. I read about 2 way how to do automation calibration. So i have two problems.

  1. Problem
    If i set „odrv0.axis0.motor.config.pre_calibrated = True“ and after that send „odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION“ motor move little bit, after than make sound „beep“ next do nothing. I try to read error list but all of the error was „0“ (odrv0.axis0.error, odrv0.axis0.motor.error, odrv0.axis0.encoder.error)

  2. Problem
    If i try the „odrv0.axis0.requested_state = AXIS_STATE_STARTUP_SEQUENCE“ . I set „odrv0.axis0.config.startup_motor_calibration = True“ and „odrv0.axis0.config. startup_closed_loop_control = True“. After than switch off and switch on the power supply (odrive). Motor move little bit, after than make sond „beep“ next do nothing.

So i would like to asky you, which way is the best for use my example. Do you know where is a mistake? Do somebody have procedure how to do procces automation calibration?

Thank you very much
The best regards

Hey Hynek,

To clarify, are you able to successfully manually calibrate the motor but when you try to do it automatically it fails? If not, you need to get manual calibration working first. If that’s working, here are the steps to set up automatic calibration at boot:

  1. Do an initial calibration of the motor/encoder
  2. Enable auto calibration in the ODrive’s config
  3. Save these parameters to the ODrive’s NVM

Here are the commands to do that:
odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
odrv0.axis0.motor.config.pre_calibrated = True
odrv0.axis0.config.startup_encoder_offset_calibration = True
odrv0.axis0.config.startup_closed_loop_control = True

Change axis as needed. Setting the motor to precalibrated will use the phase resistance and inductance values from your initial configuration. Setting encoder offset calibration will rotate the motor to find the offset between the motor’s electrical phase and rotor’s position in encoder counts. Setting closed loop control will automatically transition to closed loop control when this sequence is completed.

If you are using an encoder with an index pulse you will need to set those options in the config as well.

Hope this helps!

1 Like

Thank you very much. Your commands works very well. Automatically calibration works without any problem.

Can you send me commands for precalibration??? I would like to try which way is the best.

I use LC5055 motor and amt 102 encoders.

Thank you
The best regards

Glad it helped!

Here are the instructions for setting up encoder calibration. Specifically, look at the section for Encoder with index signal.
Note that you need an encoder with an index pulse or this will not work.

Let me know if that helps

Thank you, i will try it.


Hello kedvall,

currently I am trying to get the index impulse running - I used your setup in order to compare the behaviors with and without index pulse - and I had the same problems with both:

without index:
setting the rotor manually to a “certain position” and starting with power up results in a closed loop where the rotor was moved some counts beside the “certain position” - than when using the “…controller.pos_setpoint = 0” command the rotor moved to the “certain position”

with index signal: the same behavior could be seen - after power on the rotor was placed nearby the index location and with the “…controller.pos_setpoint = 0” command the zero index pulse position was reached exactly
Is this the normal behavior - or are there any other setting ?

many thanks

Hey sorry for the delay. I’m not quite sure what you mean, maybe a video would help?

I can say that with an incremental encoder the ODrive does not know the angle of the shaft when the ODrive boots up. Using an index pulse allows you to know when you’ve reached the point where the encoder completes one full revolution and wraps around. Without it you have to hope you don’t miss any pulses. The index pulse acts as a correction factor, letting the ODrive know the encoder has completed a revolution.
As for behavior on startup, with an incremental encoder you will always have some movement. The index pulse allows you to just move until an index pulse is reached where as you normally need to complete a full revolution.
With an incremental encoder the point you reach after rebooting and completing the encoder offset calibration (no index pulse) or index search (with index pulse) will be what the ODrive uses as the zero position.

What exactly do you want to achieve? Are you trying to reduce movement on startup or get the index pulse working for normal operation?

1 Like

kedvall many thanks for your reply -
I am using the index impulse and I have the problem mentioned in the chat:

Independently of doing start up automatically, like described, or not -
after the CLOSED LOOP STATE is entered the rotor is never placed exactly at the index impulse location ( about 20 counts away from it)
Than you have to do the command “…controller.pos_setpoint = 0” to bring the rotor to the index pulse location
It looks like that the exact position of the index pulse is known by the Odrive but the closed closed loop state does not set the rotor to the zero position…

Concerning my application:
I want to drive two motors with spindle shafts simultaneously.
My main interest is that both motors will do exactly the same rotation all the time - perhaps there are other ways to do this ?

That’s correct, it sets it to the current position of the encoder when switching into CLOSED_LOOP to eliminate startup transients.

Are the two motors turning the same shaft, or separate shafts? Either way, you might be able to use the mirroring mode in RazorsEdge, although you probably don’t have to.