FRC Paradigm Shift #1259
Documentation for the 2021 Robot
Robot.cpp
Go to the documentation of this file.
1 // Copyright (c) FIRST and other WPILib contributors.
2 // Open Source Software; you can modify and/or share it under the terms of
3 // the WPILib BSD license file in the root directory of this project.
4 
5 #include "Robot.h"
6 
7 #include <frc/smartdashboard/SmartDashboard.h>
8 #include <frc2/command/CommandScheduler.h>
9 
11 
21  frc2::CommandScheduler::GetInstance().Run();
22 }
23 
30 
32 
39 
40  if (m_autonomousCommand != nullptr) {
41  m_autonomousCommand->Schedule();
42  }
43 }
44 
46 
48  // This makes sure that the autonomous stops running when
49  // teleop starts running. If you want the autonomous to
50  // continue until interrupted by another command, remove
51  // this line or comment it out.
52  if (m_autonomousCommand != nullptr) {
53  m_autonomousCommand->Cancel();
54  m_autonomousCommand = nullptr;
55  }
56 
58 }
59 
64 
69 
70 #ifndef RUNNING_FRC_TESTS
71 int main() {
72  return frc::StartRobot<Robot>();
73 }
74 #endif
int main()
Definition: Robot.cpp:71
void AutonomousInit() override
Definition: Robot.cpp:37
void TeleopInit() override
Definition: Robot.cpp:47
void TestPeriodic() override
Definition: Robot.cpp:68
frc2::Command * m_autonomousCommand
Definition: Robot.h:27
void DisabledPeriodic() override
Definition: Robot.cpp:31
void DisabledInit() override
Definition: Robot.cpp:29
void AutonomousPeriodic() override
Definition: Robot.cpp:45
RobotContainer m_container
Definition: Robot.h:29
frc2::Command * GetAutonomousCommand(AutoPath path)
frc::SendableChooser< AutoPath > m_chooser
void RobotInit() override
Definition: Robot.cpp:10
void RobotPeriodic() override
Definition: Robot.cpp:20
void TeleopPeriodic() override
Definition: Robot.cpp:63