Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Help with Programming Pnuematics (http://www.chiefdelphi.com/forums/showthread.php?t=125301)

peng432 26-01-2014 18:08

Help with Programming Pnuematics
 
Hi,
Our team recently lost the majority of its programmers and where switching over to Java, i understand java a little and where using robot builder to make it a bit easier. My question is how do you code pneumatic's in general and even then how would you use that in robot builder? I lurked a little to try and find out but my adventure didn't give me anything. So any help would be Greatly appreciated!!

notmattlythgoe 27-01-2014 07:42

Re: Help with Programming Pnuematics
 
Quote:

Originally Posted by peng432 (Post 1332830)
Hi,
Our team recently lost the majority of its programmers and where switching over to Java, i understand java a little and where using robot builder to make it a bit easier. My question is how do you code pneumatic's in general and even then how would you use that in robot builder? I lurked a little to try and find out but my adventure didn't give me anything. So any help would be Greatly appreciated!!

You'll want to create a Solenoid first.
Code:

Solenoid solenoid1 = new Solenoid(1);
Then you'll want to tell the solenoid to activate.

Code:

solenoid1.set(true);
Or deactivate.

Code:

solenoid1.set(false);
If you have a double acting cylinder you'll need teo solenoids and active and deactivate them opposite of each other, or use a DoubleSolenoid.

peng432 27-01-2014 14:28

Re: Help with Programming Pnuematics
 
thanks for the reply,
Our team is using a double solenoid would the code still be the same or would their be any minor changes?

notmattlythgoe 27-01-2014 14:42

Re: Help with Programming Pnuematics
 
Quote:

Originally Posted by peng432 (Post 1333204)
thanks for the reply,
Our team is using a double solenoid would the code still be the same or would their be any minor changes?

Code:

DoubleSolenoid solenoid = new Solenoid(1, 2);
solenoid.set(DoubleSolenoid.Value.kForward);

kReverse would fire it the opposite direction.

Give that a try. You can also do something like:
Code:

Solenoid solenoid1 = new Solenoid(1);
Solenoid solenoid2 = new Solenoid(2);
solenoid1.set(true);
solenoid2.set(false);


Domenic Rodriguez 27-01-2014 14:46

Re: Help with Programming Pnuematics
 
Quote:

Originally Posted by peng432 (Post 1333204)
thanks for the reply,
Our team is using a double solenoid would the code still be the same or would their be any minor changes?

You would use the DoubleSolenoid class instead of the Solenoid class:
Code:

// Create a new DoubleSolenoid with the forward channel in port 1,
// and the reverse channel in port 2
DoubleSolenoid doubleSolenoid = new DoubleSolenoid(1, 2);

In addition, the call to DoubleSolenoid#set() is a bit different than Solenoid#set(). Instead of taking a boolean value, it takes a DoubleSolenoid.Value object:

Code:

// Set the solenoid to the 'forward' position
doubleSolenoid.set(DoubleSolenoid.Value.kForward);
// Set the solenoid to the 'reverse' position
doubleSolenoid.set(DoubleSolenoid.Value.kReverse);
// Set the solenoid to the 'off' position
doubleSolenoid.set(DoubleSolenoid.Value.kOff);

You can find more details in the FRC javadocs, located at "C:\Users\user\sunspotfrcsdk\doc\javadoc\index.html" on any computer that has the FRC Java plugins installed.


All times are GMT -5. The time now is 11:00.

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