Package frclib.output
Class FrcPneumatic
java.lang.Object
frclib.output.FrcPneumatic
This class implements a platform dependent pneumatic object. A pneumatic object consists of a 1 or 2 pneumatic
channels for a 1 or 2 valve pneumatic cylinder.
-
Constructor Summary
ConstructorsConstructorDescriptionFrcPneumatic(String instanceName, int canId, edu.wpi.first.wpilibj.PneumaticsModuleType moduleType, int extendChannel) Constructor: Creates a 1-valve pneumatic.FrcPneumatic(String instanceName, int canId, edu.wpi.first.wpilibj.PneumaticsModuleType moduleType, int extendChannel, int retractChannel) Constructor: Creates a 2-valve pneumatic. -
Method Summary
Modifier and TypeMethodDescriptionvoidextend()This methods activates the extend channel.voidextend(boolean on) This method sets the extend channel ON or OFF.voidextend(double duration) This methods activates the extend channel for the specified duration and deactivates it.voidextend(double delay, double duration) This method delays the specified delay time and activates the extend channel for the specified duration.intget(int bitMask) This method gets the states of the pneumatic channels specified in a bit mask.This methods checks if the pneumatic cylinder is extended.voidretract()This methods activates the retract channel.voidretract(boolean on) This method sets the retract channel ON or OFF.voidretract(double duration) This methods activates the retract channel for the specified duration and deactivates it.voidretract(double delay, double duration) This method delays the specified delay time and activates the retract channel for the specified duration.voidset(int bitMask, boolean on) This method sets the state of the pneumatic channels specified in a bit mask.toString()This method returns the instance name.
-
Constructor Details
-
FrcPneumatic
public FrcPneumatic(String instanceName, int canId, edu.wpi.first.wpilibj.PneumaticsModuleType moduleType, int extendChannel) Constructor: Creates a 1-valve pneumatic.- Parameters:
instanceName- specifies the instance name.canId- specifies the CAN ID of the Pneumatics Control Module.moduleType- specifies the module type to use.extendChannel- specifies the pneumatic channel to extend the cylinder.
-
FrcPneumatic
public FrcPneumatic(String instanceName, int canId, edu.wpi.first.wpilibj.PneumaticsModuleType moduleType, int extendChannel, int retractChannel) Constructor: Creates a 2-valve pneumatic.- Parameters:
instanceName- specifies the instance name.canId- specifies the CAN ID of the Pneumatics Control Module.moduleType- specifies the module type to use.extendChannel- specifies the pneumatic channel to extend the cylinder.extendChannel- specifies the pneumatic channel to retract the cylinder.
-
-
Method Details
-
toString
This method returns the instance name. -
set
public void set(int bitMask, boolean on) This method sets the state of the pneumatic channels specified in a bit mask.- Parameters:
bitMask- specifies the bit mask of the pneumatic channels to be set.on- specifies true to set the channels ON and false to set them OFF.
-
get
public int get(int bitMask) This method gets the states of the pneumatic channels specified in a bit mask.- Parameters:
bitMask- specifies the channels to get the states.- Returns:
- channel states in a bit mask (0: inactive, 1 active).
-
isExtended
This methods checks if the pneumatic cylinder is extended.- Returns:
- true if extended, false if not, null if unknown.
-
extend
public void extend(boolean on) This method sets the extend channel ON or OFF.- Parameters:
on- specifies true to turn the channel on, false to turn it off.
-
extend
public void extend()This methods activates the extend channel. -
extend
public void extend(double duration) This methods activates the extend channel for the specified duration and deactivates it.- Parameters:
duration- specifies the duration in seconds (from 0.01 to 2.55 sec).
-
extend
public void extend(double delay, double duration) This method delays the specified delay time and activates the extend channel for the specified duration.- Parameters:
delay- specifies the delay time in seconds.duration- specifies the activation duration in seconds (from 0.01 to 2.55 sec), set to 0.0 if no deactivation required.
-
retract
public void retract(boolean on) This method sets the retract channel ON or OFF.- Parameters:
on- specifies true to turn the channel on, false to turn it off.
-
retract
public void retract()This methods activates the retract channel. -
retract
public void retract(double duration) This methods activates the retract channel for the specified duration and deactivates it.- Parameters:
duration- specifies the duration in seconds (from 0.01 to 2.55 sec).
-
retract
public void retract(double delay, double duration) This method delays the specified delay time and activates the retract channel for the specified duration.- Parameters:
delay- specifies the delay time in seconds.duration- specifies the activation duration in seconds (from 0.01 to 2.55 sec), set to 0.0 if no deactivation required.
-