Creating a robot program has been designed to be as simple as possible while still allowing a lot of
flexibility. Here’s an example of a template that represents the simplest robot program you can create.
#include "WPILib.h"
class RobotDemo : public SimpleRobot
{
RobotDemo(void)
{
// put initialization code here
}
void Autonomous(void)
{
// put autonomous code here
}
void OperatorControl(void)
{
// put operator control code here
}
};
START_ROBOT_CLASS(RobotDemo);
There are several templates that can be used as starting points for writing robot programs. This one,
SimpleRobot is probably the easiest to use. Simply add code for initializing sensors and anything else you
need in the constructor, code for your autonomous program in the Autonomous function, and the code for
your operator control part of the program in OperatorControl.
SimpleRobot is actually the name of a C++ class or object that is used as the base of this robot program
called RobotDemo. To use it you create a subclass which is another name for your object that is based on
the SimpleRobot class. By making a subclass, the new class, RobotDemo, inherits all the predefined
behavior and code that is built into SimpleRobot.