FRC Paradigm Shift #1259
Documentation for the 2021 Robot
Robot Class Reference
Inheritance diagram for Robot:

Public Member Functions

void RobotInit () override
 
void RobotPeriodic () override
 
void DisabledInit () override
 
void DisabledPeriodic () override
 
void AutonomousInit () override
 
void AutonomousPeriodic () override
 
void TeleopInit () override
 
void TeleopPeriodic () override
 
void TestPeriodic () override
 

Private Attributes

frc2::Command * m_autonomousCommand = nullptr
 
RobotContainer m_container
 

Detailed Description

Definition at line 12 of file Robot.h.

Member Function Documentation

void Robot::RobotInit ( )
override

Definition at line 10 of file Robot.cpp.

10 {}
void Robot::RobotPeriodic ( )
override

This function is called every robot packet, no matter the mode. Use this for items like diagnostics that you want to run during disabled, autonomous, teleoperated and test.

This runs after the mode specific periodic functions, but before LiveWindow and SmartDashboard integrated updating.

Definition at line 20 of file Robot.cpp.

20  {
21  frc2::CommandScheduler::GetInstance().Run();
22 }
void Robot::DisabledInit ( )
override

This function is called once each time the robot enters Disabled mode. You can use it to reset any subsystem information you want to clear when the robot is disabled.

Definition at line 29 of file Robot.cpp.

29 {}
void Robot::DisabledPeriodic ( )
override

Definition at line 31 of file Robot.cpp.

31 {}
void Robot::AutonomousInit ( )
override

This autonomous runs the autonomous command selected by your RobotContainer class.

Definition at line 37 of file Robot.cpp.

References RobotContainer::GetAutonomousCommand(), m_autonomousCommand, RobotContainer::m_chooser, and m_container.

37  {
39 
40  if (m_autonomousCommand != nullptr) {
41  m_autonomousCommand->Schedule();
42  }
43 }
frc2::Command * m_autonomousCommand
Definition: Robot.h:27
RobotContainer m_container
Definition: Robot.h:29
frc2::Command * GetAutonomousCommand(AutoPath path)
frc::SendableChooser< AutoPath > m_chooser
void Robot::AutonomousPeriodic ( )
override

Definition at line 45 of file Robot.cpp.

45 {}
void Robot::TeleopInit ( )
override

Definition at line 47 of file Robot.cpp.

References m_autonomousCommand, m_container, and RobotContainer::ZeroDrive().

47  {
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 }
frc2::Command * m_autonomousCommand
Definition: Robot.h:27
RobotContainer m_container
Definition: Robot.h:29
void Robot::TeleopPeriodic ( )
override

This function is called periodically during operator control.

Definition at line 63 of file Robot.cpp.

63 {}
void Robot::TestPeriodic ( )
override

This function is called periodically during test mode.

Definition at line 68 of file Robot.cpp.

68 {}

Member Data Documentation

frc2::Command* Robot::m_autonomousCommand = nullptr
private

Definition at line 27 of file Robot.h.

RobotContainer Robot::m_container
private

Definition at line 29 of file Robot.h.


The documentation for this class was generated from the following files: