Files
allwpilib/wpilibc/src/generated/main/native/cpp/simulation/XboxControllerSim.cpp
Thad House 2e10f91e07 [hal,wpilib] Use new DS available API from mrccomm (#8302)
Instead of just having a max count for joystick values, there's an available mask of values. This is because in the future we're expecting there to be holes in the list of available buttons and axes. This updates everything to support that scenario.

Also, Joystick buttons, axes, and POVs all now start at 0 instead of 1.
2025-10-25 23:03:50 -07:00

98 lines
2.7 KiB
C++
Generated

// 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
#include "frc/simulation/XboxControllerSim.h"
#include "frc/XboxController.h"
using namespace frc;
using namespace frc::sim;
XboxControllerSim::XboxControllerSim(const XboxController& joystick)
: GenericHIDSim{joystick} {
SetAxesMaximumIndex(6);
SetButtonsMaximumIndex(10);
SetPOVsMaximumIndex(1);
}
XboxControllerSim::XboxControllerSim(int port) : GenericHIDSim{port} {
SetAxesMaximumIndex(6);
SetButtonsMaximumIndex(10);
SetPOVsMaximumIndex(1);
}
void XboxControllerSim::SetLeftX(double value) {
SetRawAxis(XboxController::Axis::kLeftX, value);
}
void XboxControllerSim::SetRightX(double value) {
SetRawAxis(XboxController::Axis::kRightX, value);
}
void XboxControllerSim::SetLeftY(double value) {
SetRawAxis(XboxController::Axis::kLeftY, value);
}
void XboxControllerSim::SetRightY(double value) {
SetRawAxis(XboxController::Axis::kRightY, value);
}
void XboxControllerSim::SetLeftTriggerAxis(double value) {
SetRawAxis(XboxController::Axis::kLeftTrigger, value);
}
void XboxControllerSim::SetRightTriggerAxis(double value) {
SetRawAxis(XboxController::Axis::kRightTrigger, value);
}
void XboxControllerSim::SetAButton(bool value) {
SetRawButton(XboxController::Button::kA, value);
}
void XboxControllerSim::SetBButton(bool value) {
SetRawButton(XboxController::Button::kB, value);
}
void XboxControllerSim::SetXButton(bool value) {
SetRawButton(XboxController::Button::kX, value);
}
void XboxControllerSim::SetYButton(bool value) {
SetRawButton(XboxController::Button::kY, value);
}
void XboxControllerSim::SetLeftBumperButton(bool value) {
SetRawButton(XboxController::Button::kLeftBumper, value);
}
void XboxControllerSim::SetRightBumperButton(bool value) {
SetRawButton(XboxController::Button::kRightBumper, value);
}
void XboxControllerSim::SetBackButton(bool value) {
SetRawButton(XboxController::Button::kBack, value);
}
void XboxControllerSim::SetStartButton(bool value) {
SetRawButton(XboxController::Button::kStart, value);
}
void XboxControllerSim::SetLeftStickButton(bool value) {
SetRawButton(XboxController::Button::kLeftStick, value);
}
void XboxControllerSim::SetRightStickButton(bool value) {
SetRawButton(XboxController::Button::kRightStick, value);
}
void XboxControllerSim::SetLeftBumper(bool value) {
SetRawButton(XboxController::Button::kLeftBumper, value);
}
void XboxControllerSim::SetRightBumper(bool value) {
SetRawButton(XboxController::Button::kRightBumper, value);
}