SensorBase

class wpilib.SensorBase(addLiveWindow=True)[source]

Bases: wpilib.SendableBase

Base class for all sensors

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

Creates an instance of the sensor base.

Parameters:addLiveWindow – if true, add this Sendable to LiveWindow
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 checkPDPModule(module)[source]

Verify that the power distribution module number is within limits. Module numbers are 0-based.

Parameters:module – The module 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

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 per roboRIO

kAnalogOutputChannels = 2

Number of analog output channels per roboRIO

kDigitalChannels = 31

Number of digital channels per roboRIO

kPCMModules = 63

Number of PCM modules

kPDPChannels = 16

Number of power distribution channels per PDP

kPDPModules = 63

Number of power distribution channels per PDP

kPwmChannels = 20

Number of PWM channels per roboRIO

kRelayChannels = 4

Number of relay channels per roboRIO

kSolenoidChannels = 8

Number of solenoid channels per module

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.