[wpilib,commands] Use Jinja to generate HID classes (#6274)

This commit is contained in:
Gold856
2024-06-08 12:59:07 -04:00
committed by GitHub
parent a0efc9ca31
commit 65c6306047
75 changed files with 7622 additions and 4546 deletions

View File

@@ -0,0 +1,187 @@
// 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")]]
void SetTouchpad(bool value);
};
} // namespace sim
} // namespace frc

View File

@@ -0,0 +1,187 @@
// 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")]]
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,167 @@
// 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")]]
void SetLeftBumper(bool value);
/**
* Change the right bumper value of the joystick.
*
* @param value the new value
*/
[[deprecated("Use SetRightBumperButton instead")]]
void SetRightBumper(bool value);
};
} // namespace sim
} // namespace frc