I try to control the motor with torque control.
In odrivetool I type:
odrv0.axis0.controller.config.input_mode = INPUT_MODE_PASSTHROUGH
odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
odrv0.axis0.controller.input_torque = 0.9
... and eventually I stop it after some time
odrv0.axis0.controller.input_torque = 0
The start/stop work smoothly … like a ramp.
But in Arduino I call
int requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL;
Serial << "Axis" << 0 << ": Requesting state " << requested_state << '\n';
if(!odrive.run_state(0, requested_state, false /*don't wait*/)) return;
Serial.println("Executing forward");
odrive.SetCurrent(0, 0.9);
delay(5);
//and eventually I stop it after some time
odrive.SetCurrent(0, 0.0);
But the stop is too abrupt. It is not as smooth as in Odrivetool.
Why is that?