[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"
#include "wpi/math/util/MathUtil.hpp"
@@ -18,7 +18,7 @@ class Robot : public wpi::TimedRobot {
void TeleopPeriodic() override { DriveWithJoystick(true); }
private:
wpi::XboxController m_controller{0};
wpi::Gamepad m_controller{0};
Drivetrain m_swerve;
// Slew rate limiters to make joystick inputs more gentle; 1/3 sec from 0
@@ -28,14 +28,14 @@ class Robot : public wpi::TimedRobot {
wpi::math::SlewRateLimiter<wpi::units::scalar> m_rotLimiter{3 / 1_s};
void DriveWithJoystick(bool fieldRelative) {
// 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_xspeedLimiter.Calculate(wpi::math::ApplyDeadband(
m_controller.GetLeftY(), 0.02)) *
Drivetrain::kMaxSpeed;
// Get the y speed or sideways/strafe speed. We are inverting this because
// we want a positive value when we pull to the left. Xbox controllers
// we want a positive value when we pull to the left. Gamepads
// return positive values when you pull to the right by default.
const auto ySpeed = -m_yspeedLimiter.Calculate(wpi::math::ApplyDeadband(
m_controller.GetLeftX(), 0.02)) *
@@ -43,7 +43,7 @@ class Robot : public wpi::TimedRobot {
// 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(wpi::math::ApplyDeadband(
m_controller.GetRightX(), 0.02)) *