mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[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:
@@ -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"
|
||||
|
||||
@@ -17,14 +17,14 @@ class Robot : public wpi::TimedRobot {
|
||||
void RobotPeriodic() override { m_drive.Periodic(); }
|
||||
|
||||
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;
|
||||
@@ -35,7 +35,7 @@ class Robot : public wpi::TimedRobot {
|
||||
void SimulationPeriodic() override { m_drive.SimulationPeriodic(); }
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user