Apologies in advance if these are FAQ, but my searching has turned up nothing on the subject…
First - are the motor and encoder calibration data unique to one particular ODrive(Axis) or could a calibrated motor be moved to another ODrive (assuming the calibration data could be moved as well)?
Second - Is there a way to export the current calibration data for an axis, then reload it at a later time? I’m assuming this would be through odrivetool if it exists at all.
My use-case is as follows… I would like to calibrate a motor and encoder once they are assembled, but prior to them being mated with a gear box. Then I would like to export and save this calibration data and be able to re-apply it to a different ODrive at a later time (after the motor assembly is mated to the gearbox). I know the calibration data can be saved in the ODrive non-volatile memory, but I would like to be able to effectively load a pre-calculated calibration package.
The intent here is to be able to honor the calibrate without load requirement, but not have to disassemble all my actuators if/when recalibration is necessary.
Thanks in advance.
I assume you have either an absolute encoder, or at least an index signal?
Yes - the calibration data is in motor.config and encoder.config. Specifically: motor.config.phase_resistance, motor.config.phase_inductance and encoder.config.offset
You also need to set pre_calibrated=True for both motor.config and encoder.config to allow you to skip the usual calibration process.
There are other settings too that you will have entered manually such as pole_pairs, cpr, current_limit etc, so it is probably easier to transfer them all at once:
As you’ve guessed, odrivetool provides a way to do this.
You can save the whole config to JSON using
odrivetool backup-config my-motors.json.
If you have a “good” text editor, you can “pretty-print” the JSON and collapse, copy and paste whole sections of it
You can, for example, swap the contents of axis1 with axis0.
Once you’re done, you can send the edited config to the odrive with
odrivetool restore-config my-motors-edit.json
(i’d advise that you keep the original in case you make any mistakes editing the file)
Ok - that is much simpler than I was expecting… for some reason I was assuming the calibration data was a table of measured/calculated values.
Just for completeness - yes, I’m currently using an as5147P in ABI mode, but am planning to switch over to the SPI mode to avoid startup motor movements.
Thanks so much for the quick answer!
Only if you’re using the anticogging calibration.