Crash means that the status light stops blinking, connections are lost, the camera stops updating, we are unable to deploy a new program even through a different laptop until we restart it by cutting the power.
Here is our code:
Code:
#include "WPILib.h"
AxisCamera &robotCam=AxisCamera::GetInstance();
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
Joystick stickL; // left joystick
Joystick stickR; // right joystick
public:
RobotDemo(void):
myRobot(1, 2, 3, 4), // these must be initialized in the same order
stickL(1), // as they are declared above.
stickR(2)
{
myRobot.SetExpiration(0.5);
}
/**
* Drive left & right motors for 2 seconds then stop
*/
void Autonomous(void)
{
myRobot.SetSafetyEnabled(false);
myRobot.Drive(0.5, 0.0); // drive forwards half speed
Wait(2.0); // for 2 seconds
myRobot.Drive(0.0, 0.0); // stop robot
}
/**
* Runs the motors with tank steering.
*/
void OperatorControl(void)
{
myRobot.SetSafetyEnabled(false);
while (IsOperatorControl())
{
myRobot.TankDrive(stickR.GetAxis(Joystick::kYAxis), stickL.GetAxis(Joystick::kYAxis));
Wait(0.005); // wait for a motor update time
}
}
};
START_ROBOT_CLASS(RobotDemo);