mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[wpilib,cmd] Add expanded game controller list (#8959)
Extension of #8957
This commit is contained in:
733
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandDualSenseEdgeController.java
generated
Normal file
733
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandDualSenseEdgeController.java
generated
Normal file
@@ -0,0 +1,733 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./commandsv3/generate_files.py. DO NOT MODIFY
|
||||
|
||||
package org.wpilib.command3.button;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.wpilib.command3.Scheduler;
|
||||
import org.wpilib.command3.Trigger;
|
||||
import org.wpilib.driverstation.DualSenseEdgeController;
|
||||
import org.wpilib.event.EventLoop;
|
||||
|
||||
/**
|
||||
* A version of {@link DualSenseEdgeController} with {@link Trigger} factories for command-based.
|
||||
*
|
||||
* @see DualSenseEdgeController
|
||||
*/
|
||||
@SuppressWarnings("MethodName")
|
||||
public class CommandDualSenseEdgeController {
|
||||
private final CommandGenericHID m_hid;
|
||||
private final DualSenseEdgeController m_controller;
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandDualSenseEdgeController(int port) {
|
||||
this(Scheduler.getDefault(), port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param controller The DualSenseEdgeController object to use for this controller.
|
||||
*/
|
||||
public CommandDualSenseEdgeController(DualSenseEdgeController controller) {
|
||||
this(Scheduler.getDefault(), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandDualSenseEdgeController(Scheduler scheduler, int port) {
|
||||
m_hid = CommandGenericHID.getCommandGenericHID(scheduler, port);
|
||||
m_controller = new DualSenseEdgeController(m_hid.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param controller The DualSenseEdgeController object to use for this controller.
|
||||
*/
|
||||
public CommandDualSenseEdgeController(Scheduler scheduler, DualSenseEdgeController controller) {
|
||||
m_controller =
|
||||
Objects.requireNonNull(controller, "Provided DualSenseEdgeController cannot be null");
|
||||
m_hid = new CommandGenericHID(scheduler, m_controller.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying CommandGenericHID object.
|
||||
*
|
||||
* @return the wrapped CommandGenericHID object
|
||||
*/
|
||||
public CommandGenericHID getHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the wrapped controller object.
|
||||
*
|
||||
* @return the wrapped controller object
|
||||
*/
|
||||
public DualSenseEdgeController getController() {
|
||||
return m_controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Cross button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Cross button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #cross(EventLoop)
|
||||
*/
|
||||
public Trigger cross() {
|
||||
return cross(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Cross button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Cross button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger cross(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.CROSS.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Circle button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Circle button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #circle(EventLoop)
|
||||
*/
|
||||
public Trigger circle() {
|
||||
return circle(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Circle button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Circle button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger circle(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.CIRCLE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Square button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Square button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #square(EventLoop)
|
||||
*/
|
||||
public Trigger square() {
|
||||
return square(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Square button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Square button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger square(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.SQUARE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Triangle button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Triangle button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #triangle(EventLoop)
|
||||
*/
|
||||
public Trigger triangle() {
|
||||
return triangle(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Triangle button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Triangle button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger triangle(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.TRIANGLE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Create button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Create button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #create(EventLoop)
|
||||
*/
|
||||
public Trigger create() {
|
||||
return create(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Create button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Create button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger create(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.CREATE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the PS button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the PS button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #PS(EventLoop)
|
||||
*/
|
||||
public Trigger PS() {
|
||||
return PS(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the PS button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the PS button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger PS(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.PS.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Options button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Options button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #options(EventLoop)
|
||||
*/
|
||||
public Trigger options() {
|
||||
return options(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Options button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Options button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger options(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.OPTIONS.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L 3 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the L 3 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #L3(EventLoop)
|
||||
*/
|
||||
public Trigger L3() {
|
||||
return L3(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L 3 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the L 3 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger L3(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.L3.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R 3 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the R 3 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #R3(EventLoop)
|
||||
*/
|
||||
public Trigger R3() {
|
||||
return R3(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R 3 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the R 3 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger R3(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.R3.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L 1 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the L 1 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #L1(EventLoop)
|
||||
*/
|
||||
public Trigger L1() {
|
||||
return L1(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L 1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the L 1 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger L1(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.L1.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R 1 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the R 1 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #R1(EventLoop)
|
||||
*/
|
||||
public Trigger R1() {
|
||||
return R1(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R 1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the R 1 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger R1(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.R1.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadUp(EventLoop)
|
||||
*/
|
||||
public Trigger dpadUp() {
|
||||
return dpadUp(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadUp(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.DPAD_UP.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadDown(EventLoop)
|
||||
*/
|
||||
public Trigger dpadDown() {
|
||||
return dpadDown(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadDown(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.DPAD_DOWN.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadLeft(EventLoop)
|
||||
*/
|
||||
public Trigger dpadLeft() {
|
||||
return dpadLeft(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadLeft(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.DPAD_LEFT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadRight(EventLoop)
|
||||
*/
|
||||
public Trigger dpadRight() {
|
||||
return dpadRight(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadRight(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.DPAD_RIGHT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Microphone button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Microphone button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #microphone(EventLoop)
|
||||
*/
|
||||
public Trigger microphone() {
|
||||
return microphone(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Microphone button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Microphone button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger microphone(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.MICROPHONE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Paddle 1 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Right Paddle 1 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightPaddle1(EventLoop)
|
||||
*/
|
||||
public Trigger rightPaddle1() {
|
||||
return rightPaddle1(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Paddle 1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Right Paddle 1 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger rightPaddle1(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.RIGHT_PADDLE_1.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Paddle 1 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Left Paddle 1 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftPaddle1(EventLoop)
|
||||
*/
|
||||
public Trigger leftPaddle1() {
|
||||
return leftPaddle1(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Paddle 1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Left Paddle 1 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger leftPaddle1(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.LEFT_PADDLE_1.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Touchpad button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Touchpad button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #touchpad(EventLoop)
|
||||
*/
|
||||
public Trigger touchpad() {
|
||||
return touchpad(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Touchpad button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Touchpad button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger touchpad(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.TOUCHPAD.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Function button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Left Function button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftFunction(EventLoop)
|
||||
*/
|
||||
public Trigger leftFunction() {
|
||||
return leftFunction(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Function button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Left Function button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger leftFunction(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.LEFT_FUNCTION.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Function button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Right Function button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightFunction(EventLoop)
|
||||
*/
|
||||
public Trigger rightFunction() {
|
||||
return rightFunction(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Function button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Right Function button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger rightFunction(EventLoop loop) {
|
||||
return m_hid.button(DualSenseEdgeController.Button.RIGHT_FUNCTION.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the L 2. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the L 2 axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger L2(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
DualSenseEdgeController.Axis.L2.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the L 2. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the L 2 axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger L2(double threshold) {
|
||||
return L2(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the L 2. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the L 2 axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger L2() {
|
||||
return L2(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the R 2. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the R 2 axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger R2(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
DualSenseEdgeController.Axis.R2.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the R 2. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the R 2 axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger R2(double threshold) {
|
||||
return R2(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the R 2. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the R 2 axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger R2() {
|
||||
return R2(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftX() {
|
||||
return m_controller.getLeftX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftY() {
|
||||
return m_controller.getLeftY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightX() {
|
||||
return m_controller.getRightX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightY() {
|
||||
return m_controller.getRightY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the L 2 value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getL2() {
|
||||
return m_controller.getL2();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the R 2 value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getR2() {
|
||||
return m_controller.getR2();
|
||||
}
|
||||
}
|
||||
613
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandDualShock4Controller.java
generated
Normal file
613
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandDualShock4Controller.java
generated
Normal file
@@ -0,0 +1,613 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./commandsv3/generate_files.py. DO NOT MODIFY
|
||||
|
||||
package org.wpilib.command3.button;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.wpilib.command3.Scheduler;
|
||||
import org.wpilib.command3.Trigger;
|
||||
import org.wpilib.driverstation.DualShock4Controller;
|
||||
import org.wpilib.event.EventLoop;
|
||||
|
||||
/**
|
||||
* A version of {@link DualShock4Controller} with {@link Trigger} factories for command-based.
|
||||
*
|
||||
* @see DualShock4Controller
|
||||
*/
|
||||
@SuppressWarnings("MethodName")
|
||||
public class CommandDualShock4Controller {
|
||||
private final CommandGenericHID m_hid;
|
||||
private final DualShock4Controller m_controller;
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandDualShock4Controller(int port) {
|
||||
this(Scheduler.getDefault(), port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param controller The DualShock4Controller object to use for this controller.
|
||||
*/
|
||||
public CommandDualShock4Controller(DualShock4Controller controller) {
|
||||
this(Scheduler.getDefault(), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandDualShock4Controller(Scheduler scheduler, int port) {
|
||||
m_hid = CommandGenericHID.getCommandGenericHID(scheduler, port);
|
||||
m_controller = new DualShock4Controller(m_hid.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param controller The DualShock4Controller object to use for this controller.
|
||||
*/
|
||||
public CommandDualShock4Controller(Scheduler scheduler, DualShock4Controller controller) {
|
||||
m_controller =
|
||||
Objects.requireNonNull(controller, "Provided DualShock4Controller cannot be null");
|
||||
m_hid = new CommandGenericHID(scheduler, m_controller.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying CommandGenericHID object.
|
||||
*
|
||||
* @return the wrapped CommandGenericHID object
|
||||
*/
|
||||
public CommandGenericHID getHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the wrapped controller object.
|
||||
*
|
||||
* @return the wrapped controller object
|
||||
*/
|
||||
public DualShock4Controller getController() {
|
||||
return m_controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Cross button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Cross button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #cross(EventLoop)
|
||||
*/
|
||||
public Trigger cross() {
|
||||
return cross(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Cross button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Cross button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger cross(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.CROSS.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Circle button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Circle button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #circle(EventLoop)
|
||||
*/
|
||||
public Trigger circle() {
|
||||
return circle(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Circle button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Circle button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger circle(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.CIRCLE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Square button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Square button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #square(EventLoop)
|
||||
*/
|
||||
public Trigger square() {
|
||||
return square(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Square button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Square button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger square(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.SQUARE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Triangle button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Triangle button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #triangle(EventLoop)
|
||||
*/
|
||||
public Trigger triangle() {
|
||||
return triangle(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Triangle button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Triangle button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger triangle(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.TRIANGLE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Share button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Share button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #share(EventLoop)
|
||||
*/
|
||||
public Trigger share() {
|
||||
return share(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Share button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Share button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger share(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.SHARE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the PS button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the PS button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #PS(EventLoop)
|
||||
*/
|
||||
public Trigger PS() {
|
||||
return PS(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the PS button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the PS button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger PS(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.PS.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Options button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Options button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #options(EventLoop)
|
||||
*/
|
||||
public Trigger options() {
|
||||
return options(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Options button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Options button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger options(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.OPTIONS.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L 3 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the L 3 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #L3(EventLoop)
|
||||
*/
|
||||
public Trigger L3() {
|
||||
return L3(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L 3 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the L 3 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger L3(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.L3.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R 3 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the R 3 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #R3(EventLoop)
|
||||
*/
|
||||
public Trigger R3() {
|
||||
return R3(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R 3 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the R 3 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger R3(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.R3.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L 1 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the L 1 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #L1(EventLoop)
|
||||
*/
|
||||
public Trigger L1() {
|
||||
return L1(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L 1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the L 1 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger L1(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.L1.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R 1 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the R 1 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #R1(EventLoop)
|
||||
*/
|
||||
public Trigger R1() {
|
||||
return R1(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R 1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the R 1 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger R1(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.R1.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadUp(EventLoop)
|
||||
*/
|
||||
public Trigger dpadUp() {
|
||||
return dpadUp(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadUp(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.DPAD_UP.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadDown(EventLoop)
|
||||
*/
|
||||
public Trigger dpadDown() {
|
||||
return dpadDown(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadDown(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.DPAD_DOWN.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadLeft(EventLoop)
|
||||
*/
|
||||
public Trigger dpadLeft() {
|
||||
return dpadLeft(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadLeft(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.DPAD_LEFT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadRight(EventLoop)
|
||||
*/
|
||||
public Trigger dpadRight() {
|
||||
return dpadRight(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadRight(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.DPAD_RIGHT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Touchpad button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Touchpad button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #touchpad(EventLoop)
|
||||
*/
|
||||
public Trigger touchpad() {
|
||||
return touchpad(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Touchpad button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Touchpad button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger touchpad(EventLoop loop) {
|
||||
return m_hid.button(DualShock4Controller.Button.TOUCHPAD.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the L 2. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the L 2 axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger L2(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
DualShock4Controller.Axis.L2.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the L 2. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the L 2 axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger L2(double threshold) {
|
||||
return L2(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the L 2. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the L 2 axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger L2() {
|
||||
return L2(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the R 2. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the R 2 axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger R2(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
DualShock4Controller.Axis.R2.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the R 2. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the R 2 axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger R2(double threshold) {
|
||||
return R2(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the R 2. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the R 2 axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger R2() {
|
||||
return R2(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftX() {
|
||||
return m_controller.getLeftX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftY() {
|
||||
return m_controller.getLeftY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightX() {
|
||||
return m_controller.getRightX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightY() {
|
||||
return m_controller.getRightY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the L 2 value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getL2() {
|
||||
return m_controller.getL2();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the R 2 value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getR2() {
|
||||
return m_controller.getR2();
|
||||
}
|
||||
}
|
||||
517
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandGameCubeController.java
generated
Normal file
517
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandGameCubeController.java
generated
Normal file
@@ -0,0 +1,517 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./commandsv3/generate_files.py. DO NOT MODIFY
|
||||
|
||||
package org.wpilib.command3.button;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.wpilib.command3.Scheduler;
|
||||
import org.wpilib.command3.Trigger;
|
||||
import org.wpilib.driverstation.GameCubeController;
|
||||
import org.wpilib.event.EventLoop;
|
||||
|
||||
/**
|
||||
* A version of {@link GameCubeController} with {@link Trigger} factories for command-based.
|
||||
*
|
||||
* @see GameCubeController
|
||||
*/
|
||||
@SuppressWarnings("MethodName")
|
||||
public class CommandGameCubeController {
|
||||
private final CommandGenericHID m_hid;
|
||||
private final GameCubeController m_controller;
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandGameCubeController(int port) {
|
||||
this(Scheduler.getDefault(), port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param controller The GameCubeController object to use for this controller.
|
||||
*/
|
||||
public CommandGameCubeController(GameCubeController controller) {
|
||||
this(Scheduler.getDefault(), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandGameCubeController(Scheduler scheduler, int port) {
|
||||
m_hid = CommandGenericHID.getCommandGenericHID(scheduler, port);
|
||||
m_controller = new GameCubeController(m_hid.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param controller The GameCubeController object to use for this controller.
|
||||
*/
|
||||
public CommandGameCubeController(Scheduler scheduler, GameCubeController controller) {
|
||||
m_controller =
|
||||
Objects.requireNonNull(controller, "Provided GameCubeController cannot be null");
|
||||
m_hid = new CommandGenericHID(scheduler, m_controller.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying CommandGenericHID object.
|
||||
*
|
||||
* @return the wrapped CommandGenericHID object
|
||||
*/
|
||||
public CommandGenericHID getHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the wrapped controller object.
|
||||
*
|
||||
* @return the wrapped controller object
|
||||
*/
|
||||
public GameCubeController getController() {
|
||||
return m_controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #a(EventLoop)
|
||||
*/
|
||||
public Trigger a() {
|
||||
return a(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger a(EventLoop loop) {
|
||||
return m_hid.button(GameCubeController.Button.A.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the X button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the X button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #x(EventLoop)
|
||||
*/
|
||||
public Trigger x() {
|
||||
return x(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the X button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the X button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger x(EventLoop loop) {
|
||||
return m_hid.button(GameCubeController.Button.X.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #b(EventLoop)
|
||||
*/
|
||||
public Trigger b() {
|
||||
return b(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger b(EventLoop loop) {
|
||||
return m_hid.button(GameCubeController.Button.B.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Y button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Y button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #y(EventLoop)
|
||||
*/
|
||||
public Trigger y() {
|
||||
return y(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Y button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Y button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger y(EventLoop loop) {
|
||||
return m_hid.button(GameCubeController.Button.Y.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Start button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Start button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #start(EventLoop)
|
||||
*/
|
||||
public Trigger start() {
|
||||
return start(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Start button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Start button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger start(EventLoop loop) {
|
||||
return m_hid.button(GameCubeController.Button.START.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Z button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Z button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #Z(EventLoop)
|
||||
*/
|
||||
public Trigger Z() {
|
||||
return Z(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Z button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Z button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger Z(EventLoop loop) {
|
||||
return m_hid.button(GameCubeController.Button.Z.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadUp(EventLoop)
|
||||
*/
|
||||
public Trigger dpadUp() {
|
||||
return dpadUp(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadUp(EventLoop loop) {
|
||||
return m_hid.button(GameCubeController.Button.DPAD_UP.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadDown(EventLoop)
|
||||
*/
|
||||
public Trigger dpadDown() {
|
||||
return dpadDown(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadDown(EventLoop loop) {
|
||||
return m_hid.button(GameCubeController.Button.DPAD_DOWN.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadLeft(EventLoop)
|
||||
*/
|
||||
public Trigger dpadLeft() {
|
||||
return dpadLeft(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadLeft(EventLoop loop) {
|
||||
return m_hid.button(GameCubeController.Button.DPAD_LEFT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadRight(EventLoop)
|
||||
*/
|
||||
public Trigger dpadRight() {
|
||||
return dpadRight(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadRight(EventLoop loop) {
|
||||
return m_hid.button(GameCubeController.Button.DPAD_RIGHT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the L button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #L(EventLoop)
|
||||
*/
|
||||
public Trigger L() {
|
||||
return L(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the L button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger L(EventLoop loop) {
|
||||
return m_hid.button(GameCubeController.Button.L.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the R button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #R(EventLoop)
|
||||
*/
|
||||
public Trigger R() {
|
||||
return R(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the R button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger R(EventLoop loop) {
|
||||
return m_hid.button(GameCubeController.Button.R.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the L Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the L Trigger axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger LTrigger(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
GameCubeController.Axis.L_TRIGGER.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the L Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the L Trigger axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger LTrigger(double threshold) {
|
||||
return LTrigger(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the L Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the L Trigger axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger LTrigger() {
|
||||
return LTrigger(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the R Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the R Trigger axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger RTrigger(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
GameCubeController.Axis.R_TRIGGER.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the R Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the R Trigger axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger RTrigger(double threshold) {
|
||||
return RTrigger(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the R Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the R Trigger axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger RTrigger() {
|
||||
return RTrigger(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftX() {
|
||||
return m_controller.getLeftX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftY() {
|
||||
return m_controller.getLeftY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the C Stick X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getCStickX() {
|
||||
return m_controller.getCStickX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the C Stick Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getCStickY() {
|
||||
return m_controller.getCStickY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the L Trigger value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLTrigger() {
|
||||
return m_controller.getLTrigger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the R Trigger value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRTrigger() {
|
||||
return m_controller.getRTrigger();
|
||||
}
|
||||
}
|
||||
589
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandLogitechF310Controller.java
generated
Normal file
589
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandLogitechF310Controller.java
generated
Normal file
@@ -0,0 +1,589 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./commandsv3/generate_files.py. DO NOT MODIFY
|
||||
|
||||
package org.wpilib.command3.button;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.wpilib.command3.Scheduler;
|
||||
import org.wpilib.command3.Trigger;
|
||||
import org.wpilib.driverstation.LogitechF310Controller;
|
||||
import org.wpilib.event.EventLoop;
|
||||
|
||||
/**
|
||||
* A version of {@link LogitechF310Controller} with {@link Trigger} factories for command-based.
|
||||
*
|
||||
* @see LogitechF310Controller
|
||||
*/
|
||||
@SuppressWarnings("MethodName")
|
||||
public class CommandLogitechF310Controller {
|
||||
private final CommandGenericHID m_hid;
|
||||
private final LogitechF310Controller m_controller;
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandLogitechF310Controller(int port) {
|
||||
this(Scheduler.getDefault(), port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param controller The LogitechF310Controller object to use for this controller.
|
||||
*/
|
||||
public CommandLogitechF310Controller(LogitechF310Controller controller) {
|
||||
this(Scheduler.getDefault(), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandLogitechF310Controller(Scheduler scheduler, int port) {
|
||||
m_hid = CommandGenericHID.getCommandGenericHID(scheduler, port);
|
||||
m_controller = new LogitechF310Controller(m_hid.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param controller The LogitechF310Controller object to use for this controller.
|
||||
*/
|
||||
public CommandLogitechF310Controller(Scheduler scheduler, LogitechF310Controller controller) {
|
||||
m_controller =
|
||||
Objects.requireNonNull(controller, "Provided LogitechF310Controller cannot be null");
|
||||
m_hid = new CommandGenericHID(scheduler, m_controller.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying CommandGenericHID object.
|
||||
*
|
||||
* @return the wrapped CommandGenericHID object
|
||||
*/
|
||||
public CommandGenericHID getHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the wrapped controller object.
|
||||
*
|
||||
* @return the wrapped controller object
|
||||
*/
|
||||
public LogitechF310Controller getController() {
|
||||
return m_controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #a(EventLoop)
|
||||
*/
|
||||
public Trigger a() {
|
||||
return a(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger a(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.A.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #b(EventLoop)
|
||||
*/
|
||||
public Trigger b() {
|
||||
return b(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger b(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.B.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the X button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the X button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #x(EventLoop)
|
||||
*/
|
||||
public Trigger x() {
|
||||
return x(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the X button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the X button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger x(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.X.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Y button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Y button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #y(EventLoop)
|
||||
*/
|
||||
public Trigger y() {
|
||||
return y(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Y button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Y button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger y(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.Y.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Back button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Back button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #back(EventLoop)
|
||||
*/
|
||||
public Trigger back() {
|
||||
return back(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Back button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Back button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger back(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.BACK.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Logitech button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Logitech button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #logitech(EventLoop)
|
||||
*/
|
||||
public Trigger logitech() {
|
||||
return logitech(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Logitech button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Logitech button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger logitech(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.LOGITECH.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Start button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Start button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #start(EventLoop)
|
||||
*/
|
||||
public Trigger start() {
|
||||
return start(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Start button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Start button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger start(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.START.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Stick button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Left Stick button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftStick(EventLoop)
|
||||
*/
|
||||
public Trigger leftStick() {
|
||||
return leftStick(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Stick button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Left Stick button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger leftStick(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.LEFT_STICK.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Stick button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Right Stick button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightStick(EventLoop)
|
||||
*/
|
||||
public Trigger rightStick() {
|
||||
return rightStick(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Stick button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Right Stick button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger rightStick(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.RIGHT_STICK.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Bumper button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Left Bumper button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftBumper(EventLoop)
|
||||
*/
|
||||
public Trigger leftBumper() {
|
||||
return leftBumper(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Left Bumper button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger leftBumper(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.LEFT_BUMPER.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Bumper button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Right Bumper button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightBumper(EventLoop)
|
||||
*/
|
||||
public Trigger rightBumper() {
|
||||
return rightBumper(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Right Bumper button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger rightBumper(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.RIGHT_BUMPER.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadUp(EventLoop)
|
||||
*/
|
||||
public Trigger dpadUp() {
|
||||
return dpadUp(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadUp(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.DPAD_UP.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadDown(EventLoop)
|
||||
*/
|
||||
public Trigger dpadDown() {
|
||||
return dpadDown(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadDown(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.DPAD_DOWN.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadLeft(EventLoop)
|
||||
*/
|
||||
public Trigger dpadLeft() {
|
||||
return dpadLeft(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadLeft(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.DPAD_LEFT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadRight(EventLoop)
|
||||
*/
|
||||
public Trigger dpadRight() {
|
||||
return dpadRight(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadRight(EventLoop loop) {
|
||||
return m_hid.button(LogitechF310Controller.Button.DPAD_RIGHT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the Left Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the Left Trigger axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger leftTrigger(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
LogitechF310Controller.Axis.LEFT_TRIGGER.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the Left Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the Left Trigger axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger leftTrigger(double threshold) {
|
||||
return leftTrigger(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the Left Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the Left Trigger axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger leftTrigger() {
|
||||
return leftTrigger(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the Right Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the Right Trigger axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger rightTrigger(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
LogitechF310Controller.Axis.RIGHT_TRIGGER.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the Right Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the Right Trigger axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger rightTrigger(double threshold) {
|
||||
return rightTrigger(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the Right Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the Right Trigger axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger rightTrigger() {
|
||||
return rightTrigger(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftX() {
|
||||
return m_controller.getLeftX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftY() {
|
||||
return m_controller.getLeftY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightX() {
|
||||
return m_controller.getRightX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightY() {
|
||||
return m_controller.getRightY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left Trigger value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftTrigger() {
|
||||
return m_controller.getLeftTrigger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right Trigger value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightTrigger() {
|
||||
return m_controller.getRightTrigger();
|
||||
}
|
||||
}
|
||||
853
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandSteamController.java
generated
Normal file
853
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandSteamController.java
generated
Normal file
@@ -0,0 +1,853 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./commandsv3/generate_files.py. DO NOT MODIFY
|
||||
|
||||
package org.wpilib.command3.button;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.wpilib.command3.Scheduler;
|
||||
import org.wpilib.command3.Trigger;
|
||||
import org.wpilib.driverstation.SteamController;
|
||||
import org.wpilib.event.EventLoop;
|
||||
|
||||
/**
|
||||
* A version of {@link SteamController} with {@link Trigger} factories for command-based.
|
||||
*
|
||||
* @see SteamController
|
||||
*/
|
||||
@SuppressWarnings("MethodName")
|
||||
public class CommandSteamController {
|
||||
private final CommandGenericHID m_hid;
|
||||
private final SteamController m_controller;
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandSteamController(int port) {
|
||||
this(Scheduler.getDefault(), port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param controller The SteamController object to use for this controller.
|
||||
*/
|
||||
public CommandSteamController(SteamController controller) {
|
||||
this(Scheduler.getDefault(), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandSteamController(Scheduler scheduler, int port) {
|
||||
m_hid = CommandGenericHID.getCommandGenericHID(scheduler, port);
|
||||
m_controller = new SteamController(m_hid.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param controller The SteamController object to use for this controller.
|
||||
*/
|
||||
public CommandSteamController(Scheduler scheduler, SteamController controller) {
|
||||
m_controller =
|
||||
Objects.requireNonNull(controller, "Provided SteamController cannot be null");
|
||||
m_hid = new CommandGenericHID(scheduler, m_controller.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying CommandGenericHID object.
|
||||
*
|
||||
* @return the wrapped CommandGenericHID object
|
||||
*/
|
||||
public CommandGenericHID getHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the wrapped controller object.
|
||||
*
|
||||
* @return the wrapped controller object
|
||||
*/
|
||||
public SteamController getController() {
|
||||
return m_controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #a(EventLoop)
|
||||
*/
|
||||
public Trigger a() {
|
||||
return a(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger a(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.A.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #b(EventLoop)
|
||||
*/
|
||||
public Trigger b() {
|
||||
return b(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger b(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.B.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the X button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the X button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #x(EventLoop)
|
||||
*/
|
||||
public Trigger x() {
|
||||
return x(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the X button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the X button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger x(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.X.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Y button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Y button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #y(EventLoop)
|
||||
*/
|
||||
public Trigger y() {
|
||||
return y(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Y button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Y button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger y(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.Y.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Menu button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Menu button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #menu(EventLoop)
|
||||
*/
|
||||
public Trigger menu() {
|
||||
return menu(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Menu button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Menu button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger menu(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.MENU.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Steam button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Steam button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #steam(EventLoop)
|
||||
*/
|
||||
public Trigger steam() {
|
||||
return steam(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Steam button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Steam button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger steam(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.STEAM.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the View button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the View button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #view(EventLoop)
|
||||
*/
|
||||
public Trigger view() {
|
||||
return view(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the View button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the View button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger view(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.VIEW.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Stick button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Left Stick button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftStick(EventLoop)
|
||||
*/
|
||||
public Trigger leftStick() {
|
||||
return leftStick(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Stick button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Left Stick button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger leftStick(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.LEFT_STICK.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Stick button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Right Stick button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightStick(EventLoop)
|
||||
*/
|
||||
public Trigger rightStick() {
|
||||
return rightStick(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Stick button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Right Stick button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger rightStick(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.RIGHT_STICK.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Bumper button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Left Bumper button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftBumper(EventLoop)
|
||||
*/
|
||||
public Trigger leftBumper() {
|
||||
return leftBumper(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Left Bumper button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger leftBumper(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.LEFT_BUMPER.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Bumper button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Right Bumper button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightBumper(EventLoop)
|
||||
*/
|
||||
public Trigger rightBumper() {
|
||||
return rightBumper(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Right Bumper button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger rightBumper(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.RIGHT_BUMPER.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadUp(EventLoop)
|
||||
*/
|
||||
public Trigger dpadUp() {
|
||||
return dpadUp(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadUp(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.DPAD_UP.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadDown(EventLoop)
|
||||
*/
|
||||
public Trigger dpadDown() {
|
||||
return dpadDown(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadDown(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.DPAD_DOWN.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadLeft(EventLoop)
|
||||
*/
|
||||
public Trigger dpadLeft() {
|
||||
return dpadLeft(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadLeft(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.DPAD_LEFT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadRight(EventLoop)
|
||||
*/
|
||||
public Trigger dpadRight() {
|
||||
return dpadRight(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadRight(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.DPAD_RIGHT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the QAM button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the QAM button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #QAM(EventLoop)
|
||||
*/
|
||||
public Trigger QAM() {
|
||||
return QAM(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the QAM button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the QAM button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger QAM(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.QAM.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Paddle 1 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Right Paddle 1 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightPaddle1(EventLoop)
|
||||
*/
|
||||
public Trigger rightPaddle1() {
|
||||
return rightPaddle1(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Paddle 1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Right Paddle 1 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger rightPaddle1(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.RIGHT_PADDLE_1.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Paddle 1 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Left Paddle 1 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftPaddle1(EventLoop)
|
||||
*/
|
||||
public Trigger leftPaddle1() {
|
||||
return leftPaddle1(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Paddle 1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Left Paddle 1 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger leftPaddle1(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.LEFT_PADDLE_1.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Paddle 2 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Right Paddle 2 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightPaddle2(EventLoop)
|
||||
*/
|
||||
public Trigger rightPaddle2() {
|
||||
return rightPaddle2(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Paddle 2 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Right Paddle 2 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger rightPaddle2(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.RIGHT_PADDLE_2.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Paddle 2 button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Left Paddle 2 button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftPaddle2(EventLoop)
|
||||
*/
|
||||
public Trigger leftPaddle2() {
|
||||
return leftPaddle2(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Paddle 2 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Left Paddle 2 button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger leftPaddle2(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.LEFT_PADDLE_2.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Touchpad button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Left Touchpad button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftTouchpad(EventLoop)
|
||||
*/
|
||||
public Trigger leftTouchpad() {
|
||||
return leftTouchpad(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Touchpad button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Left Touchpad button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger leftTouchpad(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.LEFT_TOUCHPAD.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Touchpad button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Right Touchpad button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightTouchpad(EventLoop)
|
||||
*/
|
||||
public Trigger rightTouchpad() {
|
||||
return rightTouchpad(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Touchpad button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Right Touchpad button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger rightTouchpad(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.RIGHT_TOUCHPAD.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Stick Touch button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Left Stick Touch button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftStickTouch(EventLoop)
|
||||
*/
|
||||
public Trigger leftStickTouch() {
|
||||
return leftStickTouch(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Stick Touch button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Left Stick Touch button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger leftStickTouch(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.LEFT_STICK_TOUCH.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Stick Touch button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Right Stick Touch button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightStickTouch(EventLoop)
|
||||
*/
|
||||
public Trigger rightStickTouch() {
|
||||
return rightStickTouch(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Stick Touch button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Right Stick Touch button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger rightStickTouch(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.RIGHT_STICK_TOUCH.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Grip Touch button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Left Grip Touch button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftGripTouch(EventLoop)
|
||||
*/
|
||||
public Trigger leftGripTouch() {
|
||||
return leftGripTouch(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Grip Touch button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Left Grip Touch button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger leftGripTouch(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.LEFT_GRIP_TOUCH.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Grip Touch button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Right Grip Touch button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightGripTouch(EventLoop)
|
||||
*/
|
||||
public Trigger rightGripTouch() {
|
||||
return rightGripTouch(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Grip Touch button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Right Grip Touch button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger rightGripTouch(EventLoop loop) {
|
||||
return m_hid.button(SteamController.Button.RIGHT_GRIP_TOUCH.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the Left Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the Left Trigger axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger leftTrigger(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
SteamController.Axis.LEFT_TRIGGER.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the Left Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the Left Trigger axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger leftTrigger(double threshold) {
|
||||
return leftTrigger(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the Left Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the Left Trigger axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger leftTrigger() {
|
||||
return leftTrigger(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the Right Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the Right Trigger axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger rightTrigger(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
SteamController.Axis.RIGHT_TRIGGER.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the Right Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the Right Trigger axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger rightTrigger(double threshold) {
|
||||
return rightTrigger(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the Right Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the Right Trigger axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger rightTrigger() {
|
||||
return rightTrigger(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftX() {
|
||||
return m_controller.getLeftX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftY() {
|
||||
return m_controller.getLeftY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightX() {
|
||||
return m_controller.getRightX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightY() {
|
||||
return m_controller.getRightY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left Trigger value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftTrigger() {
|
||||
return m_controller.getLeftTrigger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right Trigger value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightTrigger() {
|
||||
return m_controller.getRightTrigger();
|
||||
}
|
||||
}
|
||||
613
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandSwitch2GCController.java
generated
Normal file
613
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandSwitch2GCController.java
generated
Normal file
@@ -0,0 +1,613 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./commandsv3/generate_files.py. DO NOT MODIFY
|
||||
|
||||
package org.wpilib.command3.button;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.wpilib.command3.Scheduler;
|
||||
import org.wpilib.command3.Trigger;
|
||||
import org.wpilib.driverstation.Switch2GCController;
|
||||
import org.wpilib.event.EventLoop;
|
||||
|
||||
/**
|
||||
* A version of {@link Switch2GCController} with {@link Trigger} factories for command-based.
|
||||
*
|
||||
* @see Switch2GCController
|
||||
*/
|
||||
@SuppressWarnings("MethodName")
|
||||
public class CommandSwitch2GCController {
|
||||
private final CommandGenericHID m_hid;
|
||||
private final Switch2GCController m_controller;
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandSwitch2GCController(int port) {
|
||||
this(Scheduler.getDefault(), port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param controller The Switch2GCController object to use for this controller.
|
||||
*/
|
||||
public CommandSwitch2GCController(Switch2GCController controller) {
|
||||
this(Scheduler.getDefault(), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandSwitch2GCController(Scheduler scheduler, int port) {
|
||||
m_hid = CommandGenericHID.getCommandGenericHID(scheduler, port);
|
||||
m_controller = new Switch2GCController(m_hid.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param controller The Switch2GCController object to use for this controller.
|
||||
*/
|
||||
public CommandSwitch2GCController(Scheduler scheduler, Switch2GCController controller) {
|
||||
m_controller =
|
||||
Objects.requireNonNull(controller, "Provided Switch2GCController cannot be null");
|
||||
m_hid = new CommandGenericHID(scheduler, m_controller.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying CommandGenericHID object.
|
||||
*
|
||||
* @return the wrapped CommandGenericHID object
|
||||
*/
|
||||
public CommandGenericHID getHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the wrapped controller object.
|
||||
*
|
||||
* @return the wrapped controller object
|
||||
*/
|
||||
public Switch2GCController getController() {
|
||||
return m_controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #a(EventLoop)
|
||||
*/
|
||||
public Trigger a() {
|
||||
return a(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger a(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.A.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the X button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the X button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #x(EventLoop)
|
||||
*/
|
||||
public Trigger x() {
|
||||
return x(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the X button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the X button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger x(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.X.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #b(EventLoop)
|
||||
*/
|
||||
public Trigger b() {
|
||||
return b(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger b(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.B.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Y button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Y button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #y(EventLoop)
|
||||
*/
|
||||
public Trigger y() {
|
||||
return y(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Y button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Y button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger y(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.Y.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Home button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Home button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #home(EventLoop)
|
||||
*/
|
||||
public Trigger home() {
|
||||
return home(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Home button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Home button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger home(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.HOME.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Start button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Start button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #start(EventLoop)
|
||||
*/
|
||||
public Trigger start() {
|
||||
return start(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Start button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Start button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger start(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.START.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the ZL button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the ZL button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #ZL(EventLoop)
|
||||
*/
|
||||
public Trigger ZL() {
|
||||
return ZL(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the ZL button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the ZL button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger ZL(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.ZL.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Z button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Z button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #Z(EventLoop)
|
||||
*/
|
||||
public Trigger Z() {
|
||||
return Z(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Z button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Z button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger Z(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.Z.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadUp(EventLoop)
|
||||
*/
|
||||
public Trigger dpadUp() {
|
||||
return dpadUp(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadUp(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.DPAD_UP.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadDown(EventLoop)
|
||||
*/
|
||||
public Trigger dpadDown() {
|
||||
return dpadDown(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadDown(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.DPAD_DOWN.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadLeft(EventLoop)
|
||||
*/
|
||||
public Trigger dpadLeft() {
|
||||
return dpadLeft(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadLeft(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.DPAD_LEFT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadRight(EventLoop)
|
||||
*/
|
||||
public Trigger dpadRight() {
|
||||
return dpadRight(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadRight(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.DPAD_RIGHT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Capture button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Capture button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #capture(EventLoop)
|
||||
*/
|
||||
public Trigger capture() {
|
||||
return capture(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Capture button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Capture button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger capture(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.CAPTURE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the C button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the C button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #C(EventLoop)
|
||||
*/
|
||||
public Trigger C() {
|
||||
return C(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the C button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the C button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger C(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.C.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the L button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #L(EventLoop)
|
||||
*/
|
||||
public Trigger L() {
|
||||
return L(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the L button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger L(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.L.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the R button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #R(EventLoop)
|
||||
*/
|
||||
public Trigger R() {
|
||||
return R(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the R button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger R(EventLoop loop) {
|
||||
return m_hid.button(Switch2GCController.Button.R.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the L Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the L Trigger axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger LTrigger(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
Switch2GCController.Axis.L_TRIGGER.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the L Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the L Trigger axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger LTrigger(double threshold) {
|
||||
return LTrigger(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the L Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the L Trigger axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger LTrigger() {
|
||||
return LTrigger(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the R Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the R Trigger axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger RTrigger(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
Switch2GCController.Axis.R_TRIGGER.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the R Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the R Trigger axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger RTrigger(double threshold) {
|
||||
return RTrigger(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the R Trigger. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the R Trigger axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger RTrigger() {
|
||||
return RTrigger(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftX() {
|
||||
return m_controller.getLeftX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftY() {
|
||||
return m_controller.getLeftY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the C Stick X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getCStickX() {
|
||||
return m_controller.getCStickX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the C Stick Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getCStickY() {
|
||||
return m_controller.getCStickY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the L Trigger value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLTrigger() {
|
||||
return m_controller.getLTrigger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the R Trigger value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRTrigger() {
|
||||
return m_controller.getRTrigger();
|
||||
}
|
||||
}
|
||||
685
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandSwitch2ProController.java
generated
Normal file
685
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandSwitch2ProController.java
generated
Normal file
@@ -0,0 +1,685 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./commandsv3/generate_files.py. DO NOT MODIFY
|
||||
|
||||
package org.wpilib.command3.button;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.wpilib.command3.Scheduler;
|
||||
import org.wpilib.command3.Trigger;
|
||||
import org.wpilib.driverstation.Switch2ProController;
|
||||
import org.wpilib.event.EventLoop;
|
||||
|
||||
/**
|
||||
* A version of {@link Switch2ProController} with {@link Trigger} factories for command-based.
|
||||
*
|
||||
* @see Switch2ProController
|
||||
*/
|
||||
@SuppressWarnings("MethodName")
|
||||
public class CommandSwitch2ProController {
|
||||
private final CommandGenericHID m_hid;
|
||||
private final Switch2ProController m_controller;
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandSwitch2ProController(int port) {
|
||||
this(Scheduler.getDefault(), port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param controller The Switch2ProController object to use for this controller.
|
||||
*/
|
||||
public CommandSwitch2ProController(Switch2ProController controller) {
|
||||
this(Scheduler.getDefault(), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandSwitch2ProController(Scheduler scheduler, int port) {
|
||||
m_hid = CommandGenericHID.getCommandGenericHID(scheduler, port);
|
||||
m_controller = new Switch2ProController(m_hid.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param controller The Switch2ProController object to use for this controller.
|
||||
*/
|
||||
public CommandSwitch2ProController(Scheduler scheduler, Switch2ProController controller) {
|
||||
m_controller =
|
||||
Objects.requireNonNull(controller, "Provided Switch2ProController cannot be null");
|
||||
m_hid = new CommandGenericHID(scheduler, m_controller.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying CommandGenericHID object.
|
||||
*
|
||||
* @return the wrapped CommandGenericHID object
|
||||
*/
|
||||
public CommandGenericHID getHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the wrapped controller object.
|
||||
*
|
||||
* @return the wrapped controller object
|
||||
*/
|
||||
public Switch2ProController getController() {
|
||||
return m_controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #b(EventLoop)
|
||||
*/
|
||||
public Trigger b() {
|
||||
return b(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger b(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.B.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #a(EventLoop)
|
||||
*/
|
||||
public Trigger a() {
|
||||
return a(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger a(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.A.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Y button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Y button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #y(EventLoop)
|
||||
*/
|
||||
public Trigger y() {
|
||||
return y(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Y button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Y button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger y(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.Y.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the X button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the X button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #x(EventLoop)
|
||||
*/
|
||||
public Trigger x() {
|
||||
return x(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the X button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the X button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger x(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.X.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Minus button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Minus button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #minus(EventLoop)
|
||||
*/
|
||||
public Trigger minus() {
|
||||
return minus(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Minus button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Minus button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger minus(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.MINUS.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Home button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Home button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #home(EventLoop)
|
||||
*/
|
||||
public Trigger home() {
|
||||
return home(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Home button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Home button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger home(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.HOME.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Plus button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Plus button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #plus(EventLoop)
|
||||
*/
|
||||
public Trigger plus() {
|
||||
return plus(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Plus button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Plus button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger plus(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.PLUS.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Stick button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Left Stick button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftStick(EventLoop)
|
||||
*/
|
||||
public Trigger leftStick() {
|
||||
return leftStick(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Stick button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Left Stick button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger leftStick(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.LEFT_STICK.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Stick button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Right Stick button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightStick(EventLoop)
|
||||
*/
|
||||
public Trigger rightStick() {
|
||||
return rightStick(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Stick button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Right Stick button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger rightStick(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.RIGHT_STICK.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the L button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #L(EventLoop)
|
||||
*/
|
||||
public Trigger L() {
|
||||
return L(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the L button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger L(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.L.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the R button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #R(EventLoop)
|
||||
*/
|
||||
public Trigger R() {
|
||||
return R(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the R button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger R(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.R.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadUp(EventLoop)
|
||||
*/
|
||||
public Trigger dpadUp() {
|
||||
return dpadUp(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadUp(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.DPAD_UP.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadDown(EventLoop)
|
||||
*/
|
||||
public Trigger dpadDown() {
|
||||
return dpadDown(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadDown(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.DPAD_DOWN.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadLeft(EventLoop)
|
||||
*/
|
||||
public Trigger dpadLeft() {
|
||||
return dpadLeft(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadLeft(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.DPAD_LEFT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadRight(EventLoop)
|
||||
*/
|
||||
public Trigger dpadRight() {
|
||||
return dpadRight(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadRight(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.DPAD_RIGHT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Capture button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Capture button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #capture(EventLoop)
|
||||
*/
|
||||
public Trigger capture() {
|
||||
return capture(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Capture button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Capture button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger capture(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.CAPTURE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the GR button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the GR button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #GR(EventLoop)
|
||||
*/
|
||||
public Trigger GR() {
|
||||
return GR(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the GR button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the GR button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger GR(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.GR.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the GL button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the GL button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #GL(EventLoop)
|
||||
*/
|
||||
public Trigger GL() {
|
||||
return GL(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the GL button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the GL button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger GL(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.GL.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the C button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the C button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #C(EventLoop)
|
||||
*/
|
||||
public Trigger C() {
|
||||
return C(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the C button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the C button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger C(EventLoop loop) {
|
||||
return m_hid.button(Switch2ProController.Button.C.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZL. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the ZL axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger ZL(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
Switch2ProController.Axis.ZL.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZL. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the ZL axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger ZL(double threshold) {
|
||||
return ZL(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZL. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the ZL axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger ZL() {
|
||||
return ZL(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZR. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the ZR axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger ZR(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
Switch2ProController.Axis.ZR.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZR. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the ZR axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger ZR(double threshold) {
|
||||
return ZR(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZR. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the ZR axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger ZR() {
|
||||
return ZR(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftX() {
|
||||
return m_controller.getLeftX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftY() {
|
||||
return m_controller.getLeftY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightX() {
|
||||
return m_controller.getRightX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightY() {
|
||||
return m_controller.getRightY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ZL value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getZL() {
|
||||
return m_controller.getZL();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ZR value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getZR() {
|
||||
return m_controller.getZR();
|
||||
}
|
||||
}
|
||||
527
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandSwitchN64Controller.java
generated
Normal file
527
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandSwitchN64Controller.java
generated
Normal file
@@ -0,0 +1,527 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./commandsv3/generate_files.py. DO NOT MODIFY
|
||||
|
||||
package org.wpilib.command3.button;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.wpilib.command3.Scheduler;
|
||||
import org.wpilib.command3.Trigger;
|
||||
import org.wpilib.driverstation.SwitchN64Controller;
|
||||
import org.wpilib.event.EventLoop;
|
||||
|
||||
/**
|
||||
* A version of {@link SwitchN64Controller} with {@link Trigger} factories for command-based.
|
||||
*
|
||||
* @see SwitchN64Controller
|
||||
*/
|
||||
@SuppressWarnings("MethodName")
|
||||
public class CommandSwitchN64Controller {
|
||||
private final CommandGenericHID m_hid;
|
||||
private final SwitchN64Controller m_controller;
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandSwitchN64Controller(int port) {
|
||||
this(Scheduler.getDefault(), port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param controller The SwitchN64Controller object to use for this controller.
|
||||
*/
|
||||
public CommandSwitchN64Controller(SwitchN64Controller controller) {
|
||||
this(Scheduler.getDefault(), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandSwitchN64Controller(Scheduler scheduler, int port) {
|
||||
m_hid = CommandGenericHID.getCommandGenericHID(scheduler, port);
|
||||
m_controller = new SwitchN64Controller(m_hid.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param controller The SwitchN64Controller object to use for this controller.
|
||||
*/
|
||||
public CommandSwitchN64Controller(Scheduler scheduler, SwitchN64Controller controller) {
|
||||
m_controller =
|
||||
Objects.requireNonNull(controller, "Provided SwitchN64Controller cannot be null");
|
||||
m_hid = new CommandGenericHID(scheduler, m_controller.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying CommandGenericHID object.
|
||||
*
|
||||
* @return the wrapped CommandGenericHID object
|
||||
*/
|
||||
public CommandGenericHID getHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the wrapped controller object.
|
||||
*
|
||||
* @return the wrapped controller object
|
||||
*/
|
||||
public SwitchN64Controller getController() {
|
||||
return m_controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #a(EventLoop)
|
||||
*/
|
||||
public Trigger a() {
|
||||
return a(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger a(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.A.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #b(EventLoop)
|
||||
*/
|
||||
public Trigger b() {
|
||||
return b(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger b(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.B.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the C Left button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the C Left button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #CLeft(EventLoop)
|
||||
*/
|
||||
public Trigger CLeft() {
|
||||
return CLeft(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the C Left button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the C Left button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger CLeft(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.C_LEFT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the C Up button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the C Up button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #CUp(EventLoop)
|
||||
*/
|
||||
public Trigger CUp() {
|
||||
return CUp(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the C Up button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the C Up button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger CUp(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.C_UP.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Capture button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Capture button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #capture(EventLoop)
|
||||
*/
|
||||
public Trigger capture() {
|
||||
return capture(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Capture button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Capture button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger capture(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.CAPTURE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Home button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Home button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #home(EventLoop)
|
||||
*/
|
||||
public Trigger home() {
|
||||
return home(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Home button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Home button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger home(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.HOME.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Start button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Start button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #start(EventLoop)
|
||||
*/
|
||||
public Trigger start() {
|
||||
return start(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Start button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Start button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger start(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.START.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the C Down button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the C Down button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #CDown(EventLoop)
|
||||
*/
|
||||
public Trigger CDown() {
|
||||
return CDown(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the C Down button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the C Down button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger CDown(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.C_DOWN.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the L button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #L(EventLoop)
|
||||
*/
|
||||
public Trigger L() {
|
||||
return L(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the L button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger L(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.L.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the R button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #R(EventLoop)
|
||||
*/
|
||||
public Trigger R() {
|
||||
return R(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the R button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger R(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.R.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadUp(EventLoop)
|
||||
*/
|
||||
public Trigger dpadUp() {
|
||||
return dpadUp(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadUp(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.DPAD_UP.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadDown(EventLoop)
|
||||
*/
|
||||
public Trigger dpadDown() {
|
||||
return dpadDown(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadDown(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.DPAD_DOWN.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadLeft(EventLoop)
|
||||
*/
|
||||
public Trigger dpadLeft() {
|
||||
return dpadLeft(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadLeft(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.DPAD_LEFT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadRight(EventLoop)
|
||||
*/
|
||||
public Trigger dpadRight() {
|
||||
return dpadRight(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadRight(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.DPAD_RIGHT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the C Right button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the C Right button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #CRight(EventLoop)
|
||||
*/
|
||||
public Trigger CRight() {
|
||||
return CRight(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the C Right button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the C Right button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger CRight(EventLoop loop) {
|
||||
return m_hid.button(SwitchN64Controller.Button.C_RIGHT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZR. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the ZR axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger ZR(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
SwitchN64Controller.Axis.ZR.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZR. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the ZR axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger ZR(double threshold) {
|
||||
return ZR(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZR. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the ZR axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger ZR() {
|
||||
return ZR(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftX() {
|
||||
return m_controller.getLeftX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftY() {
|
||||
return m_controller.getLeftY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Z Axis value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getZAxis() {
|
||||
return m_controller.getZAxis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ZR value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getZR() {
|
||||
return m_controller.getZR();
|
||||
}
|
||||
}
|
||||
613
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandSwitchProController.java
generated
Normal file
613
commandsv3/src/generated/main/java/org/wpilib/command3/button/CommandSwitchProController.java
generated
Normal file
@@ -0,0 +1,613 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./commandsv3/generate_files.py. DO NOT MODIFY
|
||||
|
||||
package org.wpilib.command3.button;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.wpilib.command3.Scheduler;
|
||||
import org.wpilib.command3.Trigger;
|
||||
import org.wpilib.driverstation.SwitchProController;
|
||||
import org.wpilib.event.EventLoop;
|
||||
|
||||
/**
|
||||
* A version of {@link SwitchProController} with {@link Trigger} factories for command-based.
|
||||
*
|
||||
* @see SwitchProController
|
||||
*/
|
||||
@SuppressWarnings("MethodName")
|
||||
public class CommandSwitchProController {
|
||||
private final CommandGenericHID m_hid;
|
||||
private final SwitchProController m_controller;
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandSwitchProController(int port) {
|
||||
this(Scheduler.getDefault(), port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the {@link Scheduler#getDefault() default scheduler} using its default event loop.
|
||||
*
|
||||
* @param controller The SwitchProController object to use for this controller.
|
||||
*/
|
||||
public CommandSwitchProController(SwitchProController controller) {
|
||||
this(Scheduler.getDefault(), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param port The port index on the Driver Station that the controller is plugged into.
|
||||
*/
|
||||
public CommandSwitchProController(Scheduler scheduler, int port) {
|
||||
m_hid = CommandGenericHID.getCommandGenericHID(scheduler, port);
|
||||
m_controller = new SwitchProController(m_hid.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller. Commands bound to buttons on the controller will be
|
||||
* scheduled on the given scheduler using its default event loop.
|
||||
*
|
||||
* @param scheduler The scheduler that should execute the triggered commands.
|
||||
* @param controller The SwitchProController object to use for this controller.
|
||||
*/
|
||||
public CommandSwitchProController(Scheduler scheduler, SwitchProController controller) {
|
||||
m_controller =
|
||||
Objects.requireNonNull(controller, "Provided SwitchProController cannot be null");
|
||||
m_hid = new CommandGenericHID(scheduler, m_controller.getHID());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying CommandGenericHID object.
|
||||
*
|
||||
* @return the wrapped CommandGenericHID object
|
||||
*/
|
||||
public CommandGenericHID getHID() {
|
||||
return m_hid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the wrapped controller object.
|
||||
*
|
||||
* @return the wrapped controller object
|
||||
*/
|
||||
public SwitchProController getController() {
|
||||
return m_controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #b(EventLoop)
|
||||
*/
|
||||
public Trigger b() {
|
||||
return b(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the B button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the B button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger b(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.B.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #a(EventLoop)
|
||||
*/
|
||||
public Trigger a() {
|
||||
return a(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the A button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the A button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger a(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.A.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Y button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Y button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #y(EventLoop)
|
||||
*/
|
||||
public Trigger y() {
|
||||
return y(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Y button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Y button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger y(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.Y.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the X button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the X button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #x(EventLoop)
|
||||
*/
|
||||
public Trigger x() {
|
||||
return x(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the X button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the X button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger x(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.X.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Minus button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Minus button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #minus(EventLoop)
|
||||
*/
|
||||
public Trigger minus() {
|
||||
return minus(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Minus button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Minus button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger minus(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.MINUS.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Home button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Home button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #home(EventLoop)
|
||||
*/
|
||||
public Trigger home() {
|
||||
return home(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Home button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Home button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger home(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.HOME.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Plus button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Plus button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #plus(EventLoop)
|
||||
*/
|
||||
public Trigger plus() {
|
||||
return plus(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Plus button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Plus button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger plus(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.PLUS.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Stick button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Left Stick button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #leftStick(EventLoop)
|
||||
*/
|
||||
public Trigger leftStick() {
|
||||
return leftStick(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Left Stick button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Left Stick button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger leftStick(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.LEFT_STICK.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Stick button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Right Stick button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #rightStick(EventLoop)
|
||||
*/
|
||||
public Trigger rightStick() {
|
||||
return rightStick(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Right Stick button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Right Stick button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger rightStick(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.RIGHT_STICK.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the L button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #L(EventLoop)
|
||||
*/
|
||||
public Trigger L() {
|
||||
return L(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the L button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the L button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger L(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.L.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the R button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #R(EventLoop)
|
||||
*/
|
||||
public Trigger R() {
|
||||
return R(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the R button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the R button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger R(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.R.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadUp(EventLoop)
|
||||
*/
|
||||
public Trigger dpadUp() {
|
||||
return dpadUp(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Up button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Up button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadUp(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.DPAD_UP.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadDown(EventLoop)
|
||||
*/
|
||||
public Trigger dpadDown() {
|
||||
return dpadDown(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Down button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Down button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadDown(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.DPAD_DOWN.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadLeft(EventLoop)
|
||||
*/
|
||||
public Trigger dpadLeft() {
|
||||
return dpadLeft(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Left button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Left button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadLeft(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.DPAD_LEFT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #dpadRight(EventLoop)
|
||||
*/
|
||||
public Trigger dpadRight() {
|
||||
return dpadRight(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Dpad Right button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Dpad Right button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger dpadRight(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.DPAD_RIGHT.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Capture button's digital signal.
|
||||
*
|
||||
* @return a Trigger instance representing the Capture button's digital signal attached
|
||||
* to the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
* @see #capture(EventLoop)
|
||||
*/
|
||||
public Trigger capture() {
|
||||
return capture(m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the Capture button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return a Trigger instance representing the Capture button's digital signal attached
|
||||
* to the given loop.
|
||||
*/
|
||||
public Trigger capture(EventLoop loop) {
|
||||
return m_hid.button(SwitchProController.Button.CAPTURE.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZL. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the ZL axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger ZL(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
SwitchProController.Axis.ZL.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZL. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the ZL axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger ZL(double threshold) {
|
||||
return ZL(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZL. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the ZL axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger ZL() {
|
||||
return ZL(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZR. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @param loop the event loop instance to attach the Trigger to.
|
||||
* @return a Trigger instance that is true when the ZR axis exceeds the provided
|
||||
* threshold, attached to the given event loop
|
||||
*/
|
||||
public Trigger ZR(double threshold, EventLoop loop) {
|
||||
return m_hid.axisGreaterThan(
|
||||
SwitchProController.Axis.ZR.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZR. The returned
|
||||
* trigger will be true when the axis value is greater than {@code threshold}.
|
||||
*
|
||||
* @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
|
||||
* should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
||||
* @return a Trigger instance that is true when the ZR axis exceeds the provided
|
||||
* threshold, attached to the {@link Scheduler#getDefaultEventLoop() default scheduler event
|
||||
* loop} on the scheduler passed to the controller's constructor, or the {@link
|
||||
* Scheduler#getDefault default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger ZR(double threshold) {
|
||||
return ZR(threshold, m_hid.getScheduler().getDefaultEventLoop());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a Trigger instance around the axis value of the ZR. The returned
|
||||
* trigger will be true when the axis value is greater than 0.5.
|
||||
*
|
||||
* @return a Trigger instance that is true when the ZR axis exceeds 0.5, attached to
|
||||
* the {@link Scheduler#getDefaultEventLoop() default scheduler event loop} on the
|
||||
* scheduler passed to the controller's constructor, or the {@link Scheduler#getDefault
|
||||
* default scheduler} if a scheduler was not explicitly provided.
|
||||
*/
|
||||
public Trigger ZR() {
|
||||
return ZR(0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftX() {
|
||||
return m_controller.getLeftX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Left Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftY() {
|
||||
return m_controller.getLeftY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right X value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightX() {
|
||||
return m_controller.getRightX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Right Y value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightY() {
|
||||
return m_controller.getRightY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ZL value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getZL() {
|
||||
return m_controller.getZL();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ZR value of the controller.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getZR() {
|
||||
return m_controller.getZR();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user