mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
67 lines
1.2 KiB
C++
67 lines
1.2 KiB
C++
#include "WPILib.h"
|
|
#include "Commands/Command.h"
|
|
#include "Commands/ExampleCommand.h"
|
|
#include "CommandBase.h"
|
|
|
|
class Robot: public IterativeRobot
|
|
{
|
|
private:
|
|
Command *autonomousCommand;
|
|
LiveWindow *lw;
|
|
|
|
void RobotInit()
|
|
{
|
|
CommandBase::init();
|
|
autonomousCommand = new ExampleCommand();
|
|
lw = LiveWindow::GetInstance();
|
|
}
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
void DisabledInit()
|
|
{
|
|
}
|
|
|
|
void DisabledPeriodic()
|
|
{
|
|
Scheduler::GetInstance()->Run();
|
|
}
|
|
|
|
void AutonomousInit()
|
|
{
|
|
if (autonomousCommand != NULL)
|
|
autonomousCommand->Start();
|
|
}
|
|
|
|
void AutonomousPeriodic()
|
|
{
|
|
Scheduler::GetInstance()->Run();
|
|
}
|
|
|
|
void TeleopInit()
|
|
{
|
|
// This makes sure that the autonomous stops running when
|
|
// teleop starts running. If you want the autonomous to
|
|
// continue until interrupted by another command, remove
|
|
// this line or comment it out.
|
|
if (autonomousCommand != NULL)
|
|
autonomousCommand->Cancel();
|
|
}
|
|
|
|
void TeleopPeriodic()
|
|
{
|
|
Scheduler::GetInstance()->Run();
|
|
}
|
|
|
|
void TestPeriodic()
|
|
{
|
|
lw->Run();
|
|
}
|
|
};
|
|
|
|
START_ROBOT_CLASS(Robot);
|
|
|