WPILibC++ 2027.0.0-alpha-5
Loading...
Searching...
No Matches
GamepadSim.hpp
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
9
10namespace wpi::sim {
11
12/**
13 * Class to control a simulated Gamepad controller.
14 */
15class GamepadSim : public GenericHIDSim {
16 public:
17 /**
18 * Constructs from a Gamepad object.
19 *
20 * @param joystick controller to simulate
21 */
22 explicit GamepadSim(const wpi::Gamepad& joystick);
23
24 /**
25 * Constructs from a joystick port number.
26 *
27 * @param port port number
28 */
29 explicit GamepadSim(int port);
30
31 /**
32 * Set the value of a given button.
33 *
34 * @param button the button to set
35 * @param value the new value
36 */
37 void SetButton(wpi::Gamepad::Button button, bool value);
38
39 /**
40 * Set the value of a given axis.
41 *
42 * @param axis the axis to set
43 * @param value the new value
44 */
45 void SetAxis(wpi::Gamepad::Axis axis, double value);
46
47 /**
48 * Change the left X value of the controller's joystick.
49 *
50 * @param value the new value
51 */
52 void SetLeftX(double value);
53
54 /**
55 * Change the left Y value of the controller's joystick.
56 *
57 * @param value the new value
58 */
59 void SetLeftY(double value);
60
61 /**
62 * Change the right X value of the controller's joystick.
63 *
64 * @param value the new value
65 */
66 void SetRightX(double value);
67
68 /**
69 * Change the right Y value of the controller's joystick.
70 *
71 * @param value the new value
72 */
73 void SetRightY(double value);
74
75 /**
76 * Change the value of the left trigger axis on the controller.
77 *
78 * @param value the new value
79 */
80 void SetLeftTriggerAxis(double value);
81
82 /**
83 * Change the value of the right trigger axis on the controller.
84 *
85 * @param value the new value
86 */
87 void SetRightTriggerAxis(double value);
88
89 /**
90 * Change the value of the South Face button on the controller.
91 *
92 * @param value the new value
93 */
94 void SetSouthFaceButton(bool value);
95
96 /**
97 * Change the value of the East Face button on the controller.
98 *
99 * @param value the new value
100 */
101 void SetEastFaceButton(bool value);
102
103 /**
104 * Change the value of the West Face button on the controller.
105 *
106 * @param value the new value
107 */
108 void SetWestFaceButton(bool value);
109
110 /**
111 * Change the value of the North Face button on the controller.
112 *
113 * @param value the new value
114 */
115 void SetNorthFaceButton(bool value);
116
117 /**
118 * Change the value of the Back button on the controller.
119 *
120 * @param value the new value
121 */
122 void SetBackButton(bool value);
123
124 /**
125 * Change the value of the Guide button on the controller.
126 *
127 * @param value the new value
128 */
129 void SetGuideButton(bool value);
130
131 /**
132 * Change the value of the Start button on the controller.
133 *
134 * @param value the new value
135 */
136 void SetStartButton(bool value);
137
138 /**
139 * Change the value of the left stick button on the controller.
140 *
141 * @param value the new value
142 */
143 void SetLeftStickButton(bool value);
144
145 /**
146 * Change the value of the right stick button on the controller.
147 *
148 * @param value the new value
149 */
150 void SetRightStickButton(bool value);
151
152 /**
153 * Change the value of the right bumper button on the controller.
154 *
155 * @param value the new value
156 */
157 void SetLeftBumperButton(bool value);
158
159 /**
160 * Change the value of the right bumper button on the controller.
161 *
162 * @param value the new value
163 */
164 void SetRightBumperButton(bool value);
165
166 /**
167 * Change the value of the D-pad up button on the controller.
168 *
169 * @param value the new value
170 */
171 void SetDpadUpButton(bool value);
172
173 /**
174 * Change the value of the D-pad down button on the controller.
175 *
176 * @param value the new value
177 */
178 void SetDpadDownButton(bool value);
179
180 /**
181 * Change the value of the D-pad left button on the controller.
182 *
183 * @param value the new value
184 */
185 void SetDpadLeftButton(bool value);
186
187 /**
188 * Change the value of the D-pad right button on the controller.
189 *
190 * @param value the new value
191 */
192 void SetDpadRightButton(bool value);
193
194 /**
195 * Change the value of the Miscellaneous 1 button on the controller.
196 *
197 * @param value the new value
198 */
199 void SetMisc1Button(bool value);
200
201 /**
202 * Change the value of the Right Paddle 1 button on the controller.
203 *
204 * @param value the new value
205 */
206 void SetRightPaddle1Button(bool value);
207
208 /**
209 * Change the value of the Left Paddle 1 button on the controller.
210 *
211 * @param value the new value
212 */
213 void SetLeftPaddle1Button(bool value);
214
215 /**
216 * Change the value of the Right Paddle 2 button on the controller.
217 *
218 * @param value the new value
219 */
220 void SetRightPaddle2Button(bool value);
221
222 /**
223 * Change the value of the Left Paddle 2 button on the controller.
224 *
225 * @param value the new value
226 */
227 void SetLeftPaddle2Button(bool value);
228
229 /**
230 * Change the value of the Touchpad button on the controller.
231 *
232 * @param value the new value
233 */
234 void SetTouchpadButton(bool value);
235
236 /**
237 * Change the value of the Miscellaneous 2 button on the controller.
238 *
239 * @param value the new value
240 */
241 void SetMisc2Button(bool value);
242
243 /**
244 * Change the value of the Miscellaneous 3 button on the controller.
245 *
246 * @param value the new value
247 */
248 void SetMisc3Button(bool value);
249
250 /**
251 * Change the value of the Miscellaneous 4 button on the controller.
252 *
253 * @param value the new value
254 */
255 void SetMisc4Button(bool value);
256
257 /**
258 * Change the value of the Miscellaneous 5 button on the controller.
259 *
260 * @param value the new value
261 */
262 void SetMisc5Button(bool value);
263
264 /**
265 * Change the value of the Miscellaneous 6 button on the controller.
266 *
267 * @param value the new value
268 */
269 void SetMisc6Button(bool value);
270};
271
272} // namespace wpi::sim
Handle input from Gamepad controllers connected to the Driver Station.
Definition Gamepad.hpp:27
Button
Represents a digital button on an Gamepad.
Definition Gamepad.hpp:30
Axis
Represents an axis on an Gamepad.
Definition Gamepad.hpp:86
void SetLeftTriggerAxis(double value)
Change the value of the left trigger axis on the controller.
void SetDpadRightButton(bool value)
Change the value of the D-pad right button on the controller.
void SetDpadLeftButton(bool value)
Change the value of the D-pad left button on the controller.
void SetRightBumperButton(bool value)
Change the value of the right bumper button on the controller.
void SetBackButton(bool value)
Change the value of the Back button on the controller.
void SetDpadUpButton(bool value)
Change the value of the D-pad up button on the controller.
GamepadSim(const wpi::Gamepad &joystick)
Constructs from a Gamepad object.
void SetLeftBumperButton(bool value)
Change the value of the right bumper button on the controller.
void SetAxis(wpi::Gamepad::Axis axis, double value)
Set the value of a given axis.
void SetLeftPaddle2Button(bool value)
Change the value of the Left Paddle 2 button on the controller.
GamepadSim(int port)
Constructs from a joystick port number.
void SetMisc1Button(bool value)
Change the value of the Miscellaneous 1 button on the controller.
void SetMisc3Button(bool value)
Change the value of the Miscellaneous 3 button on the controller.
void SetTouchpadButton(bool value)
Change the value of the Touchpad button on the controller.
void SetLeftY(double value)
Change the left Y value of the controller's joystick.
void SetRightPaddle2Button(bool value)
Change the value of the Right Paddle 2 button on the controller.
void SetMisc5Button(bool value)
Change the value of the Miscellaneous 5 button on the controller.
void SetRightStickButton(bool value)
Change the value of the right stick button on the controller.
void SetSouthFaceButton(bool value)
Change the value of the South Face button on the controller.
void SetButton(wpi::Gamepad::Button button, bool value)
Set the value of a given button.
void SetRightY(double value)
Change the right Y value of the controller's joystick.
void SetLeftStickButton(bool value)
Change the value of the left stick button on the controller.
void SetMisc2Button(bool value)
Change the value of the Miscellaneous 2 button on the controller.
void SetRightPaddle1Button(bool value)
Change the value of the Right Paddle 1 button on the controller.
void SetEastFaceButton(bool value)
Change the value of the East Face button on the controller.
void SetWestFaceButton(bool value)
Change the value of the West Face button on the controller.
void SetMisc6Button(bool value)
Change the value of the Miscellaneous 6 button on the controller.
void SetDpadDownButton(bool value)
Change the value of the D-pad down button on the controller.
void SetNorthFaceButton(bool value)
Change the value of the North Face button on the controller.
void SetRightX(double value)
Change the right X value of the controller's joystick.
void SetGuideButton(bool value)
Change the value of the Guide button on the controller.
void SetMisc4Button(bool value)
Change the value of the Miscellaneous 4 button on the controller.
void SetLeftPaddle1Button(bool value)
Change the value of the Left Paddle 1 button on the controller.
void SetRightTriggerAxis(double value)
Change the value of the right trigger axis on the controller.
void SetLeftX(double value)
Change the left X value of the controller's joystick.
void SetStartButton(bool value)
Change the value of the Start button on the controller.
GenericHIDSim(const GenericHID &joystick)
Constructs from a GenericHID object.
Definition CTREPCMSim.hpp:13