mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Initial checkin of unified hierarchy of WPILib 2015
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
//============================================================================
|
||||
// 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);
|
||||
|
||||
Reference in New Issue
Block a user