Startup calibration for same motor type

Dear all,

I have a project with 8 motors of the same type, 4 odrives and ABZ encoders. I want to get the motors into closed loop control mode as soon as possible. If possible I wouldn’t want to calibrate the motors on each start up. For this I modified the configuration as follows.

odrv0.axis0.encoder.config.use_index = True

odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

odrv0.axis0.encoder.config.pre_calibrated=True

odrv0.axis0.config.startup_encoder_index_search=True

odrv0.axis0.motor.config.pre_calibrated = True

odrv0.axis0.config.startup_encoder_offset_calibration = False

odrv0.axis0.config.startup_closed_loop_control = True

So far it seems to work okay. I have two questions:

  1. Do I have to calibrate each motor and save the configuration or can I calibrate one and use it for several motors? I tested two and the phase inductance seems very similar. I also tested one motor several times and the values seem to vary a little bit.
  2. In the project it can happen that motors are turned when the controller is offline. Does it even make sense to use the index for the encoder or do I need to recalibrate the encoder everytime anyway? I did some measurements, turned the motor while the controller was offline and recalibrated every time. Shouldn’t the phase offset stay the same all the time?

Here are the values for two motors. I calibrated the second motors three times.

Motor calibration can be shared if you want. Encoder calibration cannot.

That’s fine, that’s why you have an index. No need to recalibrate unless you physically disconnect the encoder from the motor.

1 Like

Thank you Wetmelon for always answering so fast!

This answer helps me, since we will never disconnect the encoders from the motors.

I’m wondering which parameters are stored during the encoder calibration process. In the configuration json file in encoder.config the parameter “pre_calibrated” is set to true and the “index_offset” is set to 0.0. What parameters are also saved? Is the encoder “phase_offset” also saved during calibration? Because this value is different after each calibration. Shouldn’t it stay the same?

I have one more question. Does the statement

odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

include also the following processes or do I need to execute them separately?

odrv0.axis0.requested_state = AXIS_STATE_ENCODER_INDEX_SEARCH
odrv0.axis0.requested_state=AXIS_STATE_ENCODER_OFFSET_CALIBRATION

Thanks!

E:
Ah or is the calibration saved in

odrv0.axis0.encoder.calib_scan_response

It does save phase_offset , which should be the same between runs. Make sure your index pin isn’t noisy (add 22nF capacitance if needed).

FULL_CALIBRATION_SEQUENCE includes those two other states, as long as use_index = True

1 Like

I spent a day measuring everything and found the index by hand.
However Index search always turns to true. No matter the position. If I remove the Z-index from the board, index search makes the motor turn, but obviously it doesn’t find the index.

Do you think that this could be caused by the noise? I also tried everything with a different motor and even a different odrive. Same behaviour.

E:
I found this topic Index pin affected by switching noise in firmware 0.5.2
And out of curiosity I downgraded to Firmware 0.5.1 and if you activate the index search the motor always turns once and then says, that it found the index.

So yes apparently it is a noise problem.

1 Like

We were able to make the z-index more stable, however the encoder.config.phase_offset and encoder.config.phase_offset_float still are different after calibration. Is it possible that the A and B pins are also noisy? Or what kind of deviations are reasonable? For the phase_offset which seems to show an index number? It can vary from -8000 to 19000 for example, which seems really strange.
Then again I’m not quite sure what these numbers represent.

Any ideas how we could improve the results? I am also wondering what these parameters do:
encoder.config.use_index_offset and encoder.config.index_offset

Index offset sets the linear count to a desired value when the index is found. By default, this value is 0.

Don’t worry about the phase offset value if it’s running reliably

Ferrite Rings arrived today and they work great. Now using the normal pins works great! Z-index is found.

2 Likes

But could you elaborate what exactly phase_offset_float is? It works now, but I’m just curious. The index_offset is always the same, however the phase_offset_float still varies for each calibration. The motor runs fine though.