Circular SetPoint Range

Ok, I know Im being stupid but can someone explain the Circular Setpoint range.

I need step/dir positional control with ideally 1024 steps per rev and no limit on the number of turns the motor can do.

When I use:

odrv0.axis1.controller.config.circular_setpoint_range = 2048
odrv0.axis1.controller.config.steps_per_circular_range = 1024

When I enter closed loop control the drive just spins for ages (2048 turns?)
If I use a small number for the setpoint range then when it’s completed the number of turns it reverses.

Neither of these are workable…

What should the settings be?

circular_setpoint_range is in turns. What you want is just:

odrv0.axis1.controller.config.circular_setpoint_range = 1
odrv0.axis1.controller.config.steps_per_circular_range = 1024

The trouble is, when it gets to the end of the first turn it reverses back to the zero position, I need it to keep going as it recieves more steps (Position control for a CNC measuring machine, small gimball motors)

No it doesn’t. pos_estimate might, but axis won’t actually move back to 0. If it is doing that, please let me know what input_mode, control_mode, and commands you’re sending it, then drop some data in here (plot / record input_pos, pos_setpoint, shadow_count, and pos_estimate)

They are all the default values:
input_mode = INPUT_MODE_PASSTHROUGH
Control mode = Position control.

I can’t get the plots to change (running on raspi, no anaconda) but the std plot shows the position moving up then dropping back to the zero position and starting again.

It worked quite happily before the firmware update. I added the braking resistor and GPIO modes to the step dir lines to get it working.

This is how I’ve set it up:

odrv0.config.enable_brake_resistor = True
odrv0.axis1.encoder.config.cpr=2000
odrv0.axis1.controller.config.vel_limit=60
odrv0.axis1.motor.config.torque_constant=0.043
odrv0.axis1.motor.config.pole_pairs=2
odrv0.axis1.motor.config.calibration_current=1.5
odrv0.axis1.motor.config.current_lim=2
odrv0.axis1.controller.config.vel_gain=.01
odrv0.axis1.controller.config.pos_gain = 60
odrv0.axis1.controller.config.vel_integrator_gain = 0.15
odrv0.axis1.motor.config.motor_type=MOTOR_TYPE_GIMBAL

odrv0.config.gpio1_mode = GPIO_MODE_DIGITAL
odrv0.config.gpio2_mode = GPIO_MODE_DIGITAL

odrv0.axis1.config.step_gpio_pin = 8
odrv0.axis1.config.dir_gpio_pin = 7
odrv0.axis1.config.enable_step_dir = True

odrv0.axis1.controller.config.circular_setpoints = True
odrv0.axis1.controller.config.circular_setpoint_range = 1
odrv0.axis1.controller.config.steps_per_circular_range = 1024

Yeah, that’s expected as the axis turns. Is the axis itself physically moving back and forth, or just the data?

The axis spins back to the start position…

Can you confirm you’re on 0.5.4?

odrv0.fw_version_minor
odrv0.fw_version_revision

yes:

ODrive control utility v0.5.4

Any ideas on this as I really need to get this project moving along…

No, sorry. Unfortunately you’re the only one who has this particular problem… I really don’t understand why. Maybe it has something to do with your cpr settings vs the steps_per_circular range? It shouldn’t matter though.

How do I reflash the old firmware that worked?

I really need to get this back working again, its stalled the whole project at the moment…

You can download it from github, then use odrivetool dfu path/to/file.hex. See ODrive Tool | ODrive

Have you got a link to the correct file??

This is really starting to piss me off now!!

Pick the one for your board

Ok, I have 2 of these boards so fired up the other one to check the version. For some reason it wouldn’t connect via USB so had to reflash via DFU mode.

Anyway, got it running on V0.5.4 and with the settings below it works as it should so its got to be something with the settings for the previous drive.

odrv0.config.enable_brake_resistor = True
odrv0.axis1.encoder.config.cpr=2000
odrv0.axis1.controller.config.vel_limit=60
odrv0.axis1.motor.config.torque_constant=0.043
odrv0.axis1.motor.config.pole_pairs=4
odrv0.axis1.motor.config.calibration_current=3
odrv0.axis1.motor.config.current_lim=8
odrv0.axis1.config.enable_step_dir=True

odrv0.axis1.controller.config.vel_gain=.03
odrv0.axis1.controller.config.pos_gain = 80
odrv0.axis1.controller.config.vel_integrator_gain = 0.15
odrv0.axis1.controller.config.circular_setpoints = True
odrv0.axis1.controller.config.circular_setpoint_range = 1.0
odrv0.axis1.controller.config.steps_per_circular_range = 10000
odrv0.axis1.motor.config.motor_type=MOTOR_TYPE_GIMBAL

odrv0.config.gpio1_mode = GPIO_MODE_DIGITAL
odrv0.config.gpio2_mode = GPIO_MODE_DIGITAL

odrv0.axis1.config.step_gpio_pin = 1
odrv0.axis1.config.dir_gpio_pin = 2
odrv0.axis1.config.enable_step_dir = True

odrv0.axis1.controller.config.circular_setpoints = True
odrv0.axis1.controller.config.circular_setpoint_range = 1
odrv0.axis1.controller.config.steps_per_circular_range = 1024

I’m now getting MOTOR_ERROR_CURRENT_LIMIT_VIOLATION errors on this drive. It was fine on the previous firmware version.

The other drive still only does one turn then spins back to 0

Any help with this?

It moves, seems to complete the move but wont move again due to the MOTOR_ERROR_CURRENT_LIMIT_VIOLATION error

Ok, I’ve loaded the older firmare onto the drive but now I can’t connec to it. Do I need the older version of the odrivetool as well?