WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
CommandNiDsXboxController.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::NiDsXboxController} with {@link Trigger} factories for
18 * command-based.
19 *
20 * @see wpi::NiDsXboxController
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 CommandNiDsXboxController(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 A 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 A button's
46 * digital signal attached to the given loop.
47 */
49 .GetDefaultButtonLoop()) const;
50
51 /**
52 * Constructs a Trigger instance around the B 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 B button's
58 * digital signal attached to the given loop.
59 */
61 .GetDefaultButtonLoop()) const;
62
63 /**
64 * Constructs a Trigger instance around the X 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 X button's
70 * digital signal attached to the given loop.
71 */
73 .GetDefaultButtonLoop()) const;
74
75 /**
76 * Constructs a Trigger instance around the Y 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 Y button's
82 * digital signal attached to the given loop.
83 */
85 .GetDefaultButtonLoop()) const;
86
87 /**
88 * Constructs a Trigger instance around the left bumper 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 bumper button's
94 * digital signal attached to the given loop.
95 */
97 .GetDefaultButtonLoop()) const;
98
99 /**
100 * Constructs a Trigger instance around the right bumper 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 bumper button's
106 * digital signal attached to the given loop.
107 */
109 .GetDefaultButtonLoop()) const;
110
111 /**
112 * Constructs a Trigger instance around the back 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 back button's
118 * digital signal attached to the given loop.
119 */
121 .GetDefaultButtonLoop()) const;
122
123 /**
124 * Constructs a Trigger instance around the start 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 start button's
130 * digital signal attached to the given loop.
131 */
133 .GetDefaultButtonLoop()) const;
134
135 /**
136 * Constructs a Trigger instance around the left stick 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 left stick button's
142 * digital signal attached to the given loop.
143 */
145 .GetDefaultButtonLoop()) const;
146
147 /**
148 * Constructs a Trigger instance around the right stick 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 right stick button's
154 * digital signal attached to the given loop.
155 */
157 .GetDefaultButtonLoop()) const;
158
159 /**
160 * Constructs a Trigger instance around the axis value of the left trigger.
161 * The returned Trigger will be true when the axis value is greater than
162 * {@code threshold}.
163 *
164 * @param threshold the minimum axis value for the returned Trigger to be
165 * true. This value should be in the range [0, 1] where 0 is the unpressed
166 * state of the axis. Defaults to 0.5.
167 * @param loop the event loop instance to attach the Trigger to. Defaults to
168 * the CommandScheduler's default loop.
169 * @return a Trigger instance that is true when the left trigger's axis
170 * exceeds the provided threshold, attached to the given loop
171 */
172 Trigger LeftTrigger(double threshold = 0.5,
174 .GetDefaultButtonLoop()) const;
175
176 /**
177 * Constructs a Trigger instance around the axis value of the right trigger.
178 * The returned Trigger will be true when the axis value is greater than
179 * {@code threshold}.
180 *
181 * @param threshold the minimum axis value for the returned Trigger to be
182 * true. This value should be in the range [0, 1] where 0 is the unpressed
183 * state of the axis. Defaults to 0.5.
184 * @param loop the event loop instance to attach the Trigger to. Defaults to
185 * the CommandScheduler's default loop.
186 * @return a Trigger instance that is true when the right trigger's axis
187 * exceeds the provided threshold, attached to the given loop
188 */
189 Trigger RightTrigger(double threshold = 0.5,
191 .GetDefaultButtonLoop()) const;
192
193 /**
194 * Get the X axis value of left side of the controller. Right is positive.
195 *
196 * @return The axis value.
197 */
198 double GetLeftX() const;
199
200 /**
201 * Get the X axis value of right side of the controller. Right is positive.
202 *
203 * @return The axis value.
204 */
205 double GetRightX() const;
206
207 /**
208 * Get the Y axis value of left side of the controller. Back is positive.
209 *
210 * @return The axis value.
211 */
212 double GetLeftY() const;
213
214 /**
215 * Get the Y axis value of right side of the controller. Back is positive.
216 *
217 * @return The axis value.
218 */
219 double GetRightY() const;
220
221 /**
222 * Get the left trigger axis value of the controller. Note that this axis is bound
223 * to the range of [0, 1] as opposed to the usual [-1, 1].
224 *
225 * @return The axis value.
226 */
227 double GetLeftTriggerAxis() const;
228
229 /**
230 * Get the right trigger axis value of the controller. Note that this axis is bound
231 * to the range of [0, 1] as opposed to the usual [-1, 1].
232 *
233 * @return The axis value.
234 */
235 double GetRightTriggerAxis() const;
236
237 private:
239};
240} // 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 NiDsXbox controllers connected to the Driver Station.
Definition NiDsXboxController.hpp:30
CommandGenericHID(int port)
Construct an instance of a device.
Trigger RightTrigger(double threshold=0.5, wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the axis value of the right trigger.
double GetRightTriggerAxis() const
Get the right trigger axis value of the controller.
double GetLeftX() const
Get the X axis value of left side of the controller.
double GetRightX() const
Get the X axis value of right side of the controller.
Trigger X(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the X button's digital signal.
Trigger Back(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the back button's digital signal.
CommandNiDsXboxController(int port)
Construct an instance of a controller.
wpi::NiDsXboxController & GetHID()
Get the underlying GenericHID object.
Trigger LeftTrigger(double threshold=0.5, wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the axis value of the left trigger.
double GetLeftY() const
Get the Y axis value of left side of the controller.
Trigger Y(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the Y button's digital signal.
Trigger LeftBumper(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the left bumper button's digital signal.
Trigger B(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the B button's digital signal.
Trigger LeftStick(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the left stick button's digital signal.
double GetLeftTriggerAxis() const
Get the left trigger axis value of the controller.
Trigger A(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the A button's digital signal.
double GetRightY() const
Get the Y axis value of right side of the controller.
Trigger RightStick(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the right stick button's digital signal.
Trigger RightBumper(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the right bumper button's digital signal.
Trigger Start(wpi::EventLoop *loop=CommandScheduler::GetInstance() .GetDefaultButtonLoop()) const
Constructs a Trigger instance around the start 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