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:
//#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
myRobot(3, 4), // these must be initialized in the same order
stick(1), // as they are declared above.
//start the compressor
AxisCamera &camera = AxisCamera::getInstance();
//dds = new DashboardDataSender();
//gyro = new Gyro(1);
//pidOutput = new SamplePIDOutput(myRobot);
* Drive left & right motors for 2 seconds then stop
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.
//myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
moveState = 0;
moveState = 1;
if(moveState == false)
if(moveState == true)
// 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.
//printf("Getting camera instance
as you can see, its quite simple, however I don’t know what is going on. Thanks again,
As far as I know, the WPILib kills any and all attempts to supply power to anything when the Watchdog hasn’t been fed, or the robot is disabled. Try setting the compressor to start when Teleop is enabled.
Are you sure it’s not a wiring problem? Is the Spike powered by +12V and connected to the correct Relay output? Is there a breaker in the distribution board? Is the sidecar powered? Does the compressor turn on if it’s connected direct to +12V? The code seems fine to me.
The pressure switch shouldn’t be a problem, because the compressor will turn on even if that’s disconnected.
I’m quite sure everything is wired correctly. The solenoids etc are currently not wired, but the compressor is attached to the spike relay. the spike has power and the pwm is in relay 1. The pressure guage is plugged into digital 1. If it helps I tried using the GetPressureSwitchValue() function, and I only get the readings of 0 or 1, unless that is normal. We tried running the compressor directly from the battery to see if the readings will change, but no change.
The compressor spike should be on relay output #2, or change the code to use Relay #1. The pressure switch should be on digital port #4, but you can leave the port unconnected until you get the compressor to turn on.
oh woops sorry about that, I tried both (1,1 and 4,2 because it came from an example), but neither worked. So the pressure switch isn’t required to get the compressor running? like I can just set it, but leave the pwm out and it’ll work as long as the compressor is hooked up? Or did you mean go ahead and try to get the relay working eg using the Relay class.
I know you can run the compressor using the relay class, but I also know that using the compressor class simplifies things a lot, so I want to avoid that.
The software turns the compressor on even if the pressure switch is not wired. It’s one less thing to go wrong when you are first testing, but you must use the pressure switch after things are working. Leave the selected digital port unconnected for now, just to be sure it’s not preventing the compressor from turning on. As you suggested, I would try using the Relay class next. Something like this, untested:
m_relay_1 = new Relay(1);
ok, I just tried it and the compressor did not run. Is it suppose to run when I turn on the robot or when I enable teleops? It did not work either way anyways. I’m assuming there is a problem with the wiring then?
bump. I still can’t get the compressor running :3. Should the relay port on the sidecar’s LED (the 2 things on the side), should one of them be on when the compressor is in operation? I remember it being on berfore, but is not on right now.
I didn’t check our pressure switch, but it’s odd that everything works. The compressor turns on and off as expected, confirmed by the pressure gauge, and the compressor runs when the switch is not wired. That’s why I thought the switch must be normally open, but reading the spec, it is normally closed. We’re declaring the standard Compressor object and using m_compressor->Start(). Maybe the floating cRIO digital input is picking up noise and sensing it as a logic low, turning on the compressor?
I know I should start a new post for this, but since It’s the same topic, I’d rather get help from the experienced few on this topic.
We have sort of the opposite issue, my compressor starts by the use of compressor->Start(); but does not automatically turn on. I’ve used a multimeter to test if the switch’s state changes after reaching 115psi, and it does… but the compressor never starts.
Originally, I declared the compressor on digital one and relay one:
compressor = new Compressor(1,1);
and when that failed, I tried changing the digital switch to DIO 5 (5,1) in the code and sidecar, and still nothing!. The relay I know for sure works properly, I’ve tested it, but I don’t know what else it could be! Also, I’m pretty sure the switch is wired correctly… black and white pwm wires on the switch. Any Idea what could the problem be?