2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2018-01-02 09:20:21 -08:00
|
|
|
/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
2016-01-02 03:02:34 -08:00
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2016-01-02 03:02:34 -08:00
|
|
|
|
2014-05-02 17:54:01 -04:00
|
|
|
#pragma once
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2018-04-29 23:33:19 -07:00
|
|
|
#include <wpi/deprecated.h>
|
2017-12-12 01:06:01 -05:00
|
|
|
|
2018-07-20 00:03:45 -07:00
|
|
|
#include "frc/RobotBase.h"
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2016-11-01 22:33:12 -07:00
|
|
|
namespace frc {
|
|
|
|
|
|
2018-12-24 13:46:12 -08:00
|
|
|
class SampleRobot : public RobotBase {
|
2015-06-25 15:07:55 -04:00
|
|
|
public:
|
2018-05-31 20:47:15 -07:00
|
|
|
/**
|
|
|
|
|
* Start a competition.
|
|
|
|
|
*
|
|
|
|
|
* This code needs to track the order of the field starting to ensure that
|
|
|
|
|
* everything happens in the right order. Repeatedly run the correct method,
|
|
|
|
|
* either Autonomous or OperatorControl or Test when the robot is enabled.
|
|
|
|
|
* After running the correct method, wait for some state to change, either the
|
|
|
|
|
* other mode starts or the robot is disabled. Then go back and wait for the
|
|
|
|
|
* robot to be enabled again.
|
|
|
|
|
*/
|
2017-07-01 01:12:28 -04:00
|
|
|
void StartCompetition() override;
|
|
|
|
|
|
2018-05-31 20:47:15 -07:00
|
|
|
/**
|
|
|
|
|
* Robot-wide initialization code should go here.
|
|
|
|
|
*
|
|
|
|
|
* Users should override this method for default Robot-wide initialization
|
|
|
|
|
* which will be called when the robot is first powered on. It will be called
|
|
|
|
|
* exactly one time.
|
|
|
|
|
*
|
|
|
|
|
* Warning: the Driver Station "Robot Code" light and FMS "Robot Ready"
|
|
|
|
|
* indicators will be off until RobotInit() exits. Code in RobotInit() that
|
|
|
|
|
* waits for enable will cause the robot to never indicate that the code is
|
|
|
|
|
* ready, causing the robot to be bypassed in a match.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
virtual void RobotInit();
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Disabled should go here.
|
|
|
|
|
*
|
|
|
|
|
* Programmers should override this method to run code that should run while
|
|
|
|
|
* the field is disabled.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
virtual void Disabled();
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Autonomous should go here.
|
|
|
|
|
*
|
|
|
|
|
* Programmers should override this method to run code that should run while
|
|
|
|
|
* the field is in the autonomous period. This will be called once each time
|
|
|
|
|
* the robot enters the autonomous state.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
virtual void Autonomous();
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Operator control (tele-operated) code should go here.
|
|
|
|
|
*
|
|
|
|
|
* Programmers should override this method to run code that should run while
|
|
|
|
|
* the field is in the Operator Control (tele-operated) period. This is called
|
|
|
|
|
* once each time the robot enters the teleop state.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
virtual void OperatorControl();
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test program should go here.
|
|
|
|
|
*
|
|
|
|
|
* Programmers should override this method to run code that executes while the
|
|
|
|
|
* robot is in test mode. This will be called once whenever the robot enters
|
|
|
|
|
* test mode
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
virtual void Test();
|
2018-05-31 20:47:15 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Robot main program for free-form programs.
|
|
|
|
|
*
|
|
|
|
|
* This should be overridden by user subclasses if the intent is to not use
|
|
|
|
|
* the Autonomous() and OperatorControl() methods. In that case, the program
|
|
|
|
|
* is responsible for sensing when to run the autonomous and operator control
|
|
|
|
|
* functions in their program.
|
|
|
|
|
*
|
|
|
|
|
* This method will be called immediately after the constructor is called. If
|
|
|
|
|
* it has not been overridden by a user subclass (i.e. the default version
|
|
|
|
|
* runs), then the Autonomous() and OperatorControl() methods will be called.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
virtual void RobotMain();
|
2017-07-01 01:12:28 -04:00
|
|
|
|
|
|
|
|
protected:
|
2018-12-24 13:46:12 -08:00
|
|
|
WPI_DEPRECATED(
|
|
|
|
|
"WARNING: While it may look like a good choice to use for your code if "
|
|
|
|
|
"you're inexperienced, don't. Unless you know what you are doing, "
|
|
|
|
|
"complex code will be much more difficult under this system. Use "
|
|
|
|
|
"TimedRobot or Command-Based instead.")
|
2017-07-01 01:12:28 -04:00
|
|
|
SampleRobot();
|
|
|
|
|
virtual ~SampleRobot() = default;
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2018-09-24 00:08:25 -07:00
|
|
|
SampleRobot(SampleRobot&&) = default;
|
|
|
|
|
SampleRobot& operator=(SampleRobot&&) = default;
|
|
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
private:
|
2017-07-08 10:50:56 -04:00
|
|
|
bool m_robotMainOverridden = true;
|
2013-12-15 18:30:16 -05:00
|
|
|
};
|
2016-11-01 22:33:12 -07:00
|
|
|
|
|
|
|
|
} // namespace frc
|