Something like this?
Code:
#include <WPILib.h>
//Import necessary libraries here
class DefaultRobot : public SimpleRobot{
//allocate all required components
public:
DefaultRobot(void){
//Initialize components
}
void Autonomous(void){
//Run once at the beginning of autonomous
while(IsAutonomous()){
//Code that runs throughout autonomous
}
}
void OperatorControl(void){
//Run once at the beginning of teleop
while (IsOperatorControl()){
//Code that runs throughout teleop
}
}
};
START_ROBOT_CLASS(DefaultRobot);
The most basic thing I would then do with this is the following:
Code:
#include <WPILib.h>
class DefaultRobot : public SimpleRobot{
Joystick *leftStick;
Joystick *rightStick;
RobotDrive *myRobot;
public:
DefaultRobot(void){
leftStick = new Joystick(1); //USB port 1
rightStick = new Joystick(2); //USB port 2
myRobot = new RobotDrive(1,2); //motor controllers plugged into PWM 1 and 2
}
void Autonomous(void){
while(IsAutonomous()){
}
}
void OperatorControl(void){
while (IsOperatorControl()){
float leftStickYAxis = leftStick->GetY();
float rightStickYAxis = rightStick->GetY();
myRobot->TankDrive(-leftStickYAxis, rightStickYAxis); //negate axes depending on the robot's behaviour
}
}
};
START_ROBOT_CLASS(DefaultRobot);
Does this help at all? What type of drivetrain are you programming?