001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005// THIS FILE WAS AUTO-GENERATED BY ./wpilibNewCommands/generate_hids.py. DO NOT MODIFY 006 007package edu.wpi.first.wpilibj2.command.button; 008 009import edu.wpi.first.wpilibj.StadiaController; 010import edu.wpi.first.wpilibj.event.EventLoop; 011import edu.wpi.first.wpilibj2.command.CommandScheduler; 012 013/** 014 * A version of {@link StadiaController} with {@link Trigger} factories for command-based. 015 * 016 * @see StadiaController 017 */ 018@SuppressWarnings("MethodName") 019public class CommandStadiaController extends CommandGenericHID { 020 private final StadiaController m_hid; 021 022 /** 023 * Construct an instance of a controller. 024 * 025 * @param port The port index on the Driver Station that the controller is plugged into. 026 */ 027 public CommandStadiaController(int port) { 028 super(port); 029 m_hid = new StadiaController(port); 030 } 031 032 /** 033 * Get the underlying GenericHID object. 034 * 035 * @return the wrapped GenericHID object 036 */ 037 @Override 038 public StadiaController getHID() { 039 return m_hid; 040 } 041 042 /** 043 * Constructs a Trigger instance around the A button's digital signal. 044 * 045 * @return a Trigger instance representing the A button's digital signal attached 046 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 047 * @see #a(EventLoop) 048 */ 049 public Trigger a() { 050 return a(CommandScheduler.getInstance().getDefaultButtonLoop()); 051 } 052 053 /** 054 * Constructs a Trigger instance around the A button's digital signal. 055 * 056 * @param loop the event loop instance to attach the event to. 057 * @return a Trigger instance representing the A button's digital signal attached 058 * to the given loop. 059 */ 060 public Trigger a(EventLoop loop) { 061 return button(StadiaController.Button.kA.value, loop); 062 } 063 064 /** 065 * Constructs a Trigger instance around the B button's digital signal. 066 * 067 * @return a Trigger instance representing the B button's digital signal attached 068 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 069 * @see #b(EventLoop) 070 */ 071 public Trigger b() { 072 return b(CommandScheduler.getInstance().getDefaultButtonLoop()); 073 } 074 075 /** 076 * Constructs a Trigger instance around the B button's digital signal. 077 * 078 * @param loop the event loop instance to attach the event to. 079 * @return a Trigger instance representing the B button's digital signal attached 080 * to the given loop. 081 */ 082 public Trigger b(EventLoop loop) { 083 return button(StadiaController.Button.kB.value, loop); 084 } 085 086 /** 087 * Constructs a Trigger instance around the X button's digital signal. 088 * 089 * @return a Trigger instance representing the X button's digital signal attached 090 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 091 * @see #x(EventLoop) 092 */ 093 public Trigger x() { 094 return x(CommandScheduler.getInstance().getDefaultButtonLoop()); 095 } 096 097 /** 098 * Constructs a Trigger instance around the X button's digital signal. 099 * 100 * @param loop the event loop instance to attach the event to. 101 * @return a Trigger instance representing the X button's digital signal attached 102 * to the given loop. 103 */ 104 public Trigger x(EventLoop loop) { 105 return button(StadiaController.Button.kX.value, loop); 106 } 107 108 /** 109 * Constructs a Trigger instance around the Y button's digital signal. 110 * 111 * @return a Trigger instance representing the Y button's digital signal attached 112 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 113 * @see #y(EventLoop) 114 */ 115 public Trigger y() { 116 return y(CommandScheduler.getInstance().getDefaultButtonLoop()); 117 } 118 119 /** 120 * Constructs a Trigger instance around the Y button's digital signal. 121 * 122 * @param loop the event loop instance to attach the event to. 123 * @return a Trigger instance representing the Y button's digital signal attached 124 * to the given loop. 125 */ 126 public Trigger y(EventLoop loop) { 127 return button(StadiaController.Button.kY.value, loop); 128 } 129 130 /** 131 * Constructs a Trigger instance around the left bumper button's digital signal. 132 * 133 * @return a Trigger instance representing the left bumper button's digital signal attached 134 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 135 * @see #leftBumper(EventLoop) 136 */ 137 public Trigger leftBumper() { 138 return leftBumper(CommandScheduler.getInstance().getDefaultButtonLoop()); 139 } 140 141 /** 142 * Constructs a Trigger instance around the left bumper button's digital signal. 143 * 144 * @param loop the event loop instance to attach the event to. 145 * @return a Trigger instance representing the left bumper button's digital signal attached 146 * to the given loop. 147 */ 148 public Trigger leftBumper(EventLoop loop) { 149 return button(StadiaController.Button.kLeftBumper.value, loop); 150 } 151 152 /** 153 * Constructs a Trigger instance around the right bumper button's digital signal. 154 * 155 * @return a Trigger instance representing the right bumper button's digital signal attached 156 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 157 * @see #rightBumper(EventLoop) 158 */ 159 public Trigger rightBumper() { 160 return rightBumper(CommandScheduler.getInstance().getDefaultButtonLoop()); 161 } 162 163 /** 164 * Constructs a Trigger instance around the right bumper button's digital signal. 165 * 166 * @param loop the event loop instance to attach the event to. 167 * @return a Trigger instance representing the right bumper button's digital signal attached 168 * to the given loop. 169 */ 170 public Trigger rightBumper(EventLoop loop) { 171 return button(StadiaController.Button.kRightBumper.value, loop); 172 } 173 174 /** 175 * Constructs a Trigger instance around the left stick button's digital signal. 176 * 177 * @return a Trigger instance representing the left stick button's digital signal attached 178 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 179 * @see #leftStick(EventLoop) 180 */ 181 public Trigger leftStick() { 182 return leftStick(CommandScheduler.getInstance().getDefaultButtonLoop()); 183 } 184 185 /** 186 * Constructs a Trigger instance around the left stick button's digital signal. 187 * 188 * @param loop the event loop instance to attach the event to. 189 * @return a Trigger instance representing the left stick button's digital signal attached 190 * to the given loop. 191 */ 192 public Trigger leftStick(EventLoop loop) { 193 return button(StadiaController.Button.kLeftStick.value, loop); 194 } 195 196 /** 197 * Constructs a Trigger instance around the right stick button's digital signal. 198 * 199 * @return a Trigger instance representing the right stick button's digital signal attached 200 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 201 * @see #rightStick(EventLoop) 202 */ 203 public Trigger rightStick() { 204 return rightStick(CommandScheduler.getInstance().getDefaultButtonLoop()); 205 } 206 207 /** 208 * Constructs a Trigger instance around the right stick button's digital signal. 209 * 210 * @param loop the event loop instance to attach the event to. 211 * @return a Trigger instance representing the right stick button's digital signal attached 212 * to the given loop. 213 */ 214 public Trigger rightStick(EventLoop loop) { 215 return button(StadiaController.Button.kRightStick.value, loop); 216 } 217 218 /** 219 * Constructs a Trigger instance around the ellipses button's digital signal. 220 * 221 * @return a Trigger instance representing the ellipses button's digital signal attached 222 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 223 * @see #ellipses(EventLoop) 224 */ 225 public Trigger ellipses() { 226 return ellipses(CommandScheduler.getInstance().getDefaultButtonLoop()); 227 } 228 229 /** 230 * Constructs a Trigger instance around the ellipses button's digital signal. 231 * 232 * @param loop the event loop instance to attach the event to. 233 * @return a Trigger instance representing the ellipses button's digital signal attached 234 * to the given loop. 235 */ 236 public Trigger ellipses(EventLoop loop) { 237 return button(StadiaController.Button.kEllipses.value, loop); 238 } 239 240 /** 241 * Constructs a Trigger instance around the hamburger button's digital signal. 242 * 243 * @return a Trigger instance representing the hamburger button's digital signal attached 244 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 245 * @see #hamburger(EventLoop) 246 */ 247 public Trigger hamburger() { 248 return hamburger(CommandScheduler.getInstance().getDefaultButtonLoop()); 249 } 250 251 /** 252 * Constructs a Trigger instance around the hamburger button's digital signal. 253 * 254 * @param loop the event loop instance to attach the event to. 255 * @return a Trigger instance representing the hamburger button's digital signal attached 256 * to the given loop. 257 */ 258 public Trigger hamburger(EventLoop loop) { 259 return button(StadiaController.Button.kHamburger.value, loop); 260 } 261 262 /** 263 * Constructs a Trigger instance around the stadia button's digital signal. 264 * 265 * @return a Trigger instance representing the stadia button's digital signal attached 266 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 267 * @see #stadia(EventLoop) 268 */ 269 public Trigger stadia() { 270 return stadia(CommandScheduler.getInstance().getDefaultButtonLoop()); 271 } 272 273 /** 274 * Constructs a Trigger instance around the stadia button's digital signal. 275 * 276 * @param loop the event loop instance to attach the event to. 277 * @return a Trigger instance representing the stadia button's digital signal attached 278 * to the given loop. 279 */ 280 public Trigger stadia(EventLoop loop) { 281 return button(StadiaController.Button.kStadia.value, loop); 282 } 283 284 /** 285 * Constructs a Trigger instance around the right trigger button's digital signal. 286 * 287 * @return a Trigger instance representing the right trigger button's digital signal attached 288 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 289 * @see #rightTrigger(EventLoop) 290 */ 291 public Trigger rightTrigger() { 292 return rightTrigger(CommandScheduler.getInstance().getDefaultButtonLoop()); 293 } 294 295 /** 296 * Constructs a Trigger instance around the right trigger button's digital signal. 297 * 298 * @param loop the event loop instance to attach the event to. 299 * @return a Trigger instance representing the right trigger button's digital signal attached 300 * to the given loop. 301 */ 302 public Trigger rightTrigger(EventLoop loop) { 303 return button(StadiaController.Button.kRightTrigger.value, loop); 304 } 305 306 /** 307 * Constructs a Trigger instance around the left trigger button's digital signal. 308 * 309 * @return a Trigger instance representing the left trigger button's digital signal attached 310 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 311 * @see #leftTrigger(EventLoop) 312 */ 313 public Trigger leftTrigger() { 314 return leftTrigger(CommandScheduler.getInstance().getDefaultButtonLoop()); 315 } 316 317 /** 318 * Constructs a Trigger instance around the left trigger button's digital signal. 319 * 320 * @param loop the event loop instance to attach the event to. 321 * @return a Trigger instance representing the left trigger button's digital signal attached 322 * to the given loop. 323 */ 324 public Trigger leftTrigger(EventLoop loop) { 325 return button(StadiaController.Button.kLeftTrigger.value, loop); 326 } 327 328 /** 329 * Constructs a Trigger instance around the google button's digital signal. 330 * 331 * @return a Trigger instance representing the google button's digital signal attached 332 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 333 * @see #google(EventLoop) 334 */ 335 public Trigger google() { 336 return google(CommandScheduler.getInstance().getDefaultButtonLoop()); 337 } 338 339 /** 340 * Constructs a Trigger instance around the google button's digital signal. 341 * 342 * @param loop the event loop instance to attach the event to. 343 * @return a Trigger instance representing the google button's digital signal attached 344 * to the given loop. 345 */ 346 public Trigger google(EventLoop loop) { 347 return button(StadiaController.Button.kGoogle.value, loop); 348 } 349 350 /** 351 * Constructs a Trigger instance around the frame button's digital signal. 352 * 353 * @return a Trigger instance representing the frame button's digital signal attached 354 * to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}. 355 * @see #frame(EventLoop) 356 */ 357 public Trigger frame() { 358 return frame(CommandScheduler.getInstance().getDefaultButtonLoop()); 359 } 360 361 /** 362 * Constructs a Trigger instance around the frame button's digital signal. 363 * 364 * @param loop the event loop instance to attach the event to. 365 * @return a Trigger instance representing the frame button's digital signal attached 366 * to the given loop. 367 */ 368 public Trigger frame(EventLoop loop) { 369 return button(StadiaController.Button.kFrame.value, loop); 370 } 371 372 /** 373 * Get the X axis value of left side of the controller. Right is positive. 374 * 375 * @return The axis value. 376 */ 377 public double getLeftX() { 378 return m_hid.getLeftX(); 379 } 380 381 /** 382 * Get the X axis value of right side of the controller. Right is positive. 383 * 384 * @return The axis value. 385 */ 386 public double getRightX() { 387 return m_hid.getRightX(); 388 } 389 390 /** 391 * Get the Y axis value of left side of the controller. Back is positive. 392 * 393 * @return The axis value. 394 */ 395 public double getLeftY() { 396 return m_hid.getLeftY(); 397 } 398 399 /** 400 * Get the Y axis value of right side of the controller. Back is positive. 401 * 402 * @return The axis value. 403 */ 404 public double getRightY() { 405 return m_hid.getRightY(); 406 } 407}