// 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 {% macro capitalize_first(string) -%} {{ string[0]|capitalize + string[1:] }} {%- endmacro %} #include "frc/simulation/{{ ConsoleName }}ControllerSim.h" #include "frc/{{ ConsoleName }}Controller.h" using namespace frc; using namespace frc::sim; {{ ConsoleName }}ControllerSim::{{ ConsoleName }}ControllerSim(const {{ ConsoleName }}Controller& joystick) : GenericHIDSim{joystick} { SetAxisCount({{ sticks|length + triggers|length }}); SetButtonCount({{ buttons|length }}); SetPOVCount(1); } {{ ConsoleName }}ControllerSim::{{ ConsoleName }}ControllerSim(int port) : GenericHIDSim{port} { SetAxisCount({{ sticks|length + triggers|length }}); SetButtonCount({{ buttons|length }}); SetPOVCount(1); } {% for stick in sticks %} void {{ ConsoleName }}ControllerSim::Set{{ stick.NameParts|map("capitalize")|join }}(double value) { SetRawAxis({{ ConsoleName }}Controller::Axis::k{{ stick.NameParts|map("capitalize")|join }}, value); } {% endfor -%} {% for trigger in triggers %} void {{ ConsoleName }}ControllerSim::Set{{ capitalize_first(trigger.name) }}Axis(double value) { SetRawAxis({{ ConsoleName }}Controller::Axis::k{{ capitalize_first(trigger.name) }}, value); } {% endfor -%} {% for button in buttons %} void {{ ConsoleName }}ControllerSim::Set{{ capitalize_first(button.name) }}Button(bool value) { SetRawButton({{ ConsoleName }}Controller::Button::k{{ capitalize_first(button.name) }}, value); } {% endfor -%} {% if ConsoleName == "Xbox" %} void {{ ConsoleName }}ControllerSim::SetLeftBumper(bool value) { SetRawButton({{ ConsoleName }}Controller::Button::kLeftBumper, value); } void {{ ConsoleName }}ControllerSim::SetRightBumper(bool value) { SetRawButton({{ ConsoleName }}Controller::Button::kRightBumper, value); } {% elif ConsoleName == "PS4" or ConsoleName == "PS5" %} void {{ ConsoleName }}ControllerSim::SetTouchpad(bool value) { SetRawButton({{ ConsoleName }}Controller::Button::kTouchpad, value); } {% endif %}