Hello,
I’m trying to use an oDrive to interface with some Sky’s Edge Robowheels.
However, my team and I are running into some problems with getting the configurations to save post reboot.
To explain, here’s the configuration options we’re inputting to get this to work.
We’re using the odrivetool
.
Recreation Steps
Copy & Paste 1
odrv0.config.dc_max_negative_current = -10
odrv0.axis0.motor.config.pole_pairs = 15
odrv0.axis0.motor.config.requested_current_range = 10
odrv0.axis0.encoder.config.cpr = 3200
odrv0.axis0.encoder.config.calib_scan_distance = 15*2*3.14
odrv0.axis0.controller.config.control_mode = CONTROL_MODE_VELOCITY_CONTROL
odrv0.axis0.controller.config.input_mode = INPUT_MODE_VEL_RAMP
odrv0.axis0.controller.config.vel_limit = 20 # Change as desired
odrv0.axis0.controller.config.vel_ramp_rate = 0.5 # Change as desired
odrv0.axis0.motor.config.resistance_calib_max_voltage = 10
odrv0.axis0.motor.config.calibration_current = 4
odrv0.axis0.encoder.config.mode = ENCODER_MODE_INCREMENTAL
odrv0.axis0.encoder.config.bandwidth = 300
odrv0.config.dc_max_negative_current = -10
odrv0.axis1.motor.config.pole_pairs = 15
odrv0.axis1.motor.config.requested_current_range = 10
odrv0.axis1.encoder.config.cpr = 3200
odrv0.axis1.encoder.config.calib_scan_distance = 15*2*3.14
odrv0.axis1.controller.config.control_mode = CONTROL_MODE_VELOCITY_CONTROL
odrv0.axis1.controller.config.input_mode = INPUT_MODE_VEL_RAMP
odrv0.axis1.controller.config.vel_limit = 20 # Change as desired
odrv0.axis1.controller.config.vel_ramp_rate = 0.5 # Change as desired
odrv0.axis1.motor.config.resistance_calib_max_voltage = 10
odrv0.axis1.motor.config.calibration_current = 4
odrv0.axis1.encoder.config.mode = ENCODER_MODE_INCREMENTAL
odrv0.axis0.encoder.config.bandwidth = 300
odrv0.save_configuration()
odrv0.reboot()
Copy & Paste 2
odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
odrv0.axis1.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
Both motors successfully calibrate.
Copy & Paste 3
dump_errors(odrv0)
Yields no errors.
Copy & Paste 4
odrv0.axis0.motor.config.pre_calibrated = True
odrv0.axis0.encoder.config.pre_calibrated = True
odrv0.axis1.motor.config.pre_calibrated = True
odrv0.axis1.encoder.config.pre_calibrated = True
odrv0.save_configuration()
odrv0.reboot()
Copy & Paste 5
odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
odrv0.axis0.controller.input_vel = 2
odrv0.axis1.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
odrv0.axis1.controller.input_vel = 2
The Problem
The odrv0.axis0.motor.current_control
contents do not save. When the save_configuration
and reboot
lines in step 4 are removed, both motors run just fine. However, they naturally do not work after the reboot.
On the other hand, if the lines are not removed, the motor doesn’t work in the first place, and throws an error when an attempt is made to drive it.
Here’s the error that’s being thrown:
Now, looking at the differences in the config, here’s what we found. After the reboot, all settings located in ordv0.axis0.motor.current_control
is cleared to (what I assume it) the default.
Here’s an of this event. On the left is the config pre-save/reboot. On the right is post.
I’ve also attempted to write to these attributes manually, but write access is prohibited.
TL;DR:
Is there any way to preserve the calculated values from the motor calibration, so that they remain the same after reboot?
Additional Information
- Motor we are using: Sky’s Edge Robowheels
- We’re using the encoders instead of the hall effect sensor, which had previously given us massive issues that we were never able to resolve.
Thank you!