Go to Post using CD to answer my question is not the way to get the "ALL-BINDING FIRST ANSWER." - rees2001 [more]
Home
Go Back   Chief Delphi > Technical > Pneumatics
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
  #4   Spotlight this post!  
Unread 08-02-2014, 17:56
Joey1939's Avatar
Joey1939 Joey1939 is offline
Registered User
AKA: Joey Holliday
FRC #1939 (Kuhnigits)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Kansas City, Missouri
Posts: 142
Joey1939 has a spectacular aura aboutJoey1939 has a spectacular aura aboutJoey1939 has a spectacular aura about
Re: Cannot turn on compressor programatically via Spike Relay

You want this command to always run on the compressor so that it will always have full pressure and so that it will automatically shut off at the right time. To do this you need to set your UpdatePressure command as the default command for the compressor.

Here is an example from my team's code:

Compressor Subsystem
Code:
public class Compressor1 extends Subsystem {

    Compressor compressor = RobotMap.compressor1compressor;

    public void initDefaultCommand() {
        setDefaultCommand(new CompressorCommand());
    }
}
CompressorCommand
Code:
public class  CompressorCommand extends Command {
    Compressor compressor;
    
    public CompressorCommand() {
        requires(Robot.compressor1);
        compressor = RobotMap.compressor1compressor;
    }

    protected void execute() {
        
        if(!compressor.getPressureSwitchValue()){
            //Compressor NOT Full
            if(!compressor.enabled()){
                compressor.start();
            }
        }else{
            //Compressor Full
            compressor.stop();
        }
    }

    protected boolean isFinished() {
        return false;
    }

}
 


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 11:22.

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