Go to Post keep making a difference out there everyone...slowly but surely everyone will catch onto FIRST and then the world will be a better place :) - tiffany34990 [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-02-2010, 23:28
kennypu kennypu is offline
Registered User
FRC #2467
 
Join Date: Jan 2010
Location: Hawaii
Posts: 40
kennypu is an unknown quantity at this point
Compressor won't start

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
Reply With Quote
  #2   Spotlight this post!  
Unread 16-02-2010, 00:21
buddyb's Avatar
buddyb buddyb is offline
Registered User
FRC #1885 (ILITE)
Team Role: Programmer
 
Join Date: Dec 2009
Rookie Year: 2008
Location: Haymarket, VA
Posts: 65
buddyb has a spectacular aura aboutbuddyb has a spectacular aura aboutbuddyb has a spectacular aura about
Re: Compressor won't start

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.

Good luck.
__________________
FRC - Team 1885 - Programmer.
Reply With Quote
  #3   Spotlight this post!  
Unread 16-02-2010, 19:10
kennypu kennypu is offline
Registered User
FRC #2467
 
Join Date: Jan 2010
Location: Hawaii
Posts: 40
kennypu is an unknown quantity at this point
Re: Compressor won't start

I tried the method above and no success. I have also connected to the netconsole, and there seems to be no errors. I need help guys xP
Reply With Quote
  #4   Spotlight this post!  
Unread 16-02-2010, 19:25
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
Re: Compressor won't start

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.
Reply With Quote
  #5   Spotlight this post!  
Unread 16-02-2010, 21:39
kennypu kennypu is offline
Registered User
FRC #2467
 
Join Date: Jan 2010
Location: Hawaii
Posts: 40
kennypu is an unknown quantity at this point
Re: Compressor won't start

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.
Reply With Quote
  #6   Spotlight this post!  
Unread 16-02-2010, 21:52
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
Re: Compressor won't start

Quote:
Originally Posted by kennypu View Post
I'm quite sure everything is wired correctly....the spike has power and the pwm is in relay 1.
Your code:
Code:
    compressor(4,2)
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.
Reply With Quote
  #7   Spotlight this post!  
Unread 16-02-2010, 21:55
kennypu kennypu is offline
Registered User
FRC #2467
 
Join Date: Jan 2010
Location: Hawaii
Posts: 40
kennypu is an unknown quantity at this point
Re: Compressor won't start

Quote:
Originally Posted by oddjob View Post
Your code:
Code:
    compressor(4,2)
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.
Reply With Quote
  #8   Spotlight this post!  
Unread 16-02-2010, 22:07
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
Re: Compressor won't start

Quote:
Originally Posted by kennypu View Post
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?

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:

Code:
  Relay *m_relay_1;

...

  m_relay_1 = new Relay(1);
  m_relay_1->SetDirection(Relay::kForwardOnly);
  m_relay_1->Set(Relay::kOn);
Reply With Quote
  #9   Spotlight this post!  
Unread 16-02-2010, 22:11
kennypu kennypu is offline
Registered User
FRC #2467
 
Join Date: Jan 2010
Location: Hawaii
Posts: 40
kennypu is an unknown quantity at this point
Re: Compressor won't start

Quote:
Originally Posted by oddjob View Post
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:

Code:
  Relay *m_relay_1;

...

  m_relay_1 = new Relay(1);
  m_relay_1->SetDirection(Relay::kForwardOnly);
  m_relay_1->Set(Relay::kOn);
yeah, thats a good point, I should try to get the compressor working first -.-. I'll get back after I try it out tomorrow, thanks oddjob x].
Reply With Quote
  #10   Spotlight this post!  
Unread 17-02-2010, 15:16
kennypu kennypu is offline
Registered User
FRC #2467
 
Join Date: Jan 2010
Location: Hawaii
Posts: 40
kennypu is an unknown quantity at this point
Re: Compressor won't start

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?
Reply With Quote
  #11   Spotlight this post!  
Unread 18-02-2010, 15:05
kennypu kennypu is offline
Registered User
FRC #2467
 
Join Date: Jan 2010
Location: Hawaii
Posts: 40
kennypu is an unknown quantity at this point
Re: Compressor won't start

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.
Reply With Quote
  #12   Spotlight this post!  
Unread 18-02-2010, 16:31
Racer26 Racer26 is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Apr 2003
Rookie Year: 2003
Location: Beaverton, ON
Posts: 2,229
Racer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond repute
Re: Compressor won't start

The compressor WILL NOT RUN without the pressure switch connected, this is because the switch is a normally closed contact, that goes open when its reached pressure.

The code you showed shows Digital In 4 as where its expecting the switch, and Relay 2 as where its outputting the signals. The LEDs on the sidecar near the relay ports will switch when its working.

Also, I highly recommend using pointers instead of directly instantiating your objects:

Code:
class myRobot : public SimpleRobot 
{
RobotDrive* driveBase;
Jaguar* someMotor;
Solenoid* someSolenoid;
Compressor* theCompressor;

myRobot(){
driveBase = new RobotDrive(1,2,3,4);
someMotor = new Jaguar(5);
someSolenoid = new Solenoid(1);
theCompressor = new Compressor(1,1);
theCompressor->Start();
}

void Teleop(){
someMotor->Set(1);
}

};
This way, you can pass them by reference, instead of by value, which breaks things. Its good practice.
Reply With Quote
  #13   Spotlight this post!  
Unread 18-02-2010, 18:37
kennypu kennypu is offline
Registered User
FRC #2467
 
Join Date: Jan 2010
Location: Hawaii
Posts: 40
kennypu is an unknown quantity at this point
Re: Compressor won't start

Quote:
Originally Posted by 1075guy View Post
The compressor WILL NOT RUN without the pressure switch connected, this is because the switch is a normally closed contact, that goes open when its reached pressure.

The code you showed shows Digital In 4 as where its expecting the switch, and Relay 2 as where its outputting the signals. The LEDs on the sidecar near the relay ports will switch when its working.

Also, I highly recommend using pointers instead of directly instantiating your objects:

Code:
class myRobot : public SimpleRobot 
{
RobotDrive* driveBase;
Jaguar* someMotor;
Solenoid* someSolenoid;
Compressor* theCompressor;

myRobot(){
driveBase = new RobotDrive(1,2,3,4);
someMotor = new Jaguar(5);
someSolenoid = new Solenoid(1);
theCompressor = new Compressor(1,1);
theCompressor->Start();
}

void Teleop(){
someMotor->Set(1);
}

};
This way, you can pass them by reference, instead of by value, which breaks things. Its good practice.
Thanks 1075guy!!!! for some odd reason, using the pointers made it work o.o. Now off to work the solenoids...
Reply With Quote
  #14   Spotlight this post!  
Unread 19-02-2010, 08:23
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
Re: Compressor won't start

Quote:
Originally Posted by 1075guy View Post
The compressor WILL NOT RUN without the pressure switch connected, this is because the switch is a normally closed contact, that goes open when its reached pressure.

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?

Last edited by oddjob : 19-02-2010 at 08:26.
Reply With Quote
  #15   Spotlight this post!  
Unread 19-02-2010, 09:11
Racer26 Racer26 is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Apr 2003
Rookie Year: 2003
Location: Beaverton, ON
Posts: 2,229
Racer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond repute
Re: Compressor won't start

Is possible, maybe... Floating digital inputs generally read high, but I've seen them be low occasionally... I would check for an aluminum shaving or something lodged in your sidecar.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compressor won't start Alex_2487 C/C++ 6 12-02-2009 16:41
Wind River won't start radau C/C++ 6 19-01-2009 23:09
Won't Download! diaperrash89 Programming 4 25-10-2007 23:02
Running just the compressor (was: free compressor) sciguy125 Pneumatics 15 06-02-2006 18:23
Help! My 2003 Bot compressor won't shut off Jack21 Control System 10 11-02-2004 12:24


All times are GMT -5. The time now is 03:23.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi