Hey, I’m using L16-R linear servo in my robot and I noticed it doesn’t stop when disabled.
I noticed that the motor goes to the last position (the last PWM signal).
The L-16-R library that I created extends from the Servo that extends from the PWM and when I tried using the disabling function inside the PWM class it didn’t seem to work (I activated it with a button and disabelInit()).
What I did manage to do is to set the position always to the current position ±1 until we got to the setpoint, this way if we disable the robot it will stop, because the last setpoint was his current position.
The problem with this solution is that it seems to slow down the L-16 motor.
so my questions are:
1. Do you have another way to disable the L-16 R servo?
2. Is it ok that the motor will move after being disabled?
my code:
This is the code without my solution
my solutions that slows the motor:
public void setSpeedForPosition(double setpoint) {
super.setSpeed(convertSetpointToPWM(
setpoint == currentPos ? getPosition() : setpoint > currentPos ? getPosition() - 1 :
getPosition() + 1));
}
@Override
public void setSpeed(double speed) {
setSpeedForPosition(speed == 0 ? getPosition() : speed < 0 ? getPosition() - 1 : getPosition() +
1);
}