RobotBase

class wpilib.RobotBase(self: wpilib.RobotBase) → None

Bases: pybind11_builtins.pybind11_object

Implement a Robot Program framework.

The RobotBase class is intended to be subclassed by a user creating a robot program. Overridden Autonomous() and OperatorControl() methods are called at the appropriate time as the match proceeds. In the current implementation, the Autonomous code will run to completion before the OperatorControl code could start. In the future the Autonomous code might be spawned as a task, then killed at the end of the Autonomous period.

Constructor for a generic robot program.

User code should be placed in the constructor that runs before the Autonomous or Operator Control period starts. The constructor will run to completion before Autonomous is entered.

This must be used to ensure that the communications code starts. In the future it would be nice to put this code into it’s own task that loads on boot so ensure that it runs.

property ds
endCompetition(self: wpilib.RobotBase) → None
getControlState(self: wpilib.RobotBase) → Tuple[bool, bool, bool]

More efficient way to determine what state the robot is in.

Returns

booleans representing enabled, isautonomous, istest

New in version 2019.2.1.

Note

This function only exists in RobotPy

isAutonomous(self: wpilib.RobotBase) → bool

Determine if the robot is currently in Autonomous mode.

Returns

True if the robot is currently operating Autonomously as determined by the field controls.

isAutonomousEnabled(self: wpilib.RobotBase) → bool

Determine if the robot is currently in Autonomous mode and enabled.

Returns

True if the robot us currently operating Autonomously while enabled as determined by the field controls.

isDisabled(self: wpilib.RobotBase) → bool

Determine if the Robot is currently disabled.

Returns

True if the Robot is currently disabled by the field controls.

isEnabled(self: wpilib.RobotBase) → bool

Determine if the Robot is currently enabled.

Returns

True if the Robot is currently enabled by the field controls.

isNewDataAvailable(self: wpilib.RobotBase) → bool

Indicates if new data is available from the driver station.

Returns

Has new data arrived over the network since the last time this function was called?

isOperatorControl(self: wpilib.RobotBase) → bool

Determine if the robot is currently in Operator Control mode.

Returns

True if the robot is currently operating in Tele-Op mode as determined by the field controls.

isOperatorControlEnabled(self: wpilib.RobotBase) → bool

Determine if the robot is current in Operator Control mode and enabled.

Returns

True if the robot is currently operating in Tele-Op mode while wnabled as determined by the field-controls.

static isReal() → bool

Get if the robot is real.

Returns

If the robot is running in the real world.

static isSimulation() → bool

Get if the robot is a simulation.

Returns

If the robot is running in simulation.

isTest(self: wpilib.RobotBase) → bool

Determine if the robot is currently in Test mode.

Returns

True if the robot is currently running tests as determined by the field controls.

logger = <Logger robot (WARNING)>
static main(robot_cls: object) → object

Starting point for the application

startCompetition(self: wpilib.RobotBase) → None