For some reason, our compressor won't start when the code deploys fine, and we have the compressor and pressure gauge switch hooked up correctly ( I think). The compressor should start soon as the robot is turned on correct? The compressor for us doesn't even start even if we enable teleops in the DS. Any help will be appreciated. I may be missing a simple step, so if anybody has an idea, please give suggestions. Here is the code btw:
Code:
#include "WPILib.h"
#include "Vision/AxisCamera2010.h"
#include "Vision/HSLImage.h"
#include "PIDController.h"
#include "Gyro.h"
#include "Target.h"
#include "DashboardDataSender.h"
//#define MINIMUM_SCORE 0.01
/**
* This is a demo program showing the use of the RobotBase class.
* The SimpleRobot class is the base of a robot application that will automatically call your
* Autonomous and OperatorControl methods at the right time as controlled by the switches on
* the driver station or the field controls.
*/
bool moveState = false;
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
Joystick stick; // only joystick
Jaguar leftMotors;
Jaguar rightMotors;
Compressor compressor;
Relay relay;
//DashboardDataSender *dds;
//Gyro *gyro;
//PIDOutput *pidOutput;
public:
RobotDemo(void):
myRobot(3, 4), // these must be initialized in the same order
stick(1), // as they are declared above.
leftMotors(1),
rightMotors(2),
compressor(4,2)
{
//start the compressor
compressor.Start();
AxisCamera &camera = AxisCamera::getInstance();
//dds = new DashboardDataSender();
//gyro = new Gyro(1);
//pidOutput = new SamplePIDOutput(myRobot);
GetWatchdog().SetExpiration(0.1);
}
/**
* Drive left & right motors for 2 seconds then stop
*/
void Autonomous(void)
{
GetWatchdog().SetEnabled(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 arcade steering.
*/
void OperatorControl(void)
{
GetWatchdog().SetEnabled(true);
while (IsOperatorControl())
{
GetWatchdog().Feed();
//myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
if(stick.GetRawButton(1))
{
moveState = 0;
}
if(stick.GetRawButton(3))
{
moveState = 1;
}
if(moveState == false)
{
//do nothing
}
if(moveState == true)
{
leftMotors.Set(-stick.GetY());
rightMotors.Set(stick.GetZ());
Wait(0.005);
}
// Create and set up a camera instance. first wait for the camera to start
// if the robot was just powered on. This gives the camera time to boot.
//Wait(10.0);
//printf("Getting camera instance\n");
}
}
};
START_ROBOT_CLASS(RobotDemo);
as you can see, its quite simple, however I don't know what is going on. Thanks again,
ken