mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
//============================================================================
|
|
// Name : Robot.cpp
|
|
// Author :
|
|
// Version :
|
|
// Copyright :
|
|
// Description : Hello World in C++, Ansi-style
|
|
//============================================================================
|
|
|
|
#include "WPILib.h"
|
|
#include "Commands/Command.h"
|
|
#include "Commands/ExampleCommand.h"
|
|
#include "CommandBase.h"
|
|
|
|
class Robot : public IterativeRobot {
|
|
private:
|
|
Command *autonomousCommand;
|
|
LiveWindow *lw;
|
|
|
|
virtual void RobotInit() {
|
|
CommandBase::init();
|
|
autonomousCommand = new ExampleCommand();
|
|
lw = LiveWindow::GetInstance();
|
|
}
|
|
|
|
virtual void AutonomousInit() {
|
|
autonomousCommand->Start();
|
|
}
|
|
|
|
virtual void AutonomousPeriodic() {
|
|
Scheduler::GetInstance()->Run();
|
|
}
|
|
|
|
virtual 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.
|
|
autonomousCommand->Cancel();
|
|
}
|
|
|
|
virtual void TeleopPeriodic() {
|
|
Scheduler::GetInstance()->Run();
|
|
}
|
|
|
|
virtual void TestPeriodic() {
|
|
lw->Run();
|
|
}
|
|
};
|
|
|
|
START_ROBOT_CLASS(Robot);
|
|
|