2014-08-14 07:46:49 -04:00
|
|
|
#include "WPILib.h"
|
|
|
|
|
|
|
|
|
|
class Robot: public IterativeRobot
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
RobotDrive myRobot; // robot drive system
|
|
|
|
|
Joystick stick; // only joystick
|
2015-07-24 19:19:40 -04:00
|
|
|
LiveWindow &lw;
|
2014-08-14 07:46:49 -04:00
|
|
|
int autoLoopCounter;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Robot() :
|
|
|
|
|
myRobot(0, 1), // these must be initialized in the same order
|
2014-10-01 11:25:51 -04:00
|
|
|
stick(0), // as they are declared above.
|
2015-07-24 19:19:40 -04:00
|
|
|
lw(LiveWindow::GetInstance()),
|
2014-08-14 07:46:49 -04:00
|
|
|
autoLoopCounter(0)
|
|
|
|
|
{
|
|
|
|
|
myRobot.SetExpiration(0.1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void AutonomousInit()
|
|
|
|
|
{
|
|
|
|
|
autoLoopCounter = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AutonomousPeriodic()
|
|
|
|
|
{
|
|
|
|
|
if(autoLoopCounter < 100) //Check if we've completed 100 loops (approximately 2 seconds)
|
|
|
|
|
{
|
|
|
|
|
myRobot.Drive(-0.5, 0.0); // drive forwards half speed
|
|
|
|
|
autoLoopCounter++;
|
|
|
|
|
} else {
|
|
|
|
|
myRobot.Drive(0.0, 0.0); // stop robot
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TeleopInit()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TeleopPeriodic()
|
|
|
|
|
{
|
|
|
|
|
myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TestPeriodic()
|
|
|
|
|
{
|
2015-07-24 19:19:40 -04:00
|
|
|
lw.Run();
|
2014-08-14 07:46:49 -04:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2015-07-24 19:19:40 -04:00
|
|
|
START_ROBOT_CLASS(Robot)
|