I cant seem to figure out the step/dir interface, i want to use BLDC motor as i would use a stepper motor with those simple step/dir drivers (A4988 / tmc2208).
It seems like the wrap around functionality is giving me a hard time
I want to have 4096 steps per revolution infinitely, from -1,000,000 to +1,000,000 revolutions with no wrap around.
here is my current settings:
controller.config.input_mode = trap_traj
controller.config.control_mode = position_control
config.enable_step_dir = True
controller.config.circular_setpoints = false
pos_vel_mapper.config.circular = false (do i even need it?)
controller.config.circular_setpoint_range = 1
pos_vel_mapper.config.circular_output_range = 0 (do i need it?)
controller.config.steps_per_circular_range = 4096
when sending 4096 pulses from a MCU, it seems that the input_pos goes up to 1 and then back to 0 (when chanding the circular_setpoint_range to 4 it goes up to 4 and then back to 0)
Im using flexystepper library to send the pulses
what am i missing?
Hi!
Could you explain a bit more as to your actual requirements here? Is your concern that the ODrive range of motion will be limited if using a single turn range? Or do you need it explicitly to keep track of the total turn count between +/- 1,000,000?
i just want to be able to turn indefinitely for any direction without the wrap functionality, what happens now is when i go to negative direction it wraps around and jumps to the other side. for example if the circular_setpoint_range is set to 4, then when going to -1 is actually going to 3.
the motor is connected to a lead screw and i cant allow those wrap arounds.
is it possible to be able to spin from -1M to +1M rotations? i dont actually need the odrive to track the position i will track it myself in code.
Ah, gotcha. The intended behavior in circular mode is that the ODrive doesn’t do these jumps in position – e.g. if the circular range is +/- 1 turn, and you’re going from -0.9 to +0.1, then it’ll continue in the negative direction 0.2 turns, instead of going +1.1 turns in the positive direction. So it sounds like there’s just something wrong with the configuration.
I think the main culprit is the controller.config.circular_setpoints = false – this will prevent the controller from handling the wraps.
You should just need to set:
axis0.controller.config.circular_setpoints = True
axis0.controller.config.circular_setpoint_range = 1
axis0.pos_vel_mapper.config.circular_output_range = 1
axis0.controller.config.steps_per_circular_range = 4096
You don’t need to set pos_vel_mapper.config.circular, it’ll be set automatically if you use the above configuration.
As a result, the motor will always continue in the direction you’re commanding (no sudden position jumps), but the axis0.pos_estimate will display a wrapped 0-1 value.