I am programming an arduino to move forward with a joystick.
(The wheelchair is moved by sitting on a chair and operating the joystick.)
However, if I return the joystick to 0 while moving forward, I get a shock and almost fall off the chair. (switching from CLOSED LOOP to AXIS_STATE_IDLE)
(In the case of a car, I want to move the gear to neutral just before stopping)
How can I make a smooth transition from driving to neutral?
Hi there,
So there’s a large jolt when setting the ODrive to idle? Or do you mean that when you return the joystick to zero while it’s still in closed loop mode, there’s a sudden deceleration as the speed returns to zero?
Hi.
There is some jolt when switching from closed loop to idle. Any good ideas?
Hmm. That’s strange - which ODrive is this on? Going to IDLE should immediately de-energize the motors (and let you coast). Could you post the Arduino code?
You should use VEL_RAMP mode, and once the velocity is approximately 0 you can put it in idle. Keep in mind, you’ll need to apply a parking brake or similar to avoid the integrator windup from releasing (or try setting vel_integrator_gain = 0)
Thank you for your valuable advice.
Here is the arduino sketch.
There is a little shock at idle, but it’s not noticeable.
I’m looking for a way to get into neutral smoothly.
///////////////////////////////////////IDLE
if ((Y_POS >= -9)&(Y_POS <= 9)&(X_POS >= -9)&(X_POS <= 9))
{
odrive.setState(AXIS_STATE_IDLE);
odrive2.setState(AXIS_STATE_IDLE);
delay(10);
Serial.print("Hi-IDLE ");
done=false;
}
///////////////////////////////////////FOWORD
if ((X_POS < -9)&(-15 <= Y_POS) & (Y_POS <= 15)&(Distance <= 12))
{ if(!done){
odrive.setState(AXIS_STATE_CLOSED_LOOP_CONTROL);
odrive2.setState(AXIS_STATE_CLOSED_LOOP_CONTROL);
delay(10);
done=true;
}
Serial.print("FOWORD ");
odrive.setVelocity(-X_POS);
odrive2.setVelocity(X_POS);
}