WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
CommandNiDsPS4Controller.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// THIS FILE WAS AUTO-GENERATED BY ./commandsv2/generate_hids.py. DO NOT MODIFY
6
7#pragma once
8
10
14
15namespace wpi::cmd {
16/**
17 * A version of {@link wpi::NiDsPS4Controller} with {@link Trigger} factories for
18 * command-based.
19 *
20 * @see wpi::NiDsPS4Controller
21 */
23 public:
24 /**
25 * Construct an instance of a controller.
26 *
27 * @param port The port index on the Driver Station that the controller is
28 * plugged into.
29 */
30 explicit CommandNiDsPS4Controller(int port);
31
32 /**
33 * Get the underlying GenericHID object.
34 *
35 * @return the wrapped GenericHID object
36 */
38
39 /**
40 * Constructs a Trigger instance around the square button's
41 * digital signal.
42 *
43 * @param loop the event loop instance to attach the event to. Defaults to the
44 * CommandScheduler's default loop.
45 * @return a Trigger instance representing the square button's
46 * digital signal attached to the given loop.
47 */
49 .GetDefaultButtonLoop()) const;
50
51 /**
52 * Constructs a Trigger instance around the cross button's
53 * digital signal.
54 *
55 * @param loop the event loop instance to attach the event to. Defaults to the
56 * CommandScheduler's default loop.
57 * @return a Trigger instance representing the cross button's
58 * digital signal attached to the given loop.
59 */
61 .GetDefaultButtonLoop()) const;
62
63 /**
64 * Constructs a Trigger instance around the circle button's
65 * digital signal.
66 *
67 * @param loop the event loop instance to attach the event to. Defaults to the
68 * CommandScheduler's default loop.
69 * @return a Trigger instance representing the circle button's
70 * digital signal attached to the given loop.
71 */
73 .GetDefaultButtonLoop()) const;
74
75 /**
76 * Constructs a Trigger instance around the triangle button's
77 * digital signal.
78 *
79 * @param loop the event loop instance to attach the event to. Defaults to the
80 * CommandScheduler's default loop.
81 * @return a Trigger instance representing the triangle button's
82 * digital signal attached to the given loop.
83 */
85 .GetDefaultButtonLoop()) const;
86
87 /**
88 * Constructs a Trigger instance around the left trigger 1 button's
89 * digital signal.
90 *
91 * @param loop the event loop instance to attach the event to. Defaults to the
92 * CommandScheduler's default loop.
93 * @return a Trigger instance representing the left trigger 1 button's
94 * digital signal attached to the given loop.
95 */
97 .GetDefaultButtonLoop()) const;
98
99 /**
100 * Constructs a Trigger instance around the right trigger 1 button's
101 * digital signal.
102 *
103 * @param loop the event loop instance to attach the event to. Defaults to the
104 * CommandScheduler's default loop.
105 * @return a Trigger instance representing the right trigger 1 button's
106 * digital signal attached to the given loop.
107 */
109 .GetDefaultButtonLoop()) const;
110
111 /**
112 * Constructs a Trigger instance around the left trigger 2 button's
113 * digital signal.
114 *
115 * @param loop the event loop instance to attach the event to. Defaults to the
116 * CommandScheduler's default loop.
117 * @return a Trigger instance representing the left trigger 2 button's
118 * digital signal attached to the given loop.
119 */
121 .GetDefaultButtonLoop()) const;
122
123 /**
124 * Constructs a Trigger instance around the right trigger 2 button's
125 * digital signal.
126 *
127 * @param loop the event loop instance to attach the event to. Defaults to the
128 * CommandScheduler's default loop.
129 * @return a Trigger instance representing the right trigger 2 button's
130 * digital signal attached to the given loop.
131 */
133 .GetDefaultButtonLoop()) const;
134
135 /**
136 * Constructs a Trigger instance around the share button's
137 * digital signal.
138 *
139 * @param loop the event loop instance to attach the event to. Defaults to the
140 * CommandScheduler's default loop.
141 * @return a Trigger instance representing the share button's
142 * digital signal attached to the given loop.
143 */
145 .GetDefaultButtonLoop()) const;
146
147 /**
148 * Constructs a Trigger instance around the options button's
149 * digital signal.
150 *
151 * @param loop the event loop instance to attach the event to. Defaults to the
152 * CommandScheduler's default loop.
153 * @return a Trigger instance representing the options button's
154 * digital signal attached to the given loop.
155 */
157 .GetDefaultButtonLoop()) const;
158
159 /**
160 * Constructs a Trigger instance around the L3 (left stick) button's
161 * digital signal.
162 *
163 * @param loop the event loop instance to attach the event to. Defaults to the
164 * CommandScheduler's default loop.
165 * @return a Trigger instance representing the L3 (left stick) button's
166 * digital signal attached to the given loop.
167 */
169 .GetDefaultButtonLoop()) const;
170
171 /**
172 * Constructs a Trigger instance around the R3 (right stick) button's
173 * digital signal.
174 *
175 * @param loop the event loop instance to attach the event to. Defaults to the
176 * CommandScheduler's default loop.
177 * @return a Trigger instance representing the R3 (right stick) button's
178 * digital signal attached to the given loop.
179 */
181 .GetDefaultButtonLoop()) const;
182
183 /**
184 * Constructs a Trigger instance around the PlayStation button's
185 * digital signal.
186 *
187 * @param loop the event loop instance to attach the event to. Defaults to the
188 * CommandScheduler's default loop.
189 * @return a Trigger instance representing the PlayStation button's
190 * digital signal attached to the given loop.
191 */
193 .GetDefaultButtonLoop()) const;
194
195 /**
196 * Constructs a Trigger instance around the touchpad button's
197 * digital signal.
198 *
199 * @param loop the event loop instance to attach the event to. Defaults to the
200 * CommandScheduler's default loop.
201 * @return a Trigger instance representing the touchpad button's
202 * digital signal attached to the given loop.
203 */
205 .GetDefaultButtonLoop()) const;
206
207 /**
208 * Get the X axis value of left side of the controller. Right is positive.
209 *
210 * @return The axis value.
211 */
212 double GetLeftX() const;
213
214 /**
215 * Get the Y axis value of left side of the controller. Back is positive.
216 *
217 * @return The axis value.
218 */
219 double GetLeftY() const;
220
221 /**
222 * Get the X axis value of right side of the controller. Right is positive.
223 *
224 * @return The axis value.
225 */
226 double GetRightX() const;
227
228 /**
229 * Get the Y axis value of right side of the controller. Back is positive.
230 *
231 * @return The axis value.
232 */
233 double GetRightY() const;
234
235 /**
236 * Get the left trigger 2 axis value of the controller. Note that this axis is bound
237 * to the range of [0, 1] as opposed to the usual [-1, 1].
238 *
239 * @return The axis value.
240 */
241 double GetL2Axis() const;
242
243 /**
244 * Get the right trigger 2 axis value of the controller. Note that this axis is bound
245 * to the range of [0, 1] as opposed to the usual [-1, 1].
246 *
247 * @return The axis value.
248 */
249 double GetR2Axis() const;
250
251 private:
253};
254} // namespace wpi::cmd
A declarative way to bind a set of actions to a loop and execute them when the loop is polled.
Definition EventLoop.hpp:15
Handle input from NiDsPS4 controllers connected to the Driver Station.
Definition NiDsPS4Controller.hpp:30
CommandGenericHID(int port)
Construct an instance of a device.
Trigger Options(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the options button's digital signal.
Trigger L1(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the left trigger 1 button's digital signal.
Trigger Touchpad(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the touchpad button's digital signal.
CommandNiDsPS4Controller(int port)
Construct an instance of a controller.
Trigger Cross(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the cross button's digital signal.
Trigger R3(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the R3 (right stick) button's digital signal.
Trigger Square(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the square button's digital signal.
Trigger PS(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the PlayStation button's digital signal.
wpi::NiDsPS4Controller & GetHID()
Get the underlying GenericHID object.
Trigger R1(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the right trigger 1 button's digital signal.
double GetL2Axis() const
Get the left trigger 2 axis value of the controller.
Trigger Share(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the share button's digital signal.
double GetLeftX() const
Get the X axis value of left side of the controller.
double GetLeftY() const
Get the Y axis value of left side of the controller.
double GetRightX() const
Get the X axis value of right side of the controller.
Trigger R2(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the right trigger 2 button's digital signal.
Trigger L2(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the left trigger 2 button's digital signal.
double GetRightY() const
Get the Y axis value of right side of the controller.
Trigger L3(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the L3 (left stick) button's digital signal.
double GetR2Axis() const
Get the right trigger 2 axis value of the controller.
Trigger Triangle(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the triangle button's digital signal.
Trigger Circle(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the circle button's digital signal.
static CommandScheduler & GetInstance()
Returns the Scheduler instance.
This class provides an easy way to link commands to conditions.
Definition Trigger.hpp:31
Definition CommandNiDsStadiaController.hpp:15