SensorBase

class wpilib.SensorBase[source]

Bases: wpilib.LiveWindowSendable

Base class for all sensors

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

static checkAnalogInputChannel(channel)[source]

Check that the analog input number is value. Verify that the analog input number is one of the legal channel numbers. Channel numbers are 0-based.

Parameters:channel – The channel number to check.
static checkAnalogOutputChannel(channel)[source]

Check that the analog input number is value. Verify that the analog input number is one of the legal channel numbers. Channel numbers are 0-based.

Parameters:channel – The channel number to check.
static checkDigitalChannel(channel)[source]

Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 0-based.

Parameters:channel – The channel number to check.
static checkPDPChannel(channel)[source]

Verify that the power distribution channel number is within limits. Channel numbers are 0-based.

Parameters:channel – The channel number to check.
static checkPWMChannel(channel)[source]

Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 0-based.

Parameters:channel – The channel number to check.
static checkRelayChannel(channel)[source]

Check that the digital channel number is valid. Verify that the channel number is one of the legal channel numbers. Channel numbers are 0-based.

Parameters:channel – The channel number to check.
static checkSolenoidChannel(channel)[source]

Verify that the solenoid channel number is within limits. Channel numbers are 0-based.

Parameters:channel – The channel number to check.
static checkSolenoidModule(moduleNumber)[source]

Verify that the solenoid module is correct.

Parameters:moduleNumber – The solenoid module module number to check.
defaultSolenoidModule = 0

Default solenoid module

free()[source]

Free the resources used by this object

static getDefaultSolenoidModule()[source]

Get the number of the default solenoid module.

Returns:The number of the default solenoid module.
kAnalogInputChannels = 8

Number of analog input channels

kAnalogOutputChannels = 2

Number of analog output channels

kDigitalChannels = 26

Number of digital channels per roboRIO

kPDPChannels = 16

Number of power distribution channels

kPwmChannels = 20

Number of PWM channels per roboRIO

kRelayChannels = 4

Number of relay channels per roboRIO

kSolenoidChannels = 8

Number of solenoid channels per module

kSolenoidModules = 2

Number of solenoid modules

kSystemClockTicksPerMicrosecond = 40

Ticks per microsecond

static setDefaultSolenoidModule(moduleNumber)[source]

Set the default location for the Solenoid module.

Parameters:moduleNumber – The number of the solenoid module to use.