Go to Post TL, DR: You may be skilled at karate on your own, but imagine how much better you'll be with Mr. Miyagi mentoring you. - artdutra04 [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 05-10-2010, 07:07 PM
cybiko123's Avatar
cybiko123 cybiko123 is offline
Roving Mentor
no team (Illinois FIRST)
Team Role: Mentor
 
Join Date: Mar 2008
Rookie Year: 2007
Location: Chicago
Posts: 16
cybiko123 is an unknown quantity at this point
Question Compressor works in teleop but not autonomous?

Hi,

We're having some issues with our compressor in autonomous. compressor.start(); doesn't seem to do anything, but all other code in autonomous works fine, and compressor.start(); works in teleop.

Are we doing something wrong?
Reply With Quote
  #2   Spotlight this post!  
Unread 05-10-2010, 08:40 PM
buildmaster5000 buildmaster5000 is offline
Trying to program the swerve drive
AKA: Alex
FRC #2421 (Rolling Thunder Robotics)
Team Role: Alumni
 
Join Date: May 2009
Rookie Year: 2009
Location: Northern Virginia
Posts: 207
buildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud of
Re: Compressor works in teleop but not autonomous?

what we did was put the compressor.start(); line in robotInit() and it worked all the time
__________________
-Alex



2010 Washington DC Regional: Engineering Excellence Award
Reply With Quote
  #3   Spotlight this post!  
Unread 05-11-2010, 12:15 AM
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: Compressor works in teleop but not autonomous?

compressor.start() won't start the compressor every time you call it.

It is designed to be called once for every time you stop it.
(it defaults to off)

When you call start, a semaphore is set to true.
This flag is checked twice a second by another thread, and if enabled (from the semaphore) and enabled (from the driver station) and the pressure switch pulls the IO pin to ground it sets the compressor's spike to turn on forward.

The line
Code:
c->Enabled()
is the semaphore that is set by calling start (and stop)

This is the thread that turns on and off the compressor (In C++, the Java version is very similar):
Code:
static void compressorChecker(Compressor *c)
{
         while (1)
         {
                 if (c->Enabled())
                 {
                        c->SetRelayValue( c->GetPressureSwitchValue() == 0 ? Relay::kOn : Relay::kOff );
                 }
                 else
                 {
                         c->SetRelayValue(Relay::kOff);
                }
                 Wait(0.5);
         }
}
This starts right after creating the compressor object.

You only need to call start once in the program.
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!
Reply With Quote
  #4   Spotlight this post!  
Unread 05-11-2010, 01:55 PM
cybiko123's Avatar
cybiko123 cybiko123 is offline
Roving Mentor
no team (Illinois FIRST)
Team Role: Mentor
 
Join Date: Mar 2008
Rookie Year: 2007
Location: Chicago
Posts: 16
cybiko123 is an unknown quantity at this point
Re: Compressor works in teleop but not autonomous?

Hi,

@biojae: We know that compressor.start(); is meant to be called once. The problem is, it doesn't do anything (even with pressure at zero).

In other words, it's not starting even when it should (and again, the compressor works in teleop without an issue).

@buildmaster5000: We're using SimpleRobotTemplate, so we don't have robotInit(). We'll try robotMain() and see what it does.
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
Updated LabVIEW and Compressor no longer works HansJ NI LabVIEW 1 02-18-2010 10:00 AM
Camera tracking code not working in our own program, but works in CircleTrackerDemo TPNigl Programming 3 01-31-2010 07:40 PM
Labview Autonomous AND Teleop Two-Face Programming 1 02-14-2009 06:33 PM
Cam works but RC won't LightWaves1636 Programming 9 02-03-2006 01:15 PM
New to C but not to basic, need help on autonomous cdennisxlx2 Programming 4 02-02-2005 03:38 AM


All times are GMT -5. The time now is 07:36 AM.

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