LiveWindow

class wpilib.LiveWindow[source]

Bases: object

The public interface for putting sensors and actuators on the LiveWindow.

static addActuator(subsystem, name, component)[source]

Add an Actuator associated with the subsystem and with call it by the given name.

Parameters:
  • subsystem – The subsystem this component is part of.
  • name – The name of this component.
  • component – A LiveWindowSendable component that represents a actuator.
static addActuatorChannel(moduleType, channel, component)[source]

Add Actuator to LiveWindow. The components are shown with the module type, slot and channel like this: Servo[0,2] for a servo object connected to the first digital module and PWM port 2.

Parameters:
  • moduleType – A string that defines the module name in the label for the value
  • channel – The channel number the device is plugged into (usually PWM)
  • component – The reference to the object being added
static addActuatorModuleChannel(moduleType, moduleNumber, channel, component)[source]

Add Actuator to LiveWindow. The components are shown with the module type, slot and channel like this: Servo[0,2] for a servo object connected to the first digital module and PWM port 2.

Parameters:
  • moduleType – A string that defines the module name in the label for the value
  • moduleNumber – The number of the particular module type
  • channel – The channel number the device is plugged into (usually PWM)
  • component – The reference to the object being added
static addSensor(subsystem, name, component)[source]

Add a Sensor associated with the subsystem and with call it by the given name.

Parameters:
  • subsystem – The subsystem this component is part of.
  • name – The name of this component.
  • component – A LiveWindowSendable component that represents a sensor.
static addSensorChannel(moduleType, channel, component)[source]

Add Sensor to LiveWindow. The components are shown with the type and channel like this: Gyro[0] for a gyro object connected to the first analog channel.

Parameters:
  • moduleType – A string indicating the type of the module used in the naming (above)
  • channel – The channel number the device is connected to
  • component – A reference to the object being added
components = {}
firstTime = True
static initializeLiveWindowComponents()[source]

Initialize all the LiveWindow elements the first time we enter LiveWindow mode. By holding off creating the NetworkTable entries, it allows them to be redefined before the first time in LiveWindow mode. This allows default sensor and actuator values to be created that are replaced with the custom names from users calling addActuator and addSensor.

liveWindowEnabled = False
livewindowTable = None
static removeComponent(component)[source]

Removes a component from LiveWindow.

Parameters:component – The reference to the object being removed.
static run()[source]

The run method is called repeatedly to keep the values refreshed on the screen in test mode.

sensors = set()
static setEnabled(enabled)[source]

Set the enabled state of LiveWindow. If it’s being enabled, turn off the scheduler and remove all the commands from the queue and enable all the components registered for LiveWindow. If it’s being disabled, stop all the registered components and reenable the scheduler.

TODO: add code to disable PID loops when enabling LiveWindow. The commands should reenable the PID loops themselves when they get rescheduled. This prevents arms from starting to move around, etc. after a period of adjusting them in LiveWindow mode.

statusTable = None
static updateValues()[source]

Puts all sensor values on the live window.