mirror of
https://github.com/Team4388/2019-Hit-or-Miss.git
synced 2026-06-09 00:28:05 -06:00
Introduce Failsafe for if the robot position goes belows negative
(Sets the negative position to the new 0)
This commit is contained in:
@@ -171,7 +171,10 @@ public class Arm extends Subsystem implements ControlLoopable
|
||||
}
|
||||
|
||||
public void updatePositionPID(double targetPositionInches) {
|
||||
targetPositionInchesPID = limitPosition(targetPositionInches);
|
||||
targetPositionInchesPID = limitPosition(targetPositionInches);
|
||||
if (limitPosition(motor1.getPositionWorld()) == MIN_POSITION_INCHES){
|
||||
resetencoder();
|
||||
}
|
||||
double startPositionInches = motor1.getPositionWorld();
|
||||
//mpController.setTarget(targetPositionInchesPID, targetPositionInchesPID > startPositionInches ? KF_UP : KF_DOWN);
|
||||
motor1.set(ControlMode.Position, targetPositionInches);
|
||||
@@ -309,8 +312,6 @@ public class Arm extends Subsystem implements ControlLoopable
|
||||
double deltaPosition = joystickPosition * joystickInchesPerMs;
|
||||
targetPositionInchesPID = targetPositionInchesPID + deltaPosition;
|
||||
updatePositionPID(targetPositionInchesPID);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void ControlWithJoystickhold(){
|
||||
|
||||
Reference in New Issue
Block a user