Arduino+odrive skip calibration


I just managed to get my odrive working with arduino, but since i’m planning to use this in restricted mechanical space, is there a way to only have to do calibration once, and then save the calibration somehow so i don’t have to calibrate each power up?
I can’t afford to have my components moving without me telling them too, as it will be used in a car shifter.

EDIT: I followed the instructions on this page:
It did this using odrivetool, expecting that when hooking up the arduino it uses that config.


You need an encoder with an index signal (Z line), and then you should be able to use the instructions on that page. If you MUST know the angle of the encoder at boot-up without it moving whatsoever, you need an absolute encoder. Support for those is in progress.


I used the encoder ordered from the Odrive shop, which has a Z-line, i did find that in the arduino code, i can do the index search, but after that it falls idle and can’t give a position.

This is what my calibration looks like so far, it gives me a beep, goes to the index and stops, then falls trough to idle, but can’t send it to a position at this point. Do i need the closed_loop state?
Last time i did the closed loop, it started spinning at full speed, without stopping.
Here’s the code i have for the current calibration:

        requested_state = ODriveArduino::AXIS_STATE_MOTOR_CALIBRATION;
        Serial << "Axis" << 0 << ": Requesting state " << requested_state << '\n';
        odrive.run_state(atoi(0), requested_state, true);

        requested_state = ODriveArduino::AXIS_STATE_ENCODER_INDEX_SEARCH;
        Serial << "Axis" << 0 << ": Requesting state " << requested_state << '\n';
        odrive.run_state(atoi(0), requested_state, true);


Yes the closed_loop state is basically the active state. It won’t respond to commands outside of that state.

Mount the motor safely and adjust your current limit so that it has little torque and start playing with params.


Mount the motor safely

Yea, this might help with testing, only had a bracket to mount on the encoder so far, i’ll print a new holder to do some safe testing. After that i’ll get back to you with my findings (good or bad)

EDIT: Yes indeed that was what i had to do, just added the closed loop state, and now it works.
i’m guessing the encoder position was so far off that it needed too many rotations, which probably confused me.
Important thing is, it works now!
If anyone is in need of the arduino sketch, i’ll gladly make an example code!