2010 FRC Java API


edu.wpi.first.wpilibj
Class SensorBase

java.lang.Object
  extended by edu.wpi.first.wpilibj.SensorBase
Direct Known Subclasses:
Accelerometer, AnalogChannel, Compressor, Counter, DigitalOutput, DriverStationLCD, Encoder, Gyro, HiTechnicCompass, I2C, InterruptableSensorBase, Module, PWM, Relay, Solenoid, Ultrasonic, Watchdog

public class SensorBase
extends Object

Base class for all sensors. Stores most recent status information as well as containing utility functions for checking channels and error processing.


Field Summary
static int kAnalogChannels
          Number of analog channels per module
static int kAnalogModules
          Number of analog modules
static int kChassisSlots
          Number of slots in the chassis
static int kDigitalChannels
          Number of digital channels per digital sidecar
static int kPwmChannels
          Number of PWM channels per sidecar
static int kRelayChannels
          Number of relay channels per sidecar
static int kSolenoidChannels
          Number of solenoid channels per moduel
static int kSolenoidModules
          Number of analog modules
static int kSystemClockTicksPerMicrosecond
          Ticks per microsecond
 
Constructor Summary
SensorBase()
          Creates an instance of the sensor base and gets an FPGA handle
 
Method Summary
protected static void checkAnalogChannel(int channel)
          Check that the analog channel number is value.
protected static void checkAnalogModule(int slot)
          Check that the analog module number is valid.
protected static void checkDigitalChannel(int channel)
          Check that the digital channel number is valid.
protected static void checkDigitalModule(int slot)
          Check that the digital module number is valid.
protected static void checkPWMChannel(int channel)
          Check that the digital channel number is valid.
protected static void checkPWMModule(int slot)
          Check that the digital module number is valid.
protected static void checkRelayChannel(int channel)
          Check that the digital channel number is valid.
protected static void checkRelayModule(int slot)
          Check that the digital module number is valid.
protected static void checkSolenoidChannel(int channel)
          Verify that the solenoid channel number is within limits.
protected static void checkSolenoidModule(int slot)
          Verify that the solenoid module is correct.
protected  void free()
          Free the resources used by this object
static int getDefaultAnalogModule()
          Get the slot that contains the default analog module.
static int getDefaultDigitalModule()
          Get the slot that contains the default analog module.
static int getDefaultSolenoidModule()
          Get the slot that contains the default analog module.
static void setDefaultAnalogModule(int slot)
          Sets the default Analog module.
static void setDefaultDigitalModule(int slot)
          Sets the default Digital Module.
static void setDefaultSolenoidModule(int slot)
          Set the default location for the Solenoid (9472) module.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kSystemClockTicksPerMicrosecond

public static final int kSystemClockTicksPerMicrosecond
Ticks per microsecond

See Also:
Constant Field Values

kDigitalChannels

public static final int kDigitalChannels
Number of digital channels per digital sidecar

See Also:
Constant Field Values

kAnalogChannels

public static final int kAnalogChannels
Number of analog channels per module

See Also:
Constant Field Values

kAnalogModules

public static final int kAnalogModules
Number of analog modules

See Also:
Constant Field Values

kSolenoidChannels

public static final int kSolenoidChannels
Number of solenoid channels per moduel

See Also:
Constant Field Values

kSolenoidModules

public static final int kSolenoidModules
Number of analog modules

See Also:
Constant Field Values

kPwmChannels

public static final int kPwmChannels
Number of PWM channels per sidecar

See Also:
Constant Field Values

kRelayChannels

public static final int kRelayChannels
Number of relay channels per sidecar

See Also:
Constant Field Values

kChassisSlots

public static final int kChassisSlots
Number of slots in the chassis

See Also:
Constant Field Values
Constructor Detail

SensorBase

public SensorBase()
Creates an instance of the sensor base and gets an FPGA handle

Method Detail

setDefaultDigitalModule

public static void setDefaultDigitalModule(int slot)
Sets the default Digital Module. This sets the default digital module to use for objects that are created without specifying the digital module in the constructor. The default module is initialized to the first module in the chassis.

Parameters:
slot - The cRIO slot containing the digital module.

setDefaultAnalogModule

public static void setDefaultAnalogModule(int slot)
Sets the default Analog module. This sets the default analog module to use for objects that are created without specifying the analog module in the constructor. The default module is initialized to the first module in the chassis.

Parameters:
slot - The cRIO slot containing the analog module.

setDefaultSolenoidModule

public static void setDefaultSolenoidModule(int slot)
Set the default location for the Solenoid (9472) module. Currently the module must be in slot 8, but it might change in the future.

Parameters:
slot - The cRIO slot containing the analog module.

checkDigitalModule

protected static void checkDigitalModule(int slot)
Check that the digital module number is valid. Module numbers are the slot number that they are inserted in.

Parameters:
slot - The cRIO slot to check.

checkRelayModule

protected static void checkRelayModule(int slot)
Check that the digital module number is valid. Module numbers are the slot number that they are inserted in.

Parameters:
slot - The cRIO slot to check.

checkPWMModule

protected static void checkPWMModule(int slot)
Check that the digital module number is valid. Module numbers are the slot number that they are inserted in.

Parameters:
slot - The cRIO slot to check.

checkAnalogModule

protected static void checkAnalogModule(int slot)
Check that the analog module number is valid. Module numbers are the slot numbers that they are inserted in.

Parameters:
slot - The cRIO slot to check.

checkSolenoidModule

protected static void checkSolenoidModule(int slot)
Verify that the solenoid module is correct. Verify that the solenoid module is slot 8 or 7.

Parameters:
slot - The cRIO slot to check.

checkDigitalChannel

protected static void checkDigitalChannel(int channel)
Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 1-based.

Parameters:
channel - The channel number to check.

checkRelayChannel

protected static void checkRelayChannel(int channel)
Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 1-based.

Parameters:
channel - The channel number to check.

checkPWMChannel

protected static void checkPWMChannel(int channel)
Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 1-based.

Parameters:
channel - The channel number to check.

checkAnalogChannel

protected static void checkAnalogChannel(int channel)
Check that the analog channel number is value. Verify that the analog channel number is one of the legal channel numbers. Channel numbers are 1-based.

Parameters:
channel - The channel number to check.

checkSolenoidChannel

protected static void checkSolenoidChannel(int channel)
Verify that the solenoid channel number is within limits. Channel numbers are 1-based.

Parameters:
channel - The channel number to check.

getDefaultAnalogModule

public static int getDefaultAnalogModule()
Get the slot that contains the default analog module.

Returns:
The slot containing the default analog module.

getDefaultDigitalModule

public static int getDefaultDigitalModule()
Get the slot that contains the default analog module.

Returns:
The slot containing the default analog module.

getDefaultSolenoidModule

public static int getDefaultSolenoidModule()
Get the slot that contains the default analog module.

Returns:
The slot containing the default analog module.

free

protected void free()
Free the resources used by this object


2010 FRC Java API


Copyright © 2006-2009 Sun Microsystems, Inc. All Rights Reserved.