[examples] Zero motors on disabledInit() in sim physics examples (#2906)

This ensures that mechanisms will stop moving if the robot is disabled while motors are in motion
This commit is contained in:
Prateek Machiraju
2020-12-04 20:34:16 -05:00
committed by GitHub
parent 2a5ca77454
commit b3deda38c9
5 changed files with 12 additions and 0 deletions

View File

@@ -55,5 +55,6 @@ public class Robot extends TimedRobot {
@Override
public void disabledInit() {
CommandScheduler.getInstance().cancelAll();
m_robotContainer.zeroAllOutputs();
}
}

View File

@@ -77,6 +77,13 @@ public class RobotContainer {
return m_robotDrive;
}
/**
* Zeros the outputs of all subsystems.
*/
public void zeroAllOutputs() {
m_robotDrive.tankDriveVolts(0, 0);
}
/**
* Use this to pass the autonomous command to the main {@link Robot} class.
*