[wpilib] Prefix all NI DS specific controller classes (#8596)

Easier then the last one that put everything in a sub namespace. By
prefixing the name less things break, and intellisense will be less
confusing to new users during the transition.
This commit is contained in:
Thad House
2026-02-06 21:36:01 -08:00
committed by GitHub
parent 77b2f9802e
commit 5c5d5222f4
133 changed files with 1959 additions and 2682 deletions

View File

@@ -3,7 +3,7 @@
// the WPILib BSD license file in the root directory of this project.
#include "Drivetrain.hpp"
#include "wpi/driverstation/XboxController.hpp"
#include "wpi/driverstation/Gamepad.hpp"
#include "wpi/framework/TimedRobot.hpp"
#include "wpi/math/filter/SlewRateLimiter.hpp"
@@ -15,14 +15,14 @@ class Robot : public wpi::TimedRobot {
}
void TeleopPeriodic() override {
// Get the x speed. We are inverting this because Xbox controllers return
// Get the x speed. We are inverting this because gamepads return
// negative values when we push forward.
const auto xSpeed = -m_speedLimiter.Calculate(m_controller.GetLeftY()) *
Drivetrain::kMaxSpeed;
// Get the rate of angular rotation. We are inverting this because we want a
// positive value when we pull to the left (remember, CCW is positive in
// mathematics). Xbox controllers return positive values when you pull to
// mathematics). Gamepads return positive values when you pull to
// the right by default.
const auto rot = -m_rotLimiter.Calculate(m_controller.GetRightX()) *
Drivetrain::kMaxAngularSpeed;
@@ -31,7 +31,7 @@ class Robot : public wpi::TimedRobot {
}
private:
wpi::XboxController m_controller{0};
wpi::Gamepad m_controller{0};
// Slew rate limiters to make joystick inputs more gentle; 1/3 sec from 0
// to 1.