RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
org.wpilib.driverstation.RobotState Class Reference

Static Public Member Functions

static boolean isEnabled ()
static boolean isDisabled ()
static boolean isEStopped ()
static RobotMode getRobotMode ()
static boolean isAutonomous ()
static boolean isAutonomousEnabled ()
static boolean isTeleop ()
static boolean isTeleopEnabled ()
static boolean isUtility ()
static boolean isUtilityEnabled ()
static long addOpMode (RobotMode mode, String name, String group, String description, Color textColor, Color backgroundColor)
static long addOpMode (RobotMode mode, String name, String group, String description)
static long addOpMode (RobotMode mode, String name, String group)
static long addOpMode (RobotMode mode, String name)
static long removeOpMode (RobotMode mode, String name)
static void publishOpModes ()
static void clearOpModes ()
static long getOpModeId ()
static String getOpMode ()
static boolean isOpMode (long id)
static boolean isOpMode (String mode)
static boolean isDSAttached ()
static boolean isFMSAttached ()

Detailed Description

Provides access to robot state information from the Driver Station.

Definition at line 12 of file RobotState.java.

Member Function Documentation

◆ addOpMode() [1/4]

long org.wpilib.driverstation.RobotState.addOpMode ( RobotMode mode,
String name )
static

Adds an operating mode option. It's necessary to call publishOpModes() to make the added modes visible to the driver station.

Parameters
moderobot mode
namename of the operating mode
Returns
unique ID used to later identify the operating mode
Exceptions
IllegalArgumentExceptionif name is empty or an operating mode with the same name already exists

Definition at line 179 of file RobotState.java.

◆ addOpMode() [2/4]

long org.wpilib.driverstation.RobotState.addOpMode ( RobotMode mode,
String name,
String group )
static

Adds an operating mode option. It's necessary to call publishOpModes() to make the added modes visible to the driver station.

Parameters
moderobot mode
namename of the operating mode
groupgroup of the operating mode
Returns
unique ID used to later identify the operating mode
Exceptions
IllegalArgumentExceptionif name is empty or an operating mode with the same name already exists

Definition at line 165 of file RobotState.java.

◆ addOpMode() [3/4]

long org.wpilib.driverstation.RobotState.addOpMode ( RobotMode mode,
String name,
String group,
String description )
static

Adds an operating mode option. It's necessary to call publishOpModes() to make the added modes visible to the driver station.

Parameters
moderobot mode
namename of the operating mode
groupgroup of the operating mode
descriptiondescription of the operating mode
Returns
unique ID used to later identify the operating mode
Exceptions
IllegalArgumentExceptionif name is empty or an operating mode with the same name already exists

Definition at line 150 of file RobotState.java.

◆ addOpMode() [4/4]

long org.wpilib.driverstation.RobotState.addOpMode ( RobotMode mode,
String name,
String group,
String description,
Color textColor,
Color backgroundColor )
static

Adds an operating mode option. It's necessary to call publishOpModes() to make the added modes visible to the driver station.

Parameters
moderobot mode
namename of the operating mode
groupgroup of the operating mode
descriptiondescription of the operating mode
textColortext color, or null for default
backgroundColorbackground color, or null for default
Returns
unique ID used to later identify the operating mode
Exceptions
IllegalArgumentExceptionif name is empty or an operating mode with the same robot mode and name already exists

Definition at line 127 of file RobotState.java.

◆ clearOpModes()

void org.wpilib.driverstation.RobotState.clearOpModes ( )
static

Clears all operating mode options and publishes an empty list to the driver station.

Definition at line 201 of file RobotState.java.

◆ getOpMode()

String org.wpilib.driverstation.RobotState.getOpMode ( )
static

Gets the operating mode selected on the driver station. Note this does not mean the robot is enabled; use isEnabled() for that. In a match, this will indicate the operating mode selected for auto before the match starts (i.e., while the robot is disabled in auto mode); after the auto period ends, this will change to reflect the operating mode selected for teleop.

Returns
Operating mode string; may return a string not in the list of options, so callers should be prepared to handle that case

Definition at line 227 of file RobotState.java.

◆ getOpModeId()

long org.wpilib.driverstation.RobotState.getOpModeId ( )
static

Gets the operating mode selected on the driver station. Note this does not mean the robot is enabled; use isEnabled() for that. In a match, this will indicate the operating mode selected for auto before the match starts (i.e., while the robot is disabled in auto mode); after the auto period ends, this will change to reflect the operating mode selected for teleop.

Returns
the unique ID provided by the addOpMode() function; may return 0 or a unique ID not added, so callers should be prepared to handle that case

Definition at line 214 of file RobotState.java.

◆ getRobotMode()

RobotMode org.wpilib.driverstation.RobotState.getRobotMode ( )
static

Gets the current robot mode.

Note that this does not indicate whether the robot is enabled or disabled.

Returns
robot mode

Definition at line 49 of file RobotState.java.

◆ isAutonomous()

boolean org.wpilib.driverstation.RobotState.isAutonomous ( )
static

Gets a value indicating whether the Driver Station requires the robot to be running in autonomous mode.

Returns
True if autonomous mode should be enabled, false otherwise.

Definition at line 59 of file RobotState.java.

◆ isAutonomousEnabled()

boolean org.wpilib.driverstation.RobotState.isAutonomousEnabled ( )
static

Gets a value indicating whether the Driver Station requires the robot to be running in autonomous mode and enabled.

Returns
True if autonomous should be set and the robot should be enabled.

Definition at line 69 of file RobotState.java.

◆ isDisabled()

boolean org.wpilib.driverstation.RobotState.isDisabled ( )
static

Gets a value indicating whether the Driver Station requires the robot to be disabled.

Returns
True if the robot should be disabled, false otherwise.

Definition at line 29 of file RobotState.java.

◆ isDSAttached()

boolean org.wpilib.driverstation.RobotState.isDSAttached ( )
static

Gets a value indicating whether the Driver Station is attached.

Returns
True if Driver Station is attached, false otherwise.

Definition at line 258 of file RobotState.java.

◆ isEnabled()

boolean org.wpilib.driverstation.RobotState.isEnabled ( )
static

Gets a value indicating whether the Driver Station requires the robot to be enabled.

Returns
True if the robot is enabled, false otherwise.

Definition at line 20 of file RobotState.java.

◆ isEStopped()

boolean org.wpilib.driverstation.RobotState.isEStopped ( )
static

Gets a value indicating whether the Robot is e-stopped.

Returns
True if the robot is e-stopped, false otherwise.

Definition at line 38 of file RobotState.java.

◆ isFMSAttached()

boolean org.wpilib.driverstation.RobotState.isFMSAttached ( )
static

Gets if the driver station attached to a Field Management System.

Returns
true if the robot is competing on a field being controlled by a Field Management System

Definition at line 267 of file RobotState.java.

◆ isOpMode() [1/2]

boolean org.wpilib.driverstation.RobotState.isOpMode ( long id)
static

Check to see if the selected operating mode is a particular value. Note this does not mean the robot is enabled; use isEnabled() for that.

Parameters
idoperating mode unique ID
Returns
True if that mode is the current mode

Definition at line 238 of file RobotState.java.

◆ isOpMode() [2/2]

boolean org.wpilib.driverstation.RobotState.isOpMode ( String mode)
static

Check to see if the selected operating mode is a particular value. Note this does not mean the robot is enabled; use isEnabled() for that.

Parameters
modeoperating mode
Returns
True if that mode is the current mode

Definition at line 249 of file RobotState.java.

◆ isTeleop()

boolean org.wpilib.driverstation.RobotState.isTeleop ( )
static

Gets a value indicating whether the Driver Station requires the robot to be running in operator-controlled mode.

Returns
True if operator-controlled mode should be enabled, false otherwise.

Definition at line 79 of file RobotState.java.

◆ isTeleopEnabled()

boolean org.wpilib.driverstation.RobotState.isTeleopEnabled ( )
static

Gets a value indicating whether the Driver Station requires the robot to be running in operator-controller mode and enabled.

Returns
True if operator-controlled mode should be set and the robot should be enabled.

Definition at line 89 of file RobotState.java.

◆ isUtility()

boolean org.wpilib.driverstation.RobotState.isUtility ( )
static

Gets a value indicating whether the Driver Station requires the robot to be running in Utility mode.

Returns
True if utility mode should be enabled, false otherwise.

Definition at line 99 of file RobotState.java.

◆ isUtilityEnabled()

boolean org.wpilib.driverstation.RobotState.isUtilityEnabled ( )
static

Gets a value indicating whether the Driver Station requires the robot to be running in Utility mode and enabled.

Returns
True if utility mode should be set and the robot should be enabled.

Definition at line 109 of file RobotState.java.

◆ publishOpModes()

void org.wpilib.driverstation.RobotState.publishOpModes ( )
static

Publishes the operating mode options to the driver station.

Definition at line 196 of file RobotState.java.

◆ removeOpMode()

long org.wpilib.driverstation.RobotState.removeOpMode ( RobotMode mode,
String name )
static

Removes an operating mode option. It's necessary to call publishOpModes() to make the removed mode no longer visible to the driver station.

Parameters
moderobot mode
namename of the operating mode
Returns
unique ID for the opmode, or 0 if not found

Definition at line 191 of file RobotState.java.


The documentation for this class was generated from the following file: