2020-12-26 14:12:05 -08:00
|
|
|
// 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.
|
2020-07-15 23:48:09 -07:00
|
|
|
|
2024-06-08 12:59:07 -04:00
|
|
|
// THIS FILE WAS AUTO-GENERATED BY ./wpilibc/generate_hids.py. DO NOT MODIFY
|
|
|
|
|
|
2020-07-15 23:48:09 -07:00
|
|
|
#include "frc/simulation/XboxControllerSim.h"
|
|
|
|
|
|
|
|
|
|
#include "frc/XboxController.h"
|
|
|
|
|
|
|
|
|
|
using namespace frc;
|
|
|
|
|
using namespace frc::sim;
|
|
|
|
|
|
|
|
|
|
XboxControllerSim::XboxControllerSim(const XboxController& joystick)
|
|
|
|
|
: GenericHIDSim{joystick} {
|
2025-10-25 23:03:50 -07:00
|
|
|
SetAxesMaximumIndex(6);
|
|
|
|
|
SetButtonsMaximumIndex(10);
|
|
|
|
|
SetPOVsMaximumIndex(1);
|
2020-07-15 23:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XboxControllerSim::XboxControllerSim(int port) : GenericHIDSim{port} {
|
2025-10-25 23:03:50 -07:00
|
|
|
SetAxesMaximumIndex(6);
|
|
|
|
|
SetButtonsMaximumIndex(10);
|
|
|
|
|
SetPOVsMaximumIndex(1);
|
2020-07-15 23:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
2021-08-14 20:00:46 +03:00
|
|
|
void XboxControllerSim::SetLeftX(double value) {
|
|
|
|
|
SetRawAxis(XboxController::Axis::kLeftX, value);
|
2020-07-15 23:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
2021-08-14 20:00:46 +03:00
|
|
|
void XboxControllerSim::SetRightX(double value) {
|
|
|
|
|
SetRawAxis(XboxController::Axis::kRightX, value);
|
2020-07-15 23:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
2021-08-14 20:00:46 +03:00
|
|
|
void XboxControllerSim::SetLeftY(double value) {
|
|
|
|
|
SetRawAxis(XboxController::Axis::kLeftY, value);
|
2020-07-15 23:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
2021-08-14 20:00:46 +03:00
|
|
|
void XboxControllerSim::SetRightY(double value) {
|
|
|
|
|
SetRawAxis(XboxController::Axis::kRightY, value);
|
2020-07-15 23:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
2021-08-14 20:00:46 +03:00
|
|
|
void XboxControllerSim::SetLeftTriggerAxis(double value) {
|
|
|
|
|
SetRawAxis(XboxController::Axis::kLeftTrigger, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XboxControllerSim::SetRightTriggerAxis(double value) {
|
|
|
|
|
SetRawAxis(XboxController::Axis::kRightTrigger, value);
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-08 12:59:07 -04:00
|
|
|
void XboxControllerSim::SetAButton(bool value) {
|
|
|
|
|
SetRawButton(XboxController::Button::kA, value);
|
2021-08-14 20:00:46 +03:00
|
|
|
}
|
|
|
|
|
|
2024-06-08 12:59:07 -04:00
|
|
|
void XboxControllerSim::SetBButton(bool value) {
|
|
|
|
|
SetRawButton(XboxController::Button::kB, value);
|
2021-08-14 20:00:46 +03:00
|
|
|
}
|
|
|
|
|
|
2024-06-08 12:59:07 -04:00
|
|
|
void XboxControllerSim::SetXButton(bool value) {
|
|
|
|
|
SetRawButton(XboxController::Button::kX, value);
|
2021-08-14 20:00:46 +03:00
|
|
|
}
|
|
|
|
|
|
2024-06-08 12:59:07 -04:00
|
|
|
void XboxControllerSim::SetYButton(bool value) {
|
|
|
|
|
SetRawButton(XboxController::Button::kY, value);
|
2020-07-15 23:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
2024-06-08 12:59:07 -04:00
|
|
|
void XboxControllerSim::SetLeftBumperButton(bool value) {
|
|
|
|
|
SetRawButton(XboxController::Button::kLeftBumper, value);
|
2020-07-15 23:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
2024-06-08 12:59:07 -04:00
|
|
|
void XboxControllerSim::SetRightBumperButton(bool value) {
|
|
|
|
|
SetRawButton(XboxController::Button::kRightBumper, value);
|
2020-07-15 23:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
2024-06-08 12:59:07 -04:00
|
|
|
void XboxControllerSim::SetBackButton(bool value) {
|
|
|
|
|
SetRawButton(XboxController::Button::kBack, value);
|
2020-07-15 23:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
2024-06-08 12:59:07 -04:00
|
|
|
void XboxControllerSim::SetStartButton(bool value) {
|
|
|
|
|
SetRawButton(XboxController::Button::kStart, value);
|
2020-07-15 23:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
2024-06-08 12:59:07 -04:00
|
|
|
void XboxControllerSim::SetLeftStickButton(bool value) {
|
|
|
|
|
SetRawButton(XboxController::Button::kLeftStick, value);
|
2020-07-15 23:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
2024-06-08 12:59:07 -04:00
|
|
|
void XboxControllerSim::SetRightStickButton(bool value) {
|
|
|
|
|
SetRawButton(XboxController::Button::kRightStick, value);
|
2020-07-15 23:48:09 -07:00
|
|
|
}
|
2024-08-26 20:32:09 -04:00
|
|
|
|
|
|
|
|
void XboxControllerSim::SetLeftBumper(bool value) {
|
|
|
|
|
SetRawButton(XboxController::Button::kLeftBumper, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void XboxControllerSim::SetRightBumper(bool value) {
|
|
|
|
|
SetRawButton(XboxController::Button::kRightBumper, value);
|
|
|
|
|
}
|