After several days of testing with different mechanical endstop setups and different config setup, I’ve come to the conclusion that there must be something wicked in the code.
This is our config:
odrv0.config.enable_uart = False
odrv0.axis0.config.turns_per_step = 0.001953125
odrv0.axis0.config.step_gpio_pin = 1
odrv0.axis0.config.dir_gpio_pin = 2
odrv0.axis1.config.turns_per_step = 0.001953125
odrv0.axis1.config.step_gpio_pin = 7
odrv0.axis1.config.dir_gpio_pin = 8
odrv0.axis0.config.enable_step_dir = True
odrv0.axis1.config.enable_step_dir = True
odrv0.config.brake_resistance = 2
odrv0.axis0.config.startup_motor_calibration = True
odrv0.axis0.config.startup_encoder_offset_calibration = True
odrv0.axis0.config.startup_closed_loop_control = True
odrv0.axis0.config.startup_homing = False
odrv0.axis0.motor.config.current_lim = 50
odrv0.axis0.motor.config.pole_pairs = 7
odrv0.axis0.motor.config.torque_constant = 0.03445833
odrv0.axis0.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT
odrv0.axis0.motor.config.calibration_current = 40
odrv0.axis0.encoder.config.cpr = 8192
odrv0.axis0.encoder.config.mode = ENCODER_MODE_INCREMENTAL
odrv0.axis0.encoder.config.calib_range = 0.05
odrv0.axis0.encoder.config.bandwidth = 1000
odrv0.axis0.controller.config.vel_limit = 90
odrv0.axis0.controller.config.pos_gain = 35
odrv0.axis0.controller.config.vel_integrator_gain = 1.25
odrv0.axis0.controller.config.vel_gain = 0.20
odrv0.axis0.min_endstop.config.enabled = False
odrv0.axis1.config.startup_motor_calibration = True
odrv0.axis1.config.startup_encoder_offset_calibration = True
odrv0.axis1.config.startup_closed_loop_control = True
odrv0.axis1.config.startup_homing = True
odrv0.axis1.motor.config.current_lim = 50
odrv0.axis1.motor.config.pole_pairs = 7
odrv0.axis1.motor.config.torque_constant = 0.03445833
odrv0.axis1.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT
odrv0.axis1.motor.config.calibration_current = 40
odrv0.axis1.encoder.config.cpr = 8192
odrv0.axis1.encoder.config.mode = ENCODER_MODE_INCREMENTAL
odrv0.axis1.encoder.config.calib_range = 0.05
odrv0.axis1.encoder.config.bandwidth = 1000
odrv0.axis1.controller.config.vel_limit = 90
odrv0.axis1.controller.config.pos_gain = 35
odrv0.axis1.controller.config.vel_integrator_gain = 1.25
odrv0.axis1.controller.config.vel_gain = 0.20
odrv0.axis1.controller.config.homing_speed = -0.25
odrv0.axis1.controller.config.vel_ramp_rate = 0.05
odrv0.axis1.trap_traj.config.vel_limit = 0.3
odrv0.axis1.trap_traj.config.accel_limit = 0.01
odrv0.axis1.trap_traj.config.decel_limit = 0.01
odrv0.axis1.min_endstop.config.gpio_num = 3
odrv0.axis1.min_endstop.config.pullup = True
odrv0.axis1.min_endstop.config.is_active_high = False
odrv0.axis1.min_endstop.config.offset = 0.25
odrv0.axis1.min_endstop.config.debounce_ms = 200
odrv0.axis1.min_endstop.config.enabled = True
odrv0.axis1.max_endstop.config.gpio_num = 6
odrv0.axis1.max_endstop.config.pullup = True
odrv0.axis1.max_endstop.config.is_active_high = True
odrv0.axis1.max_endstop.config.offset = -0.1
odrv0.axis1.max_endstop.config.debounce_ms = 200
odrv0.axis1.max_endstop.config.enabled = False
As you can see, we are driving the axis with negative speed is opposite direction to lift the end effector from the carrier first. We tried first having the endstops integrated in the carrier, so the end effector lays on the endstops. They triggered once the end effector didn’t touch the endstops anymore. This setup worked partly. The axis got homed, but the axis state didn’t go to closed-loop like expected, but into idle state causing the end effector to fall down.
I read somewhere, that if the endstop is pressed after triggering the system will go into idle state, as security measure I assume. This was the case with the first setup, as the endstop stayed high during the homing sequence.
Now, we tried it the other way around, and put the endstop above the end effector causing it to trigger only when high enough to touch it and then driving the axis down to the offset position. The endstop will stay low after trigger, so this shouldn’t cause issues anymore.
But, the issue with the axis state going into idling remains.
There are no errors on axis1 (don’t pay attention to axis0, that’s another issue that has nothing to do with this one)
The axis1 is homed, but it is in idle state.
I have my suspicion that driving the axis with negative speed is messing something in the code. @Wetmelon what’s your opinion?
Edit: We just tested the homing sequence by putting the axis manually in closed-loop and by lifting the end effector up. Then we drove the axis with positive speed (as it is meant to be driven) and triggered the endstop by hand. Again homing works, offset position is reached and then the axis goes into idling.
Second edit:
and suddenly homing works!? A combination of soft reboot, hard reboot, I don’t know… very mysterious. But anyway, it’s now finally working 