"

2013 FRC Java API

"

edu.wpi.first.wpilibj
Class AnalogTrigger

java.lang.Object
  extended by edu.wpi.first.wpilibj.AnalogTrigger
All Implemented Interfaces:
IDevice, IInputOutput

public class AnalogTrigger
extends Object
implements IInputOutput

Class for creating and configuring Analog Triggers

Author:
dtjones

Nested Class Summary
 class AnalogTrigger.AnalogTriggerException
          Exceptions dealing with improper operation of the Analog trigger
 
Field Summary
protected  int m_index
          Where the analog trigger is attached
 
Constructor Summary
AnalogTrigger(AnalogChannel channel)
          Construct an analog trigger given an analog channel.
AnalogTrigger(int channel)
          Constructor for an analog trigger given a channel number.
AnalogTrigger(int moduleNumber, int channel)
          Constructor for an analog trigger given both the module number and channel.
 
Method Summary
 void free()
          Release the resources used by this object
 int getIndex()
          Return the index of the analog trigger.
 boolean getInWindow()
          Return the InWindow output of the analog trigger.
 boolean getTriggerState()
          Return the TriggerState output of the analog trigger.
protected  void initTrigger(int moduleNumber, int channel)
          Initialize an analog trigger from a module number and channel.
 void setAveraged(boolean useAveragedValue)
          Configure the analog trigger to use the averaged vs.
 void setFiltered(boolean useFilteredValue)
          Configure the analog trigger to use a filtered value.
 void setLimitsRaw(int lower, int upper)
          Set the upper and lower limits of the analog trigger.
 void setLimitsVoltage(double lower, double upper)
          Set the upper and lower limits of the analog trigger.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_index

protected int m_index
Where the analog trigger is attached

Constructor Detail

AnalogTrigger

public AnalogTrigger(int channel)
Constructor for an analog trigger given a channel number. The default module is used in this case.

Parameters:
channel - the port to use for the analog trigger

AnalogTrigger

public AnalogTrigger(int moduleNumber,
                     int channel)
Constructor for an analog trigger given both the module number and channel.

Parameters:
moduleNumber - The number of the analog module to create this trigger on.
channel - the port to use for the analog trigger

AnalogTrigger

public AnalogTrigger(AnalogChannel channel)
Construct an analog trigger given an analog channel. This should be used in the case of sharing an analog channel between the trigger and an analog input object.

Parameters:
channel - the AnalogChannel to use for the analog trigger
Method Detail

initTrigger

protected void initTrigger(int moduleNumber,
                           int channel)
Initialize an analog trigger from a module number and channel. This is the common code for the two constructors that use a module number and channel.

Parameters:
moduleNumber - The number of the analog module to create this trigger on.
channel - the port to use for the analog trigger

free

public void free()
Release the resources used by this object


setLimitsRaw

public void setLimitsRaw(int lower,
                         int upper)
Set the upper and lower limits of the analog trigger. The limits are given in ADC codes. If oversampling is used, the units must be scaled appropriately.

Parameters:
lower - the lower raw limit
upper - the upper raw limit

setLimitsVoltage

public void setLimitsVoltage(double lower,
                             double upper)
Set the upper and lower limits of the analog trigger. The limits are given as floating point voltage values.

Parameters:
lower - the lower voltage limit
upper - the upper voltage limit

setAveraged

public void setAveraged(boolean useAveragedValue)
Configure the analog trigger to use the averaged vs. raw values. If the value is true, then the averaged value is selected for the analog trigger, otherwise the immediate value is used.

Parameters:
useAveragedValue - true to use an averaged value, false otherwise

setFiltered

public void setFiltered(boolean useFilteredValue)
Configure the analog trigger to use a filtered value. The analog trigger will operate with a 3 point average rejection filter. This is designed to help with 360 degree pot applications for the period where the pot crosses through zero.

Parameters:
useFilteredValue - true to use a filterd value, false otherwise

getIndex

public int getIndex()
Return the index of the analog trigger. This is the FPGA index of this analog trigger instance.

Returns:
The index of the analog trigger.

getInWindow

public boolean getInWindow()
Return the InWindow output of the analog trigger. True if the analog input is between the upper and lower limits.

Returns:
The InWindow output of the analog trigger.

getTriggerState

public boolean getTriggerState()
Return the TriggerState output of the analog trigger. True if above upper limit. False if below lower limit. If in Hysteresis, maintain previous state.

Returns:
The TriggerState output of the analog trigger.

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"