mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[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:
committed by
GitHub
parent
2a5ca77454
commit
b3deda38c9
@@ -55,5 +55,6 @@ public class Robot extends TimedRobot {
|
||||
@Override
|
||||
public void disabledInit() {
|
||||
CommandScheduler.getInstance().cancelAll();
|
||||
m_robotContainer.zeroAllOutputs();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user