WPILibC++ 2024.3.2
DSControlWord.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
8
9namespace frc {
10
11/**
12 * A wrapper around Driver Station control word.
13 */
15 public:
16 /**
17 * DSControlWord constructor.
18 *
19 * Upon construction, the current Driver Station control word is read and
20 * stored internally.
21 */
23
24 /**
25 * Check if the DS has enabled the robot.
26 *
27 * @return True if the robot is enabled and the DS is connected
28 */
29 bool IsEnabled() const;
30
31 /**
32 * Check if the robot is disabled.
33 *
34 * @return True if the robot is explicitly disabled or the DS is not connected
35 */
36 bool IsDisabled() const;
37
38 /**
39 * Check if the robot is e-stopped.
40 *
41 * @return True if the robot is e-stopped
42 */
43 bool IsEStopped() const;
44
45 /**
46 * Check if the DS is commanding autonomous mode.
47 *
48 * @return True if the robot is being commanded to be in autonomous mode
49 */
50 bool IsAutonomous() const;
51
52 /**
53 * Check if the DS is commanding autonomous mode and if it has enabled the
54 * robot.
55 *
56 * @return True if the robot is being commanded to be in autonomous mode and
57 * enabled.
58 */
59 bool IsAutonomousEnabled() const;
60
61 /**
62 * Check if the DS is commanding teleop mode.
63 *
64 * @return True if the robot is being commanded to be in teleop mode
65 */
66 bool IsTeleop() const;
67
68 /**
69 * Check if the DS is commanding teleop mode and if it has enabled the robot.
70 *
71 * @return True if the robot is being commanded to be in teleop mode and
72 * enabled.
73 */
74 bool IsTeleopEnabled() const;
75
76 /**
77 * Check if the DS is commanding test mode.
78 *
79 * @return True if the robot is being commanded to be in test mode
80 */
81 bool IsTest() const;
82
83 /**
84 * Check if the DS is attached.
85 *
86 * @return True if the DS is connected to the robot
87 */
88 bool IsDSAttached() const;
89
90 /**
91 * Is the driver station attached to a Field Management System?
92 *
93 * @return True if the robot is competing on a field being controlled by a
94 * Field Management System
95 */
96 bool IsFMSAttached() const;
97
98 private:
99 HAL_ControlWord m_controlWord;
100};
101
102} // namespace frc
A wrapper around Driver Station control word.
Definition: DSControlWord.h:14
bool IsEnabled() const
Check if the DS has enabled the robot.
bool IsTeleop() const
Check if the DS is commanding teleop mode.
bool IsFMSAttached() const
Is the driver station attached to a Field Management System?
bool IsEStopped() const
Check if the robot is e-stopped.
bool IsTest() const
Check if the DS is commanding test mode.
bool IsAutonomous() const
Check if the DS is commanding autonomous mode.
bool IsDSAttached() const
Check if the DS is attached.
bool IsAutonomousEnabled() const
Check if the DS is commanding autonomous mode and if it has enabled the robot.
bool IsDisabled() const
Check if the robot is disabled.
bool IsTeleopEnabled() const
Check if the DS is commanding teleop mode and if it has enabled the robot.
DSControlWord()
DSControlWord constructor.
Definition: AprilTagPoseEstimator.h:15
Definition: DriverStationTypes.h:32