From d4e520a39c0786bf0f5a144f8940144912e4ef17 Mon Sep 17 00:00:00 2001 From: dkt01 Date: Mon, 22 Aug 2022 20:39:20 -0500 Subject: [PATCH] Seems to work --- src/PlatformApp/PlatformApp.h | 32 +++++++++++++-------------- src/XBoxController/XBoxController.cpp | 3 ++- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/PlatformApp/PlatformApp.h b/src/PlatformApp/PlatformApp.h index 25111f9..d458855 100644 --- a/src/PlatformApp/PlatformApp.h +++ b/src/PlatformApp/PlatformApp.h @@ -109,10 +109,10 @@ namespace motorConfig { constexpr static auto voltCompSat = 11.0_V; constexpr static auto nominalOutputForward = 0.0; constexpr static auto nominalOutputReverse = 0.0; - constexpr static auto peakOutputForward = 1.0; - constexpr static auto peakOutputReverse = -1.0; - constexpr static auto openLoopRamp = 750_ms; - constexpr static auto closedLoopRamp = 750_ms; + constexpr static auto peakOutputForward = 0.2; + constexpr static auto peakOutputReverse = -0.2; + constexpr static auto openLoopRamp = 3000_ms; + constexpr static auto closedLoopRamp = 3000_ms; constexpr static auto pid0_selectedSensor = ctre::phoenix::motorcontrol::FeedbackDevice::IntegratedSensor; constexpr static auto pid0_kP = controlLoop::drive::drive::kP; constexpr static auto pid0_kI = controlLoop::drive::drive::kI; @@ -139,10 +139,10 @@ namespace motorConfig { constexpr static auto voltCompSat = 11.0_V; constexpr static auto nominalOutputForward = 0.0; constexpr static auto nominalOutputReverse = 0.0; - constexpr static auto peakOutputForward = 1.0; - constexpr static auto peakOutputReverse = -1.0; - constexpr static auto openLoopRamp = 750_ms; - constexpr static auto closedLoopRamp = 750_ms; + constexpr static auto peakOutputForward = 0.2; + constexpr static auto peakOutputReverse = -0.2; + constexpr static auto openLoopRamp = 3000_ms; + constexpr static auto closedLoopRamp = 3000_ms; constexpr static auto pid0_selectedSensor = ctre::phoenix::motorcontrol::FeedbackDevice::IntegratedSensor; constexpr static auto pid0_kP = controlLoop::drive::drive::kP; constexpr static auto pid0_kI = controlLoop::drive::drive::kI; @@ -169,10 +169,10 @@ namespace motorConfig { constexpr static auto voltCompSat = 11.0_V; constexpr static auto nominalOutputForward = 0.0; constexpr static auto nominalOutputReverse = 0.0; - constexpr static auto peakOutputForward = 1.0; - constexpr static auto peakOutputReverse = -1.0; - constexpr static auto openLoopRamp = 750_ms; - constexpr static auto closedLoopRamp = 750_ms; + constexpr static auto peakOutputForward = 0.2; + constexpr static auto peakOutputReverse = -0.2; + constexpr static auto openLoopRamp = 3000_ms; + constexpr static auto closedLoopRamp = 3000_ms; constexpr static auto pid0_selectedSensor = ctre::phoenix::motorcontrol::FeedbackDevice::IntegratedSensor; constexpr static auto pid0_kP = controlLoop::drive::drive::kP; constexpr static auto pid0_kI = controlLoop::drive::drive::kI; @@ -199,10 +199,10 @@ namespace motorConfig { constexpr static auto voltCompSat = 11.0_V; constexpr static auto nominalOutputForward = 0.0; constexpr static auto nominalOutputReverse = 0.0; - constexpr static auto peakOutputForward = 1.0; - constexpr static auto peakOutputReverse = -1.0; - constexpr static auto openLoopRamp = 750_ms; - constexpr static auto closedLoopRamp = 750_ms; + constexpr static auto peakOutputForward = 0.2; + constexpr static auto peakOutputReverse = -0.2; + constexpr static auto openLoopRamp = 3000_ms; + constexpr static auto closedLoopRamp = 3000_ms; constexpr static auto pid0_selectedSensor = ctre::phoenix::motorcontrol::FeedbackDevice::IntegratedSensor; constexpr static auto pid0_kP = controlLoop::drive::drive::kP; constexpr static auto pid0_kI = controlLoop::drive::drive::kI; diff --git a/src/XBoxController/XBoxController.cpp b/src/XBoxController/XBoxController.cpp index 409cd8d..0c216e6 100644 --- a/src/XBoxController/XBoxController.cpp +++ b/src/XBoxController/XBoxController.cpp @@ -81,7 +81,8 @@ bool XBoxController::Initialize() { SDL_GameControllerEventState(SDL_ENABLE); m_pJoystick = candidateJoystick; return true; - } else if (num_axes == 7 && (num_buttons == 15 || num_buttons == 12) && num_hats == 1) { + } else if ((num_axes == 7 || num_axes == 6) && (num_buttons == 16 || num_buttons == 15 || num_buttons == 12) && + num_hats == 1) { std::cout << "Connected to new XBox Series controller\n"; SDL_GameControllerEventState(SDL_ENABLE); m_pJoystick = candidateJoystick;