Alright, thank you! However, I was sure everything was ready to go but now im getting a watchdog not fed error. I feed the watchdog but its not working. Does anyone know how to fix this?
Code:
#include "WPILib.h"
class RobotDemo : public SimpleRobot
{
Victor *leftFrontMotor;
Victor *leftRearMotor;
Victor *rightFrontMotor;
Victor *rightRearMotor;
RobotDrive *drive; // Drive system for the robot
Joystick *Attack1; // Plugged into USB port 1
Joystick *Attack2; // Plugged into USB port 2
Jaguar *beltMotor; // Slides the cart for the basketballs
Jaguar *angleMotor; // Changes the angle for the basketball shooter
Jaguar *bshooter; // Moves the belt to shoot the basketball (Must be able to go forward and backward)
public:
RobotDemo(void)
{
//Initialize the four Victors to power the Mecanum wheels
leftFrontMotor = new Victor(1);
leftRearMotor = new Victor(2);
rightFrontMotor = new Victor(3);
rightRearMotor = new Victor(4);
//Initialize the drive system
drive = new RobotDrive(leftFrontMotor,leftRearMotor,rightFrontMotor,rightRearMotor);
//Initialize the two joysticks used to control the robot
//Define joysticks being used at USB port #1 and USB port #2 on the Driver's Station
Attack1 = new Joystick(1);
Attack2 = new Joystick(2);
//Initialize Jaguars for the various Robot's functions
beltMotor = new Jaguar(5);
angleMotor = new Jaguar(6);
bshooter = new Jaguar(7);
Watchdog().SetExpiration(0.1);
drive->SetExpiration(0.1);
drive->SetSafetyEnabled(false);
printf("Object Initialization is a success!");
}
void Autonomous(void)
{
while (IsAutonomous() && IsEnabled()) {
Watchdog().SetEnabled(false);
}
}
void OperatorControl(void)
{
//Enable Watchdog which is responsible for handling robot failure
Watchdog().SetEnabled(true);
drive->SetSafetyEnabled(true);
//Enter the loop where robot can be controlled manually
while (IsOperatorControl())
{
Watchdog().Feed();
printf("The Operator Controlled period has begun!");
//Use Attack3 joysticks to drive the robot
drive->MecanumDrive_Cartesian(Attack1->GetX(),Attack1->GetY(),Attack2->GetX());
Wait(0.001);
}
}
};
START_ROBOT_CLASS(RobotDemo);