Go to Post [This year's game manual contains] 46 new pages of pictures displaying how to attach bumpers, assuring at least 15% of teams almost get it right this time. - PayneTrain [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 11-05-2010, 00:15
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
 


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 18-02-2010 10:00
Camera tracking code not working in our own program, but works in CircleTrackerDemo TPNigl Programming 3 31-01-2010 19:40
Labview Autonomous AND Teleop Two-Face Programming 1 14-02-2009 18:33
Cam works but RC won't LightWaves1636 Programming 9 03-02-2006 13:15
New to C but not to basic, need help on autonomous cdennisxlx2 Programming 4 02-02-2005 03:38


All times are GMT -5. The time now is 12:45.

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