Go to Post I do this stuff because...well first inspired me to become me. I now understand who i am better and what i want to do. - Marygrace [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 31-01-2013, 13:00
gitlitz gitlitz is offline
Registered User
FRC #4590
 
Join Date: Jan 2013
Location: israel
Posts: 11
gitlitz is an unknown quantity at this point
Problem with the compressor class

Hey, I am from team 4590.

We are having trouble with the compressor- it does nothing.
The pressure switch is connected to DigitalInput 1 and the Spike to Relay 2.
This is our full simple code:

note: when we use the Relay.Set() function (and don't use the Compressor class at all) the compressor works.

Code:
#include "WPILib.h"
 
class RobotDemo : public SimpleRobot
{
	Joystick stick;
	Compressor comp;

public:
	RobotDemo(void):
		stick(1),
		comp(1,2)
	{
		comp.Start();
	}

	void Autonomous(void)
	{
		Wait(2.0); 				
	}

	void OperatorControl(void)
	{
		while (IsOperatorControl())
		{
			Wait(0.005);
		}
	}
	
	void Test() {

	}
};

START_ROBOT_CLASS(RobotDemo);
Reply With Quote
  #2   Spotlight this post!  
Unread 31-01-2013, 13:12
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,572
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Problem with the compressor class

How is the pressure switch wired?
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2013, 11:06
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 157
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
Re: Problem with the compressor class

I believe the problem is that you won't have any effect on things if you do your comp.Start() from the constructor - RobotDemo(). It is much more normal to see the starting of the compressor at the beginning of OperatorControl() outside of the while loop. And if you need the compressor in Autonomous, you would also call comp.Start() in the beginning of Autonomous().

bob
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
Reply With Quote
  #4   Spotlight this post!  
Unread 03-02-2013, 04:06
mikets's Avatar
mikets mikets is online now
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Problem with the compressor class

Quote:
Originally Posted by bob.wolff68 View Post
I believe the problem is that you won't have any effect on things if you do your comp.Start() from the constructor - RobotDemo(). It is much more normal to see the starting of the compressor at the beginning of OperatorControl() outside of the while loop. And if you need the compressor in Autonomous, you would also call comp.Start() in the beginning of Autonomous().

bob
Our code calls compressor start in the robot class constructor. It works fine. Compressor takes time to charge up the air tanks so you would want to start the compressor as soon as possible. If not the robot constructor, it should be at least the beginning of RobotInit.
__________________
Reply With Quote
  #5   Spotlight this post!  
Unread 03-02-2013, 15:28
gitlitz gitlitz is offline
Registered User
FRC #4590
 
Join Date: Jan 2013
Location: israel
Posts: 11
gitlitz is an unknown quantity at this point
Re: Problem with the compressor class

Thank you for answering.

I have started the compressor in the OperatorControl() and it worked, but then I tried again to start it in the ctor and it also worked.

I have tried to look for the problem and I saw that it only works when I instantiate a RobotDrive. Can it be or is it just a coincidence?
Reply With Quote
  #6   Spotlight this post!  
Unread 03-02-2013, 19:46
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,572
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Problem with the compressor class

If you digitital side car is not properly wired, I could see trying to run multiple PWMs cause a problem with reading the pressure switch.
Reply With Quote
  #7   Spotlight this post!  
Unread 04-02-2013, 15:00
gitlitz gitlitz is offline
Registered User
FRC #4590
 
Join Date: Jan 2013
Location: israel
Posts: 11
gitlitz is an unknown quantity at this point
Re: Problem with the compressor class

It turn out one of the wires of the pressure switch was not connected properly.
Once we fixed it the Compressor started and stopped as expected.

Thank you for your help.
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


All times are GMT -5. The time now is 14:39.

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