Files
allwpilib/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Robot.cpp

52 lines
1.2 KiB
C++
Raw Normal View History

//============================================================================
// 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);