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
@@ -31,6 +31,7 @@ void Robot::RobotPeriodic() { frc2::CommandScheduler::GetInstance().Run(); }
|
||||
*/
|
||||
void Robot::DisabledInit() {
|
||||
frc2::CommandScheduler::GetInstance().CancelAll();
|
||||
m_container.ZeroAllOutputs();
|
||||
}
|
||||
|
||||
void Robot::DisabledPeriodic() {}
|
||||
|
||||
@@ -36,6 +36,8 @@ RobotContainer::RobotContainer() {
|
||||
{&m_drive}));
|
||||
}
|
||||
|
||||
void RobotContainer::ZeroAllOutputs() { m_drive.TankDriveVolts(0_V, 0_V); }
|
||||
|
||||
const DriveSubsystem& RobotContainer::GetRobotDrive() const { return m_drive; }
|
||||
|
||||
void RobotContainer::ConfigureButtonBindings() {
|
||||
|
||||
@@ -30,6 +30,7 @@ class RobotContainer {
|
||||
public:
|
||||
RobotContainer();
|
||||
|
||||
void ZeroAllOutputs();
|
||||
frc2::Command* GetAutonomousCommand();
|
||||
const DriveSubsystem& GetRobotDrive() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user