SCRIPT Move cc files

This commit is contained in:
PJ Reiniger
2025-11-07 19:55:39 -05:00
committed by Peter Johnson
parent 10b4a0c971
commit 7ca1be9bae
1197 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,608 @@
// 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 ./wpilibc/generate_hids.py. DO NOT MODIFY
#pragma once
#include <wpi/sendable/Sendable.h>
#include <wpi/sendable/SendableHelper.h>
#include "frc/GenericHID.h"
namespace frc {
/**
* Handle input from PS4 controllers connected to the Driver Station.
*
* This class handles PS4 input that comes from the Driver Station. Each
* time a value is requested the most recent value is returned. There is a
* single class instance for each controller and the mapping of ports to
* hardware buttons depends on the code in the Driver Station.
*
* Only first party controllers from Sony are guaranteed to have the
* correct mapping, and only through the official NI DS. Sim is not guaranteed
* to have the same mapping, as well as any 3rd party controllers.
*/
class PS4Controller : public GenericHID,
public wpi::Sendable,
public wpi::SendableHelper<PS4Controller> {
public:
/**
* Construct an instance of a controller.
*
* The controller index is the USB port on the Driver Station.
*
* @param port The port on the Driver Station that the controller is plugged
* into (0-5).
*/
explicit PS4Controller(int port);
~PS4Controller() override = default;
PS4Controller(PS4Controller&&) = default;
PS4Controller& operator=(PS4Controller&&) = default;
/**
* Get the X axis value of left side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetLeftX() const;
/**
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return the axis value.
*/
double GetLeftY() const;
/**
* Get the X axis value of right side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetRightX() const;
/**
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return the axis value.
*/
double GetRightY() const;
/**
* Get the left trigger 2 axis value of the controller. Note that this axis
* is bound to the range of [0, 1] as opposed to the usual [-1, 1].
*
* @return the axis value.
*/
double GetL2Axis() const;
/**
* Get the right trigger 2 axis value of the controller. Note that this axis
* is bound to the range of [0, 1] as opposed to the usual [-1, 1].
*
* @return the axis value.
*/
double GetR2Axis() const;
/**
* Read the value of the square button on the controller.
*
* @return The state of the button.
*/
bool GetSquareButton() const;
/**
* Whether the square button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetSquareButtonPressed();
/**
* Whether the square button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetSquareButtonReleased();
/**
* Constructs an event instance around the square button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the square button's
* digital signal attached to the given loop.
*/
BooleanEvent Square(EventLoop* loop) const;
/**
* Read the value of the cross button on the controller.
*
* @return The state of the button.
*/
bool GetCrossButton() const;
/**
* Whether the cross button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetCrossButtonPressed();
/**
* Whether the cross button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetCrossButtonReleased();
/**
* Constructs an event instance around the cross button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the cross button's
* digital signal attached to the given loop.
*/
BooleanEvent Cross(EventLoop* loop) const;
/**
* Read the value of the circle button on the controller.
*
* @return The state of the button.
*/
bool GetCircleButton() const;
/**
* Whether the circle button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetCircleButtonPressed();
/**
* Whether the circle button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetCircleButtonReleased();
/**
* Constructs an event instance around the circle button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the circle button's
* digital signal attached to the given loop.
*/
BooleanEvent Circle(EventLoop* loop) const;
/**
* Read the value of the triangle button on the controller.
*
* @return The state of the button.
*/
bool GetTriangleButton() const;
/**
* Whether the triangle button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetTriangleButtonPressed();
/**
* Whether the triangle button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetTriangleButtonReleased();
/**
* Constructs an event instance around the triangle button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the triangle button's
* digital signal attached to the given loop.
*/
BooleanEvent Triangle(EventLoop* loop) const;
/**
* Read the value of the left trigger 1 button on the controller.
*
* @return The state of the button.
*/
bool GetL1Button() const;
/**
* Whether the left trigger 1 button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetL1ButtonPressed();
/**
* Whether the left trigger 1 button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetL1ButtonReleased();
/**
* Constructs an event instance around the left trigger 1 button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the left trigger 1 button's
* digital signal attached to the given loop.
*/
BooleanEvent L1(EventLoop* loop) const;
/**
* Read the value of the right trigger 1 button on the controller.
*
* @return The state of the button.
*/
bool GetR1Button() const;
/**
* Whether the right trigger 1 button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetR1ButtonPressed();
/**
* Whether the right trigger 1 button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetR1ButtonReleased();
/**
* Constructs an event instance around the right trigger 1 button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the right trigger 1 button's
* digital signal attached to the given loop.
*/
BooleanEvent R1(EventLoop* loop) const;
/**
* Read the value of the left trigger 2 button on the controller.
*
* @return The state of the button.
*/
bool GetL2Button() const;
/**
* Whether the left trigger 2 button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetL2ButtonPressed();
/**
* Whether the left trigger 2 button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetL2ButtonReleased();
/**
* Constructs an event instance around the left trigger 2 button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the left trigger 2 button's
* digital signal attached to the given loop.
*/
BooleanEvent L2(EventLoop* loop) const;
/**
* Read the value of the right trigger 2 button on the controller.
*
* @return The state of the button.
*/
bool GetR2Button() const;
/**
* Whether the right trigger 2 button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetR2ButtonPressed();
/**
* Whether the right trigger 2 button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetR2ButtonReleased();
/**
* Constructs an event instance around the right trigger 2 button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the right trigger 2 button's
* digital signal attached to the given loop.
*/
BooleanEvent R2(EventLoop* loop) const;
/**
* Read the value of the share button on the controller.
*
* @return The state of the button.
*/
bool GetShareButton() const;
/**
* Whether the share button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetShareButtonPressed();
/**
* Whether the share button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetShareButtonReleased();
/**
* Constructs an event instance around the share button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the share button's
* digital signal attached to the given loop.
*/
BooleanEvent Share(EventLoop* loop) const;
/**
* Read the value of the options button on the controller.
*
* @return The state of the button.
*/
bool GetOptionsButton() const;
/**
* Whether the options button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetOptionsButtonPressed();
/**
* Whether the options button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetOptionsButtonReleased();
/**
* Constructs an event instance around the options button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the options button's
* digital signal attached to the given loop.
*/
BooleanEvent Options(EventLoop* loop) const;
/**
* Read the value of the L3 (left stick) button on the controller.
*
* @return The state of the button.
*/
bool GetL3Button() const;
/**
* Whether the L3 (left stick) button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetL3ButtonPressed();
/**
* Whether the L3 (left stick) button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetL3ButtonReleased();
/**
* Constructs an event instance around the L3 (left stick) button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the L3 (left stick) button's
* digital signal attached to the given loop.
*/
BooleanEvent L3(EventLoop* loop) const;
/**
* Read the value of the R3 (right stick) button on the controller.
*
* @return The state of the button.
*/
bool GetR3Button() const;
/**
* Whether the R3 (right stick) button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetR3ButtonPressed();
/**
* Whether the R3 (right stick) button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetR3ButtonReleased();
/**
* Constructs an event instance around the R3 (right stick) button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the R3 (right stick) button's
* digital signal attached to the given loop.
*/
BooleanEvent R3(EventLoop* loop) const;
/**
* Read the value of the PlayStation button on the controller.
*
* @return The state of the button.
*/
bool GetPSButton() const;
/**
* Whether the PlayStation button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetPSButtonPressed();
/**
* Whether the PlayStation button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetPSButtonReleased();
/**
* Constructs an event instance around the PlayStation button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the PlayStation button's
* digital signal attached to the given loop.
*/
BooleanEvent PS(EventLoop* loop) const;
/**
* Read the value of the touchpad button on the controller.
*
* @return The state of the button.
*/
bool GetTouchpadButton() const;
/**
* Whether the touchpad button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetTouchpadButtonPressed();
/**
* Whether the touchpad button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetTouchpadButtonReleased();
/**
* Constructs an event instance around the touchpad button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the touchpad button's
* digital signal attached to the given loop.
*/
BooleanEvent Touchpad(EventLoop* loop) const;
/**
* Read the value of the touchpad button on the controller.
*
* @return The state of the button.
* @deprecated Use GetTouchpadButton instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be
* automatically generated.
*/
[[deprecated("Use GetTouchpadButton instead")]]
bool GetTouchpad() const;
/**
* Whether the touchpad was pressed since the last check.
*
* @return Whether the touchpad was pressed since the last check.
* @deprecated Use GetTouchpadButtonPressed instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetTouchpadButtonPressed instead")]]
bool GetTouchpadPressed();
/**
* Whether the touchpad was released since the last check.
*
* @return Whether the touchpad was released since the last check.
* @deprecated Use GetLeftBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use GetTouchpadButtonReleased instead")]]
bool GetTouchpadReleased();
/** Represents a digital button on an PS4Controller. */
struct Button {
/// Square button.
static constexpr int kSquare = 0;
/// Cross button.
static constexpr int kCross = 1;
/// Circle button.
static constexpr int kCircle = 2;
/// Triangle button.
static constexpr int kTriangle = 3;
/// Left trigger 1 button.
static constexpr int kL1 = 4;
/// Right trigger 1 button.
static constexpr int kR1 = 5;
/// Left trigger 2 button.
static constexpr int kL2 = 6;
/// Right trigger 2 button.
static constexpr int kR2 = 7;
/// Share button.
static constexpr int kShare = 8;
/// Options button.
static constexpr int kOptions = 9;
/// L3 (left stick) button.
static constexpr int kL3 = 10;
/// R3 (right stick) button.
static constexpr int kR3 = 11;
/// PlayStation button.
static constexpr int kPS = 12;
/// Touchpad button.
static constexpr int kTouchpad = 13;
};
/** Represents an axis on an PS4Controller. */
struct Axis {
/// Left X axis.
static constexpr int kLeftX = 0;
/// Left Y axis.
static constexpr int kLeftY = 1;
/// Right X axis.
static constexpr int kRightX = 2;
/// Right Y axis.
static constexpr int kRightY = 5;
/// Left trigger 2.
static constexpr int kL2 = 3;
/// Right trigger 2.
static constexpr int kR2 = 4;
};
void InitSendable(wpi::SendableBuilder& builder) override;
};
} // namespace frc

View File

@@ -0,0 +1,608 @@
// 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 ./wpilibc/generate_hids.py. DO NOT MODIFY
#pragma once
#include <wpi/sendable/Sendable.h>
#include <wpi/sendable/SendableHelper.h>
#include "frc/GenericHID.h"
namespace frc {
/**
* Handle input from PS5 controllers connected to the Driver Station.
*
* This class handles PS5 input that comes from the Driver Station. Each
* time a value is requested the most recent value is returned. There is a
* single class instance for each controller and the mapping of ports to
* hardware buttons depends on the code in the Driver Station.
*
* Only first party controllers from Sony are guaranteed to have the
* correct mapping, and only through the official NI DS. Sim is not guaranteed
* to have the same mapping, as well as any 3rd party controllers.
*/
class PS5Controller : public GenericHID,
public wpi::Sendable,
public wpi::SendableHelper<PS5Controller> {
public:
/**
* Construct an instance of a controller.
*
* The controller index is the USB port on the Driver Station.
*
* @param port The port on the Driver Station that the controller is plugged
* into (0-5).
*/
explicit PS5Controller(int port);
~PS5Controller() override = default;
PS5Controller(PS5Controller&&) = default;
PS5Controller& operator=(PS5Controller&&) = default;
/**
* Get the X axis value of left side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetLeftX() const;
/**
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return the axis value.
*/
double GetLeftY() const;
/**
* Get the X axis value of right side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetRightX() const;
/**
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return the axis value.
*/
double GetRightY() const;
/**
* Get the left trigger 2 axis value of the controller. Note that this axis
* is bound to the range of [0, 1] as opposed to the usual [-1, 1].
*
* @return the axis value.
*/
double GetL2Axis() const;
/**
* Get the right trigger 2 axis value of the controller. Note that this axis
* is bound to the range of [0, 1] as opposed to the usual [-1, 1].
*
* @return the axis value.
*/
double GetR2Axis() const;
/**
* Read the value of the square button on the controller.
*
* @return The state of the button.
*/
bool GetSquareButton() const;
/**
* Whether the square button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetSquareButtonPressed();
/**
* Whether the square button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetSquareButtonReleased();
/**
* Constructs an event instance around the square button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the square button's
* digital signal attached to the given loop.
*/
BooleanEvent Square(EventLoop* loop) const;
/**
* Read the value of the cross button on the controller.
*
* @return The state of the button.
*/
bool GetCrossButton() const;
/**
* Whether the cross button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetCrossButtonPressed();
/**
* Whether the cross button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetCrossButtonReleased();
/**
* Constructs an event instance around the cross button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the cross button's
* digital signal attached to the given loop.
*/
BooleanEvent Cross(EventLoop* loop) const;
/**
* Read the value of the circle button on the controller.
*
* @return The state of the button.
*/
bool GetCircleButton() const;
/**
* Whether the circle button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetCircleButtonPressed();
/**
* Whether the circle button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetCircleButtonReleased();
/**
* Constructs an event instance around the circle button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the circle button's
* digital signal attached to the given loop.
*/
BooleanEvent Circle(EventLoop* loop) const;
/**
* Read the value of the triangle button on the controller.
*
* @return The state of the button.
*/
bool GetTriangleButton() const;
/**
* Whether the triangle button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetTriangleButtonPressed();
/**
* Whether the triangle button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetTriangleButtonReleased();
/**
* Constructs an event instance around the triangle button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the triangle button's
* digital signal attached to the given loop.
*/
BooleanEvent Triangle(EventLoop* loop) const;
/**
* Read the value of the left trigger 1 button on the controller.
*
* @return The state of the button.
*/
bool GetL1Button() const;
/**
* Whether the left trigger 1 button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetL1ButtonPressed();
/**
* Whether the left trigger 1 button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetL1ButtonReleased();
/**
* Constructs an event instance around the left trigger 1 button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the left trigger 1 button's
* digital signal attached to the given loop.
*/
BooleanEvent L1(EventLoop* loop) const;
/**
* Read the value of the right trigger 1 button on the controller.
*
* @return The state of the button.
*/
bool GetR1Button() const;
/**
* Whether the right trigger 1 button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetR1ButtonPressed();
/**
* Whether the right trigger 1 button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetR1ButtonReleased();
/**
* Constructs an event instance around the right trigger 1 button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the right trigger 1 button's
* digital signal attached to the given loop.
*/
BooleanEvent R1(EventLoop* loop) const;
/**
* Read the value of the left trigger 2 button on the controller.
*
* @return The state of the button.
*/
bool GetL2Button() const;
/**
* Whether the left trigger 2 button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetL2ButtonPressed();
/**
* Whether the left trigger 2 button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetL2ButtonReleased();
/**
* Constructs an event instance around the left trigger 2 button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the left trigger 2 button's
* digital signal attached to the given loop.
*/
BooleanEvent L2(EventLoop* loop) const;
/**
* Read the value of the right trigger 2 button on the controller.
*
* @return The state of the button.
*/
bool GetR2Button() const;
/**
* Whether the right trigger 2 button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetR2ButtonPressed();
/**
* Whether the right trigger 2 button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetR2ButtonReleased();
/**
* Constructs an event instance around the right trigger 2 button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the right trigger 2 button's
* digital signal attached to the given loop.
*/
BooleanEvent R2(EventLoop* loop) const;
/**
* Read the value of the create button on the controller.
*
* @return The state of the button.
*/
bool GetCreateButton() const;
/**
* Whether the create button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetCreateButtonPressed();
/**
* Whether the create button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetCreateButtonReleased();
/**
* Constructs an event instance around the create button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the create button's
* digital signal attached to the given loop.
*/
BooleanEvent Create(EventLoop* loop) const;
/**
* Read the value of the options button on the controller.
*
* @return The state of the button.
*/
bool GetOptionsButton() const;
/**
* Whether the options button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetOptionsButtonPressed();
/**
* Whether the options button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetOptionsButtonReleased();
/**
* Constructs an event instance around the options button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the options button's
* digital signal attached to the given loop.
*/
BooleanEvent Options(EventLoop* loop) const;
/**
* Read the value of the L3 (left stick) button on the controller.
*
* @return The state of the button.
*/
bool GetL3Button() const;
/**
* Whether the L3 (left stick) button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetL3ButtonPressed();
/**
* Whether the L3 (left stick) button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetL3ButtonReleased();
/**
* Constructs an event instance around the L3 (left stick) button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the L3 (left stick) button's
* digital signal attached to the given loop.
*/
BooleanEvent L3(EventLoop* loop) const;
/**
* Read the value of the R3 (right stick) button on the controller.
*
* @return The state of the button.
*/
bool GetR3Button() const;
/**
* Whether the R3 (right stick) button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetR3ButtonPressed();
/**
* Whether the R3 (right stick) button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetR3ButtonReleased();
/**
* Constructs an event instance around the R3 (right stick) button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the R3 (right stick) button's
* digital signal attached to the given loop.
*/
BooleanEvent R3(EventLoop* loop) const;
/**
* Read the value of the PlayStation button on the controller.
*
* @return The state of the button.
*/
bool GetPSButton() const;
/**
* Whether the PlayStation button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetPSButtonPressed();
/**
* Whether the PlayStation button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetPSButtonReleased();
/**
* Constructs an event instance around the PlayStation button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the PlayStation button's
* digital signal attached to the given loop.
*/
BooleanEvent PS(EventLoop* loop) const;
/**
* Read the value of the touchpad button on the controller.
*
* @return The state of the button.
*/
bool GetTouchpadButton() const;
/**
* Whether the touchpad button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetTouchpadButtonPressed();
/**
* Whether the touchpad button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetTouchpadButtonReleased();
/**
* Constructs an event instance around the touchpad button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the touchpad button's
* digital signal attached to the given loop.
*/
BooleanEvent Touchpad(EventLoop* loop) const;
/**
* Read the value of the touchpad button on the controller.
*
* @return The state of the button.
* @deprecated Use GetTouchpadButton instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be
* automatically generated.
*/
[[deprecated("Use GetTouchpadButton instead")]]
bool GetTouchpad() const;
/**
* Whether the touchpad was pressed since the last check.
*
* @return Whether the touchpad was pressed since the last check.
* @deprecated Use GetTouchpadButtonPressed instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetTouchpadButtonPressed instead")]]
bool GetTouchpadPressed();
/**
* Whether the touchpad was released since the last check.
*
* @return Whether the touchpad was released since the last check.
* @deprecated Use GetLeftBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use GetTouchpadButtonReleased instead")]]
bool GetTouchpadReleased();
/** Represents a digital button on an PS5Controller. */
struct Button {
/// Square button.
static constexpr int kSquare = 0;
/// Cross button.
static constexpr int kCross = 1;
/// Circle button.
static constexpr int kCircle = 2;
/// Triangle button.
static constexpr int kTriangle = 3;
/// Left trigger 1 button.
static constexpr int kL1 = 4;
/// Right trigger 1 button.
static constexpr int kR1 = 5;
/// Left trigger 2 button.
static constexpr int kL2 = 6;
/// Right trigger 2 button.
static constexpr int kR2 = 7;
/// Create button.
static constexpr int kCreate = 8;
/// Options button.
static constexpr int kOptions = 9;
/// L3 (left stick) button.
static constexpr int kL3 = 10;
/// R3 (right stick) button.
static constexpr int kR3 = 11;
/// PlayStation button.
static constexpr int kPS = 12;
/// Touchpad button.
static constexpr int kTouchpad = 13;
};
/** Represents an axis on an PS5Controller. */
struct Axis {
/// Left X axis.
static constexpr int kLeftX = 0;
/// Left Y axis.
static constexpr int kLeftY = 1;
/// Right X axis.
static constexpr int kRightX = 2;
/// Right Y axis.
static constexpr int kRightY = 5;
/// Left trigger 2.
static constexpr int kL2 = 3;
/// Right trigger 2.
static constexpr int kR2 = 4;
};
void InitSendable(wpi::SendableBuilder& builder) override;
};
} // namespace frc

View File

@@ -0,0 +1,655 @@
// 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 ./wpilibc/generate_hids.py. DO NOT MODIFY
#pragma once
#include <wpi/sendable/Sendable.h>
#include <wpi/sendable/SendableHelper.h>
#include "frc/GenericHID.h"
namespace frc {
/**
* Handle input from Stadia controllers connected to the Driver Station.
*
* This class handles Stadia input that comes from the Driver Station. Each
* time a value is requested the most recent value is returned. There is a
* single class instance for each controller and the mapping of ports to
* hardware buttons depends on the code in the Driver Station.
*
* Only first party controllers from Google are guaranteed to have the
* correct mapping, and only through the official NI DS. Sim is not guaranteed
* to have the same mapping, as well as any 3rd party controllers.
*/
class StadiaController : public GenericHID,
public wpi::Sendable,
public wpi::SendableHelper<StadiaController> {
public:
/**
* Construct an instance of a controller.
*
* The controller index is the USB port on the Driver Station.
*
* @param port The port on the Driver Station that the controller is plugged
* into (0-5).
*/
explicit StadiaController(int port);
~StadiaController() override = default;
StadiaController(StadiaController&&) = default;
StadiaController& operator=(StadiaController&&) = default;
/**
* Get the X axis value of left side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetLeftX() const;
/**
* Get the X axis value of right side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetRightX() const;
/**
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return the axis value.
*/
double GetLeftY() const;
/**
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return the axis value.
*/
double GetRightY() const;
/**
* Read the value of the A button on the controller.
*
* @return The state of the button.
*/
bool GetAButton() const;
/**
* Whether the A button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetAButtonPressed();
/**
* Whether the A button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetAButtonReleased();
/**
* Constructs an event instance around the A button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the A button's
* digital signal attached to the given loop.
*/
BooleanEvent A(EventLoop* loop) const;
/**
* Read the value of the B button on the controller.
*
* @return The state of the button.
*/
bool GetBButton() const;
/**
* Whether the B button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetBButtonPressed();
/**
* Whether the B button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetBButtonReleased();
/**
* Constructs an event instance around the B button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the B button's
* digital signal attached to the given loop.
*/
BooleanEvent B(EventLoop* loop) const;
/**
* Read the value of the X button on the controller.
*
* @return The state of the button.
*/
bool GetXButton() const;
/**
* Whether the X button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetXButtonPressed();
/**
* Whether the X button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetXButtonReleased();
/**
* Constructs an event instance around the X button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the X button's
* digital signal attached to the given loop.
*/
BooleanEvent X(EventLoop* loop) const;
/**
* Read the value of the Y button on the controller.
*
* @return The state of the button.
*/
bool GetYButton() const;
/**
* Whether the Y button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetYButtonPressed();
/**
* Whether the Y button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetYButtonReleased();
/**
* Constructs an event instance around the Y button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the Y button's
* digital signal attached to the given loop.
*/
BooleanEvent Y(EventLoop* loop) const;
/**
* Read the value of the left bumper button on the controller.
*
* @return The state of the button.
*/
bool GetLeftBumperButton() const;
/**
* Whether the left bumper button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetLeftBumperButtonPressed();
/**
* Whether the left bumper button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetLeftBumperButtonReleased();
/**
* Constructs an event instance around the left bumper button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the left bumper button's
* digital signal attached to the given loop.
*/
BooleanEvent LeftBumper(EventLoop* loop) const;
/**
* Read the value of the right bumper button on the controller.
*
* @return The state of the button.
*/
bool GetRightBumperButton() const;
/**
* Whether the right bumper button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetRightBumperButtonPressed();
/**
* Whether the right bumper button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetRightBumperButtonReleased();
/**
* Constructs an event instance around the right bumper button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the right bumper button's
* digital signal attached to the given loop.
*/
BooleanEvent RightBumper(EventLoop* loop) const;
/**
* Read the value of the left stick button on the controller.
*
* @return The state of the button.
*/
bool GetLeftStickButton() const;
/**
* Whether the left stick button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetLeftStickButtonPressed();
/**
* Whether the left stick button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetLeftStickButtonReleased();
/**
* Constructs an event instance around the left stick button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the left stick button's
* digital signal attached to the given loop.
*/
BooleanEvent LeftStick(EventLoop* loop) const;
/**
* Read the value of the right stick button on the controller.
*
* @return The state of the button.
*/
bool GetRightStickButton() const;
/**
* Whether the right stick button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetRightStickButtonPressed();
/**
* Whether the right stick button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetRightStickButtonReleased();
/**
* Constructs an event instance around the right stick button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the right stick button's
* digital signal attached to the given loop.
*/
BooleanEvent RightStick(EventLoop* loop) const;
/**
* Read the value of the ellipses button on the controller.
*
* @return The state of the button.
*/
bool GetEllipsesButton() const;
/**
* Whether the ellipses button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetEllipsesButtonPressed();
/**
* Whether the ellipses button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetEllipsesButtonReleased();
/**
* Constructs an event instance around the ellipses button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the ellipses button's
* digital signal attached to the given loop.
*/
BooleanEvent Ellipses(EventLoop* loop) const;
/**
* Read the value of the hamburger button on the controller.
*
* @return The state of the button.
*/
bool GetHamburgerButton() const;
/**
* Whether the hamburger button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetHamburgerButtonPressed();
/**
* Whether the hamburger button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetHamburgerButtonReleased();
/**
* Constructs an event instance around the hamburger button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the hamburger button's
* digital signal attached to the given loop.
*/
BooleanEvent Hamburger(EventLoop* loop) const;
/**
* Read the value of the stadia button on the controller.
*
* @return The state of the button.
*/
bool GetStadiaButton() const;
/**
* Whether the stadia button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetStadiaButtonPressed();
/**
* Whether the stadia button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetStadiaButtonReleased();
/**
* Constructs an event instance around the stadia button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the stadia button's
* digital signal attached to the given loop.
*/
BooleanEvent Stadia(EventLoop* loop) const;
/**
* Read the value of the right trigger button on the controller.
*
* @return The state of the button.
*/
bool GetRightTriggerButton() const;
/**
* Whether the right trigger button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetRightTriggerButtonPressed();
/**
* Whether the right trigger button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetRightTriggerButtonReleased();
/**
* Constructs an event instance around the right trigger button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the right trigger button's
* digital signal attached to the given loop.
*/
BooleanEvent RightTrigger(EventLoop* loop) const;
/**
* Read the value of the left trigger button on the controller.
*
* @return The state of the button.
*/
bool GetLeftTriggerButton() const;
/**
* Whether the left trigger button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetLeftTriggerButtonPressed();
/**
* Whether the left trigger button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetLeftTriggerButtonReleased();
/**
* Constructs an event instance around the left trigger button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the left trigger button's
* digital signal attached to the given loop.
*/
BooleanEvent LeftTrigger(EventLoop* loop) const;
/**
* Read the value of the google button on the controller.
*
* @return The state of the button.
*/
bool GetGoogleButton() const;
/**
* Whether the google button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetGoogleButtonPressed();
/**
* Whether the google button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetGoogleButtonReleased();
/**
* Constructs an event instance around the google button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the google button's
* digital signal attached to the given loop.
*/
BooleanEvent Google(EventLoop* loop) const;
/**
* Read the value of the frame button on the controller.
*
* @return The state of the button.
*/
bool GetFrameButton() const;
/**
* Whether the frame button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetFrameButtonPressed();
/**
* Whether the frame button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetFrameButtonReleased();
/**
* Constructs an event instance around the frame button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the frame button's
* digital signal attached to the given loop.
*/
BooleanEvent Frame(EventLoop* loop) const;
/**
* Read the value of the left bumper (LB) button on the controller.
*
* @return the state of the button
* @deprecated Use GetLeftBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use GetLeftBumperButton instead")]]
bool GetLeftBumper() const;
/**
* Read the value of the right bumper (RB) button on the controller.
*
* @return the state of the button
* @deprecated Use GetRightBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use GetRightBumperButton instead")]]
bool GetRightBumper() const;
/**
* Whether the left bumper (LB) was pressed since the last check.
*
* @return Whether the button was pressed since the last check
* @deprecated Use GetLeftBumperButtonPressed instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetLeftBumperButtonPressed instead")]]
bool GetLeftBumperPressed();
/**
* Whether the right bumper (RB) was pressed since the last check.
*
* @return Whether the button was pressed since the last check
* @deprecated Use GetRightBumperButtonPressed instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetRightBumperButtonPressed instead")]]
bool GetRightBumperPressed();
/**
* Whether the left bumper (LB) was released since the last check.
*
* @return Whether the button was released since the last check.
* @deprecated Use GetLeftBumperButtonReleased instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetLeftBumperButtonReleased instead")]]
bool GetLeftBumperReleased();
/**
* Whether the right bumper (RB) was released since the last check.
*
* @return Whether the button was released since the last check.
* @deprecated Use GetRightBumperButtonReleased instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetRightBumperButtonReleased instead")]]
bool GetRightBumperReleased();
/** Represents a digital button on an StadiaController. */
struct Button {
/// A button.
static constexpr int kA = 0;
/// B button.
static constexpr int kB = 1;
/// X button.
static constexpr int kX = 2;
/// Y button.
static constexpr int kY = 3;
/// Left bumper button.
static constexpr int kLeftBumper = 4;
/// Right bumper button.
static constexpr int kRightBumper = 5;
/// Left stick button.
static constexpr int kLeftStick = 6;
/// Right stick button.
static constexpr int kRightStick = 7;
/// Ellipses button.
static constexpr int kEllipses = 8;
/// Hamburger button.
static constexpr int kHamburger = 9;
/// Stadia button.
static constexpr int kStadia = 10;
/// Right trigger button.
static constexpr int kRightTrigger = 11;
/// Left trigger button.
static constexpr int kLeftTrigger = 12;
/// Google button.
static constexpr int kGoogle = 13;
/// Frame button.
static constexpr int kFrame = 14;
};
/** Represents an axis on an StadiaController. */
struct Axis {
/// Left X axis.
static constexpr int kLeftX = 0;
/// Right X axis.
static constexpr int kRightX = 3;
/// Left Y axis.
static constexpr int kLeftY = 1;
/// Right Y axis.
static constexpr int kRightY = 4;
};
void InitSendable(wpi::SendableBuilder& builder) override;
};
} // namespace frc

View File

@@ -0,0 +1,554 @@
// 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 ./wpilibc/generate_hids.py. DO NOT MODIFY
#pragma once
#include <wpi/sendable/Sendable.h>
#include <wpi/sendable/SendableHelper.h>
#include "frc/GenericHID.h"
namespace frc {
/**
* Handle input from Xbox controllers connected to the Driver Station.
*
* This class handles Xbox input that comes from the Driver Station. Each
* time a value is requested the most recent value is returned. There is a
* single class instance for each controller and the mapping of ports to
* hardware buttons depends on the code in the Driver Station.
*
* Only first party controllers from Microsoft are guaranteed to have the
* correct mapping, and only through the official NI DS. Sim is not guaranteed
* to have the same mapping, as well as any 3rd party controllers.
*/
class XboxController : public GenericHID,
public wpi::Sendable,
public wpi::SendableHelper<XboxController> {
public:
/**
* Construct an instance of a controller.
*
* The controller index is the USB port on the Driver Station.
*
* @param port The port on the Driver Station that the controller is plugged
* into (0-5).
*/
explicit XboxController(int port);
~XboxController() override = default;
XboxController(XboxController&&) = default;
XboxController& operator=(XboxController&&) = default;
/**
* Get the X axis value of left side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetLeftX() const;
/**
* Get the X axis value of right side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetRightX() const;
/**
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return the axis value.
*/
double GetLeftY() const;
/**
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return the axis value.
*/
double GetRightY() const;
/**
* Get the left trigger axis value of the controller. Note that this axis
* is bound to the range of [0, 1] as opposed to the usual [-1, 1].
*
* @return the axis value.
*/
double GetLeftTriggerAxis() const;
/**
* Constructs an event 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 event 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 event to.
* @return an event instance that is true when the left trigger's axis
* exceeds the provided threshold, attached to the given event loop
*/
BooleanEvent LeftTrigger(double threshold, EventLoop* loop) const;
/**
* Constructs an event instance around the axis value of the left trigger.
* The returned trigger will be true when the axis value is greater than 0.5.
* @param loop the event loop instance to attach the event to.
* @return an event instance that is true when the left trigger's axis
* exceeds 0.5, attached to the given event loop
*/
BooleanEvent LeftTrigger(EventLoop* loop) const;
/**
* Get the right trigger axis value of the controller. Note that this axis
* is bound to the range of [0, 1] as opposed to the usual [-1, 1].
*
* @return the axis value.
*/
double GetRightTriggerAxis() const;
/**
* Constructs an event 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 event 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 event to.
* @return an event instance that is true when the right trigger's axis
* exceeds the provided threshold, attached to the given event loop
*/
BooleanEvent RightTrigger(double threshold, EventLoop* loop) const;
/**
* Constructs an event instance around the axis value of the right trigger.
* The returned trigger will be true when the axis value is greater than 0.5.
* @param loop the event loop instance to attach the event to.
* @return an event instance that is true when the right trigger's axis
* exceeds 0.5, attached to the given event loop
*/
BooleanEvent RightTrigger(EventLoop* loop) const;
/**
* Read the value of the A button on the controller.
*
* @return The state of the button.
*/
bool GetAButton() const;
/**
* Whether the A button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetAButtonPressed();
/**
* Whether the A button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetAButtonReleased();
/**
* Constructs an event instance around the A button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the A button's
* digital signal attached to the given loop.
*/
BooleanEvent A(EventLoop* loop) const;
/**
* Read the value of the B button on the controller.
*
* @return The state of the button.
*/
bool GetBButton() const;
/**
* Whether the B button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetBButtonPressed();
/**
* Whether the B button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetBButtonReleased();
/**
* Constructs an event instance around the B button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the B button's
* digital signal attached to the given loop.
*/
BooleanEvent B(EventLoop* loop) const;
/**
* Read the value of the X button on the controller.
*
* @return The state of the button.
*/
bool GetXButton() const;
/**
* Whether the X button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetXButtonPressed();
/**
* Whether the X button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetXButtonReleased();
/**
* Constructs an event instance around the X button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the X button's
* digital signal attached to the given loop.
*/
BooleanEvent X(EventLoop* loop) const;
/**
* Read the value of the Y button on the controller.
*
* @return The state of the button.
*/
bool GetYButton() const;
/**
* Whether the Y button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetYButtonPressed();
/**
* Whether the Y button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetYButtonReleased();
/**
* Constructs an event instance around the Y button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the Y button's
* digital signal attached to the given loop.
*/
BooleanEvent Y(EventLoop* loop) const;
/**
* Read the value of the left bumper button on the controller.
*
* @return The state of the button.
*/
bool GetLeftBumperButton() const;
/**
* Whether the left bumper button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetLeftBumperButtonPressed();
/**
* Whether the left bumper button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetLeftBumperButtonReleased();
/**
* Constructs an event instance around the left bumper button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the left bumper button's
* digital signal attached to the given loop.
*/
BooleanEvent LeftBumper(EventLoop* loop) const;
/**
* Read the value of the right bumper button on the controller.
*
* @return The state of the button.
*/
bool GetRightBumperButton() const;
/**
* Whether the right bumper button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetRightBumperButtonPressed();
/**
* Whether the right bumper button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetRightBumperButtonReleased();
/**
* Constructs an event instance around the right bumper button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the right bumper button's
* digital signal attached to the given loop.
*/
BooleanEvent RightBumper(EventLoop* loop) const;
/**
* Read the value of the back button on the controller.
*
* @return The state of the button.
*/
bool GetBackButton() const;
/**
* Whether the back button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetBackButtonPressed();
/**
* Whether the back button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetBackButtonReleased();
/**
* Constructs an event instance around the back button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the back button's
* digital signal attached to the given loop.
*/
BooleanEvent Back(EventLoop* loop) const;
/**
* Read the value of the start button on the controller.
*
* @return The state of the button.
*/
bool GetStartButton() const;
/**
* Whether the start button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetStartButtonPressed();
/**
* Whether the start button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetStartButtonReleased();
/**
* Constructs an event instance around the start button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the start button's
* digital signal attached to the given loop.
*/
BooleanEvent Start(EventLoop* loop) const;
/**
* Read the value of the left stick button on the controller.
*
* @return The state of the button.
*/
bool GetLeftStickButton() const;
/**
* Whether the left stick button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetLeftStickButtonPressed();
/**
* Whether the left stick button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetLeftStickButtonReleased();
/**
* Constructs an event instance around the left stick button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the left stick button's
* digital signal attached to the given loop.
*/
BooleanEvent LeftStick(EventLoop* loop) const;
/**
* Read the value of the right stick button on the controller.
*
* @return The state of the button.
*/
bool GetRightStickButton() const;
/**
* Whether the right stick button was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
*/
bool GetRightStickButtonPressed();
/**
* Whether the right stick button was released since the last check.
*
* @return Whether the button was released since the last check.
*/
bool GetRightStickButtonReleased();
/**
* Constructs an event instance around the right stick button's
* digital signal.
*
* @param loop the event loop instance to attach the event to.
* @return an event instance representing the right stick button's
* digital signal attached to the given loop.
*/
BooleanEvent RightStick(EventLoop* loop) const;
/**
* Read the value of the left bumper (LB) button on the controller.
*
* @return the state of the button
* @deprecated Use GetLeftBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use GetLeftBumperButton instead")]]
bool GetLeftBumper() const;
/**
* Read the value of the right bumper (RB) button on the controller.
*
* @return the state of the button
* @deprecated Use GetRightBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use GetRightBumperButton instead")]]
bool GetRightBumper() const;
/**
* Whether the left bumper (LB) was pressed since the last check.
*
* @return Whether the button was pressed since the last check
* @deprecated Use GetLeftBumperButtonPressed instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetLeftBumperButtonPressed instead")]]
bool GetLeftBumperPressed();
/**
* Whether the right bumper (RB) was pressed since the last check.
*
* @return Whether the button was pressed since the last check
* @deprecated Use GetRightBumperButtonPressed instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetRightBumperButtonPressed instead")]]
bool GetRightBumperPressed();
/**
* Whether the left bumper (LB) was released since the last check.
*
* @return Whether the button was released since the last check.
* @deprecated Use GetLeftBumperButtonReleased instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetLeftBumperButtonReleased instead")]]
bool GetLeftBumperReleased();
/**
* Whether the right bumper (RB) was released since the last check.
*
* @return Whether the button was released since the last check.
* @deprecated Use GetRightBumperButtonReleased instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetRightBumperButtonReleased instead")]]
bool GetRightBumperReleased();
/** Represents a digital button on an XboxController. */
struct Button {
/// A button.
static constexpr int kA = 0;
/// B button.
static constexpr int kB = 1;
/// X button.
static constexpr int kX = 2;
/// Y button.
static constexpr int kY = 3;
/// Left bumper button.
static constexpr int kLeftBumper = 4;
/// Right bumper button.
static constexpr int kRightBumper = 5;
/// Back button.
static constexpr int kBack = 6;
/// Start button.
static constexpr int kStart = 7;
/// Left stick button.
static constexpr int kLeftStick = 8;
/// Right stick button.
static constexpr int kRightStick = 9;
};
/** Represents an axis on an XboxController. */
struct Axis {
/// Left X axis.
static constexpr int kLeftX = 0;
/// Right X axis.
static constexpr int kRightX = 4;
/// Left Y axis.
static constexpr int kLeftY = 1;
/// Right Y axis.
static constexpr int kRightY = 5;
/// Left trigger.
static constexpr int kLeftTrigger = 2;
/// Right trigger.
static constexpr int kRightTrigger = 3;
};
void InitSendable(wpi::SendableBuilder& builder) override;
};
} // namespace frc

View File

@@ -0,0 +1,43 @@
// 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 ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* AndyMark Koors40 Motor Controller with PWM control.
*
* Note that the Koors40 uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the Koors40 User
* Manual available from AndyMark.
*
* \li 2.004ms = full "forward"
* \li 1.520ms = the "high end" of the deadband range
* \li 1.500ms = center of the deadband range (off)
* \li 1.480ms = the "low end" of the deadband range
* \li 0.997ms = full "reverse"
*/
class Koors40 : public PWMMotorController {
public:
/**
* Constructor for a Koors40 connected via PWM.
*
* @param channel The PWM channel that the Koors40 is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit Koors40(int channel);
Koors40(Koors40&&) = default;
Koors40& operator=(Koors40&&) = default;
};
} // namespace frc

View File

@@ -0,0 +1,43 @@
// 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 ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* REV Robotics SPARK Flex Motor Controller with PWM control.
*
* Note that the SPARK Flex uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the SPARK Flex User
* Manual available from REV Robotics.
*
* \li 2.003ms = full "forward"
* \li 1.550ms = the "high end" of the deadband range
* \li 1.500ms = center of the deadband range (off)
* \li 1.460ms = the "low end" of the deadband range
* \li 0.999ms = full "reverse"
*/
class PWMSparkFlex : public PWMMotorController {
public:
/**
* Constructor for a SPARK Flex connected via PWM.
*
* @param channel The PWM channel that the SPARK Flex is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit PWMSparkFlex(int channel);
PWMSparkFlex(PWMSparkFlex&&) = default;
PWMSparkFlex& operator=(PWMSparkFlex&&) = default;
};
} // namespace frc

View File

@@ -0,0 +1,43 @@
// 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 ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* REV Robotics SPARK MAX Motor Controller with PWM control.
*
* Note that the SPARK MAX uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the SPARK MAX User
* Manual available from REV Robotics.
*
* \li 2.003ms = full "forward"
* \li 1.550ms = the "high end" of the deadband range
* \li 1.500ms = center of the deadband range (off)
* \li 1.460ms = the "low end" of the deadband range
* \li 0.999ms = full "reverse"
*/
class PWMSparkMax : public PWMMotorController {
public:
/**
* Constructor for a SPARK MAX connected via PWM.
*
* @param channel The PWM channel that the SPARK MAX is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit PWMSparkMax(int channel);
PWMSparkMax(PWMSparkMax&&) = default;
PWMSparkMax& operator=(PWMSparkMax&&) = default;
};
} // namespace frc

View File

@@ -0,0 +1,43 @@
// 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 ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* Cross the Road Electronics (CTRE) Talon FX Motor Controller with PWM control.
*
* Note that the Talon FX uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the Talon FX User
* Manual available from Cross the Road Electronics (CTRE).
*
* \li 2.004ms = full "forward"
* \li 1.520ms = the "high end" of the deadband range
* \li 1.500ms = center of the deadband range (off)
* \li 1.480ms = the "low end" of the deadband range
* \li 0.997ms = full "reverse"
*/
class PWMTalonFX : public PWMMotorController {
public:
/**
* Constructor for a Talon FX connected via PWM.
*
* @param channel The PWM channel that the Talon FX is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit PWMTalonFX(int channel);
PWMTalonFX(PWMTalonFX&&) = default;
PWMTalonFX& operator=(PWMTalonFX&&) = default;
};
} // namespace frc

View File

@@ -0,0 +1,43 @@
// 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 ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* Cross the Road Electronics (CTRE) Talon SRX Motor Controller with PWM control.
*
* Note that the Talon SRX uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the Talon SRX User
* Manual available from Cross the Road Electronics (CTRE).
*
* \li 2.004ms = full "forward"
* \li 1.520ms = the "high end" of the deadband range
* \li 1.500ms = center of the deadband range (off)
* \li 1.480ms = the "low end" of the deadband range
* \li 0.997ms = full "reverse"
*/
class PWMTalonSRX : public PWMMotorController {
public:
/**
* Constructor for a Talon SRX connected via PWM.
*
* @param channel The PWM channel that the Talon SRX is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit PWMTalonSRX(int channel);
PWMTalonSRX(PWMTalonSRX&&) = default;
PWMTalonSRX& operator=(PWMTalonSRX&&) = default;
};
} // namespace frc

View File

@@ -0,0 +1,43 @@
// 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 ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* Playing with Fusion Venom Motor Controller with PWM control.
*
* Note that the Venom uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the Venom User
* Manual available from Playing with Fusion.
*
* \li 2.004ms = full "forward"
* \li 1.520ms = the "high end" of the deadband range
* \li 1.500ms = center of the deadband range (off)
* \li 1.480ms = the "low end" of the deadband range
* \li 0.997ms = full "reverse"
*/
class PWMVenom : public PWMMotorController {
public:
/**
* Constructor for a Venom connected via PWM.
*
* @param channel The PWM channel that the Venom is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit PWMVenom(int channel);
PWMVenom(PWMVenom&&) = default;
PWMVenom& operator=(PWMVenom&&) = default;
};
} // namespace frc

View File

@@ -0,0 +1,43 @@
// 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 ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* Cross the Road Electronics (CTRE) Victor SPX Motor Controller with PWM control.
*
* Note that the Victor SPX uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the Victor SPX User
* Manual available from Cross the Road Electronics (CTRE).
*
* \li 2.004ms = full "forward"
* \li 1.520ms = the "high end" of the deadband range
* \li 1.500ms = center of the deadband range (off)
* \li 1.480ms = the "low end" of the deadband range
* \li 0.997ms = full "reverse"
*/
class PWMVictorSPX : public PWMMotorController {
public:
/**
* Constructor for a Victor SPX connected via PWM.
*
* @param channel The PWM channel that the Victor SPX is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit PWMVictorSPX(int channel);
PWMVictorSPX(PWMVictorSPX&&) = default;
PWMVictorSPX& operator=(PWMVictorSPX&&) = default;
};
} // namespace frc

View File

@@ -0,0 +1,43 @@
// 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 ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* REV Robotics SPARK Motor Controller with PWM control.
*
* Note that the SPARK uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the SPARK User
* Manual available from REV Robotics.
*
* \li 2.003ms = full "forward"
* \li 1.550ms = the "high end" of the deadband range
* \li 1.500ms = center of the deadband range (off)
* \li 1.460ms = the "low end" of the deadband range
* \li 0.999ms = full "reverse"
*/
class Spark : public PWMMotorController {
public:
/**
* Constructor for a SPARK connected via PWM.
*
* @param channel The PWM channel that the SPARK is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit Spark(int channel);
Spark(Spark&&) = default;
Spark& operator=(Spark&&) = default;
};
} // namespace frc

View File

@@ -0,0 +1,43 @@
// 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 ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* REV Robotics SPARKMini Motor Controller with PWM control.
*
* Note that the SPARKMini uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the SPARKMini User
* Manual available from REV Robotics.
*
* \li 2.500ms = full "forward"
* \li 1.510ms = the "high end" of the deadband range
* \li 1.500ms = center of the deadband range (off)
* \li 1.490ms = the "low end" of the deadband range
* \li 0.500ms = full "reverse"
*/
class SparkMini : public PWMMotorController {
public:
/**
* Constructor for a SPARKMini connected via PWM.
*
* @param channel The PWM channel that the SPARKMini is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit SparkMini(int channel);
SparkMini(SparkMini&&) = default;
SparkMini& operator=(SparkMini&&) = default;
};
} // namespace frc

View File

@@ -0,0 +1,43 @@
// 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 ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* Cross the Road Electronics (CTRE) Talon Motor Controller with PWM control.
*
* Note that the Talon uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the Talon User
* Manual available from Cross the Road Electronics (CTRE).
*
* \li 2.037ms = full "forward"
* \li 1.539ms = the "high end" of the deadband range
* \li 1.513ms = center of the deadband range (off)
* \li 1.487ms = the "low end" of the deadband range
* \li 0.989ms = full "reverse"
*/
class Talon : public PWMMotorController {
public:
/**
* Constructor for a Talon connected via PWM.
*
* @param channel The PWM channel that the Talon is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit Talon(int channel);
Talon(Talon&&) = default;
Talon& operator=(Talon&&) = default;
};
} // namespace frc

View File

@@ -0,0 +1,43 @@
// 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 ./wpilibc/generate_pwm_motor_controllers.py. DO NOT MODIFY
#pragma once
#include "frc/motorcontrol/PWMMotorController.h"
namespace frc {
/**
* Vex Robotics Victor SP Motor Controller with PWM control.
*
* Note that the Victor SP uses the following bounds for PWM values. These
* values should work reasonably well for most controllers, but if users
* experience issues such as asymmetric behavior around the deadband or
* inability to saturate the controller in either direction, calibration is
* recommended. The calibration procedure can be found in the Victor SP User
* Manual available from Vex Robotics.
*
* \li 2.004ms = full "forward"
* \li 1.520ms = the "high end" of the deadband range
* \li 1.500ms = center of the deadband range (off)
* \li 1.480ms = the "low end" of the deadband range
* \li 0.997ms = full "reverse"
*/
class VictorSP : public PWMMotorController {
public:
/**
* Constructor for a Victor SP connected via PWM.
*
* @param channel The PWM channel that the Victor SP is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
explicit VictorSP(int channel);
VictorSP(VictorSP&&) = default;
VictorSP& operator=(VictorSP&&) = default;
};
} // namespace frc

View File

@@ -0,0 +1,190 @@
// 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 ./wpilibc/generate_hids.py. DO NOT MODIFY
#pragma once
#include "frc/simulation/GenericHIDSim.h"
namespace frc {
class PS4Controller;
namespace sim {
/**
* Class to control a simulated PS4 controller.
*/
class PS4ControllerSim : public GenericHIDSim {
public:
/**
* Constructs from a PS4Controller object.
*
* @param joystick controller to simulate
*/
explicit PS4ControllerSim(const PS4Controller& joystick);
/**
* Constructs from a joystick port number.
*
* @param port port number
*/
explicit PS4ControllerSim(int port);
/**
* Change the left X value of the controller's joystick.
*
* @param value the new value
*/
void SetLeftX(double value);
/**
* Change the left Y value of the controller's joystick.
*
* @param value the new value
*/
void SetLeftY(double value);
/**
* Change the right X value of the controller's joystick.
*
* @param value the new value
*/
void SetRightX(double value);
/**
* Change the right Y value of the controller's joystick.
*
* @param value the new value
*/
void SetRightY(double value);
/**
* Change the value of the left trigger 2 axis on the controller.
*
* @param value the new value
*/
void SetL2Axis(double value);
/**
* Change the value of the right trigger 2 axis on the controller.
*
* @param value the new value
*/
void SetR2Axis(double value);
/**
* Change the value of the square button on the controller.
*
* @param value the new value
*/
void SetSquareButton(bool value);
/**
* Change the value of the cross button on the controller.
*
* @param value the new value
*/
void SetCrossButton(bool value);
/**
* Change the value of the circle button on the controller.
*
* @param value the new value
*/
void SetCircleButton(bool value);
/**
* Change the value of the triangle button on the controller.
*
* @param value the new value
*/
void SetTriangleButton(bool value);
/**
* Change the value of the left trigger 1 button on the controller.
*
* @param value the new value
*/
void SetL1Button(bool value);
/**
* Change the value of the right trigger 1 button on the controller.
*
* @param value the new value
*/
void SetR1Button(bool value);
/**
* Change the value of the left trigger 2 button on the controller.
*
* @param value the new value
*/
void SetL2Button(bool value);
/**
* Change the value of the right trigger 2 button on the controller.
*
* @param value the new value
*/
void SetR2Button(bool value);
/**
* Change the value of the share button on the controller.
*
* @param value the new value
*/
void SetShareButton(bool value);
/**
* Change the value of the options button on the controller.
*
* @param value the new value
*/
void SetOptionsButton(bool value);
/**
* Change the value of the L3 (left stick) button on the controller.
*
* @param value the new value
*/
void SetL3Button(bool value);
/**
* Change the value of the R3 (right stick) button on the controller.
*
* @param value the new value
*/
void SetR3Button(bool value);
/**
* Change the value of the PlayStation button on the controller.
*
* @param value the new value
*/
void SetPSButton(bool value);
/**
* Change the value of the touchpad button on the controller.
*
* @param value the new value
*/
void SetTouchpadButton(bool value);
/**
* Change the value of the touchpad button on the controller.
*
* @param value the new value
* @deprecated Use SetTouchpadButton instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be
* automatically generated.
*/
[[deprecated("Use SetTouchpadButton instead")]]
void SetTouchpad(bool value);
};
} // namespace sim
} // namespace frc

View File

@@ -0,0 +1,190 @@
// 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 ./wpilibc/generate_hids.py. DO NOT MODIFY
#pragma once
#include "frc/simulation/GenericHIDSim.h"
namespace frc {
class PS5Controller;
namespace sim {
/**
* Class to control a simulated PS5 controller.
*/
class PS5ControllerSim : public GenericHIDSim {
public:
/**
* Constructs from a PS5Controller object.
*
* @param joystick controller to simulate
*/
explicit PS5ControllerSim(const PS5Controller& joystick);
/**
* Constructs from a joystick port number.
*
* @param port port number
*/
explicit PS5ControllerSim(int port);
/**
* Change the left X value of the controller's joystick.
*
* @param value the new value
*/
void SetLeftX(double value);
/**
* Change the left Y value of the controller's joystick.
*
* @param value the new value
*/
void SetLeftY(double value);
/**
* Change the right X value of the controller's joystick.
*
* @param value the new value
*/
void SetRightX(double value);
/**
* Change the right Y value of the controller's joystick.
*
* @param value the new value
*/
void SetRightY(double value);
/**
* Change the value of the left trigger 2 axis on the controller.
*
* @param value the new value
*/
void SetL2Axis(double value);
/**
* Change the value of the right trigger 2 axis on the controller.
*
* @param value the new value
*/
void SetR2Axis(double value);
/**
* Change the value of the square button on the controller.
*
* @param value the new value
*/
void SetSquareButton(bool value);
/**
* Change the value of the cross button on the controller.
*
* @param value the new value
*/
void SetCrossButton(bool value);
/**
* Change the value of the circle button on the controller.
*
* @param value the new value
*/
void SetCircleButton(bool value);
/**
* Change the value of the triangle button on the controller.
*
* @param value the new value
*/
void SetTriangleButton(bool value);
/**
* Change the value of the left trigger 1 button on the controller.
*
* @param value the new value
*/
void SetL1Button(bool value);
/**
* Change the value of the right trigger 1 button on the controller.
*
* @param value the new value
*/
void SetR1Button(bool value);
/**
* Change the value of the left trigger 2 button on the controller.
*
* @param value the new value
*/
void SetL2Button(bool value);
/**
* Change the value of the right trigger 2 button on the controller.
*
* @param value the new value
*/
void SetR2Button(bool value);
/**
* Change the value of the create button on the controller.
*
* @param value the new value
*/
void SetCreateButton(bool value);
/**
* Change the value of the options button on the controller.
*
* @param value the new value
*/
void SetOptionsButton(bool value);
/**
* Change the value of the L3 (left stick) button on the controller.
*
* @param value the new value
*/
void SetL3Button(bool value);
/**
* Change the value of the R3 (right stick) button on the controller.
*
* @param value the new value
*/
void SetR3Button(bool value);
/**
* Change the value of the PlayStation button on the controller.
*
* @param value the new value
*/
void SetPSButton(bool value);
/**
* Change the value of the touchpad button on the controller.
*
* @param value the new value
*/
void SetTouchpadButton(bool value);
/**
* Change the value of the touchpad button on the controller.
*
* @param value the new value
* @deprecated Use SetTouchpadButton instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be
* automatically generated.
*/
[[deprecated("Use SetTouchpadButton instead")]]
void SetTouchpad(bool value);
};
} // namespace sim
} // namespace frc

View File

@@ -0,0 +1,172 @@
// 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 ./wpilibc/generate_hids.py. DO NOT MODIFY
#pragma once
#include "frc/simulation/GenericHIDSim.h"
namespace frc {
class StadiaController;
namespace sim {
/**
* Class to control a simulated Stadia controller.
*/
class StadiaControllerSim : public GenericHIDSim {
public:
/**
* Constructs from a StadiaController object.
*
* @param joystick controller to simulate
*/
explicit StadiaControllerSim(const StadiaController& joystick);
/**
* Constructs from a joystick port number.
*
* @param port port number
*/
explicit StadiaControllerSim(int port);
/**
* Change the left X value of the controller's joystick.
*
* @param value the new value
*/
void SetLeftX(double value);
/**
* Change the right X value of the controller's joystick.
*
* @param value the new value
*/
void SetRightX(double value);
/**
* Change the left Y value of the controller's joystick.
*
* @param value the new value
*/
void SetLeftY(double value);
/**
* Change the right Y value of the controller's joystick.
*
* @param value the new value
*/
void SetRightY(double value);
/**
* Change the value of the A button on the controller.
*
* @param value the new value
*/
void SetAButton(bool value);
/**
* Change the value of the B button on the controller.
*
* @param value the new value
*/
void SetBButton(bool value);
/**
* Change the value of the X button on the controller.
*
* @param value the new value
*/
void SetXButton(bool value);
/**
* Change the value of the Y button on the controller.
*
* @param value the new value
*/
void SetYButton(bool value);
/**
* Change the value of the left bumper button on the controller.
*
* @param value the new value
*/
void SetLeftBumperButton(bool value);
/**
* Change the value of the right bumper button on the controller.
*
* @param value the new value
*/
void SetRightBumperButton(bool value);
/**
* Change the value of the left stick button on the controller.
*
* @param value the new value
*/
void SetLeftStickButton(bool value);
/**
* Change the value of the right stick button on the controller.
*
* @param value the new value
*/
void SetRightStickButton(bool value);
/**
* Change the value of the ellipses button on the controller.
*
* @param value the new value
*/
void SetEllipsesButton(bool value);
/**
* Change the value of the hamburger button on the controller.
*
* @param value the new value
*/
void SetHamburgerButton(bool value);
/**
* Change the value of the stadia button on the controller.
*
* @param value the new value
*/
void SetStadiaButton(bool value);
/**
* Change the value of the right trigger button on the controller.
*
* @param value the new value
*/
void SetRightTriggerButton(bool value);
/**
* Change the value of the left trigger button on the controller.
*
* @param value the new value
*/
void SetLeftTriggerButton(bool value);
/**
* Change the value of the google button on the controller.
*
* @param value the new value
*/
void SetGoogleButton(bool value);
/**
* Change the value of the frame button on the controller.
*
* @param value the new value
*/
void SetFrameButton(bool value);
};
} // namespace sim
} // namespace frc

View File

@@ -0,0 +1,173 @@
// 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 ./wpilibc/generate_hids.py. DO NOT MODIFY
#pragma once
#include "frc/simulation/GenericHIDSim.h"
namespace frc {
class XboxController;
namespace sim {
/**
* Class to control a simulated Xbox controller.
*/
class XboxControllerSim : public GenericHIDSim {
public:
/**
* Constructs from a XboxController object.
*
* @param joystick controller to simulate
*/
explicit XboxControllerSim(const XboxController& joystick);
/**
* Constructs from a joystick port number.
*
* @param port port number
*/
explicit XboxControllerSim(int port);
/**
* Change the left X value of the controller's joystick.
*
* @param value the new value
*/
void SetLeftX(double value);
/**
* Change the right X value of the controller's joystick.
*
* @param value the new value
*/
void SetRightX(double value);
/**
* Change the left Y value of the controller's joystick.
*
* @param value the new value
*/
void SetLeftY(double value);
/**
* Change the right Y value of the controller's joystick.
*
* @param value the new value
*/
void SetRightY(double value);
/**
* Change the value of the left trigger axis on the controller.
*
* @param value the new value
*/
void SetLeftTriggerAxis(double value);
/**
* Change the value of the right trigger axis on the controller.
*
* @param value the new value
*/
void SetRightTriggerAxis(double value);
/**
* Change the value of the A button on the controller.
*
* @param value the new value
*/
void SetAButton(bool value);
/**
* Change the value of the B button on the controller.
*
* @param value the new value
*/
void SetBButton(bool value);
/**
* Change the value of the X button on the controller.
*
* @param value the new value
*/
void SetXButton(bool value);
/**
* Change the value of the Y button on the controller.
*
* @param value the new value
*/
void SetYButton(bool value);
/**
* Change the value of the left bumper button on the controller.
*
* @param value the new value
*/
void SetLeftBumperButton(bool value);
/**
* Change the value of the right bumper button on the controller.
*
* @param value the new value
*/
void SetRightBumperButton(bool value);
/**
* Change the value of the back button on the controller.
*
* @param value the new value
*/
void SetBackButton(bool value);
/**
* Change the value of the start button on the controller.
*
* @param value the new value
*/
void SetStartButton(bool value);
/**
* Change the value of the left stick button on the controller.
*
* @param value the new value
*/
void SetLeftStickButton(bool value);
/**
* Change the value of the right stick button on the controller.
*
* @param value the new value
*/
void SetRightStickButton(bool value);
/**
* Change the left bumper value of the joystick.
*
* @param value the new value
* @deprecated Use SetLeftBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use SetLeftBumperButton instead")]]
void SetLeftBumper(bool value);
/**
* Change the right bumper value of the joystick.
*
* @param value the new value
* @deprecated Use SetRightBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use SetRightBumperButton instead")]]
void SetRightBumper(bool value);
};
} // namespace sim
} // namespace frc