mirror of
https://github.com/Team4388/2018-Robot.git
synced 2026-06-09 00:38:04 -06:00
Set neutral mode to coast for teleop
also added explanatory comments around the teleop gyro lock mode code
This commit is contained in:
@@ -289,6 +289,7 @@ public class Robot extends IterativeRobot
|
|||||||
if (RLautonomousCommand != null) RLautonomousCommand.cancel();
|
if (RLautonomousCommand != null) RLautonomousCommand.cancel();
|
||||||
if (LRautonomousCommand != null) LRautonomousCommand.cancel();
|
if (LRautonomousCommand != null) LRautonomousCommand.cancel();
|
||||||
if (LLautonomousCommand != null) LLautonomousCommand.cancel();
|
if (LLautonomousCommand != null) LLautonomousCommand.cancel();
|
||||||
|
drive.setToBrakeOnNeutral(false); // coast to avoid tipping when driver stops suddenly
|
||||||
//MotionProfileCache.getInstance().release();
|
//MotionProfileCache.getInstance().release();
|
||||||
updateChoosers();
|
updateChoosers();
|
||||||
controlLoop.start();
|
controlLoop.start();
|
||||||
|
|||||||
@@ -286,6 +286,20 @@ public class Drive extends Subsystem implements ControlLoopable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setToBrakeOnNeutral(boolean brakeVsCoast) {
|
||||||
|
if (brakeVsCoast) {
|
||||||
|
leftDrive1.setNeutralMode(NeutralMode.Brake);
|
||||||
|
leftDrive2.setNeutralMode(NeutralMode.Brake);
|
||||||
|
rightDrive1.setNeutralMode(NeutralMode.Brake);
|
||||||
|
rightDrive2.setNeutralMode(NeutralMode.Brake);
|
||||||
|
} else {
|
||||||
|
leftDrive1.setNeutralMode(NeutralMode.Coast);
|
||||||
|
leftDrive2.setNeutralMode(NeutralMode.Coast);
|
||||||
|
rightDrive1.setNeutralMode(NeutralMode.Coast);
|
||||||
|
rightDrive2.setNeutralMode(NeutralMode.Coast);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initDefaultCommand() {
|
public void initDefaultCommand() {
|
||||||
}
|
}
|
||||||
@@ -623,20 +637,13 @@ public class Drive extends Subsystem implements ControlLoopable
|
|||||||
m_moveOutput = climbSpeed;
|
m_moveOutput = climbSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (useGyroLock) { // If currently in gyro lock mode,
|
||||||
if (m_steerInput == 0.0 && m_moveInput != 0.0 && !useGyroLock) { // If just stopped turning, turn on gyro lock
|
if ((m_moveInput == 0.0) || (m_steerInput != 0.0)) { // but stopped driving or started turning,
|
||||||
setGyroLock(true, false);
|
setGyroLock(false, false); // turn off gyro lock mode
|
||||||
} else if (m_steerInput != 0.0 && useGyroLock){ // If just started turning, turn off gyro lock
|
|
||||||
setGyroLock(false, false);
|
|
||||||
} */
|
|
||||||
|
|
||||||
if (useGyroLock) {
|
|
||||||
if ((m_moveInput == 0.0) || (m_steerInput != 0.0)) {
|
|
||||||
setGyroLock(false, false);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else { // If not yet in gyro lock mode,
|
||||||
if ((m_moveInput != 0.0) && (m_steerInput == 0.0)) {
|
if ((m_moveInput != 0.0) && (m_steerInput == 0.0)) { // but just started driving without turning,
|
||||||
setGyroLock(true, false);
|
setGyroLock(true, false); // gyro lock to current heading
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user