From f4ebacfed37a6ce1c0426a06437f4e22399ff3b4 Mon Sep 17 00:00:00 2001 From: 5690 <5690Programmers@gmail.com> Date: Wed, 17 Apr 2024 19:55:42 -0500 Subject: [PATCH 1/5] intaking work, arm fix, sim fix --- src/main/cpp/RobotContainer.cpp | 118 ++++++++---------- .../pathplanner/paths/Note 2 to Speaker.path | 2 +- src/main/include/Constants.h | 5 +- src/main/include/subsystems/ArmSubsystem.h | 2 +- 4 files changed, 60 insertions(+), 67 deletions(-) diff --git a/src/main/cpp/RobotContainer.cpp b/src/main/cpp/RobotContainer.cpp index 3df8618c..865a257e 100644 --- a/src/main/cpp/RobotContainer.cpp +++ b/src/main/cpp/RobotContainer.cpp @@ -204,26 +204,23 @@ void RobotContainer::ConfigureButtonBindings() { #ifndef TEST_SWERVE_BOT void RobotContainer::ConfigureAutoBindings() { - // Maps to 9 on keyboard - m_operatorController.A().OnTrue(frc2::InstantCommand([this] { - if (!m_state.m_active) { - m_state.m_currentState = - RobotState::ScoringSpeaker; - m_state.SetDesiredState(); - } - }).ToPtr()); - - // Maps to 8 on keyboard - m_operatorController.B().OnTrue(frc2::InstantCommand([this] { - if (!m_state.m_active) { - m_state.m_currentState = - RobotState::ScoringSubwoofer; - m_state.SetDesiredState(); - } - }).ToPtr()); + // Maps to / on keyboard + // m_operatorController.Button(0).OnTrue( + // TODO: GOTO APPROX SCORING + // ); + + // Maps to NUM LOCK on keyboard + m_operatorController.Button(2).OnTrue( + // GOTO SRC + frc2::InstantCommand([this] { + if (!m_state.m_active) { + m_state.m_currentState = RobotState::SourceCenter; + m_state.SetDesiredState(); + } + }).ToPtr()); // Maps to 7 on keyboard - m_operatorController.X().OnTrue(frc2::InstantCommand([this] { + m_operatorController.Button(3).OnTrue(frc2::InstantCommand([this] { if (!m_state.m_active) { m_state.m_currentState = RobotState::ScoringAmp; @@ -231,78 +228,73 @@ void RobotContainer::ConfigureAutoBindings() { } }).ToPtr()); - // Maps to 4 on keyboard - m_operatorController.Y().OnTrue(frc2::InstantCommand([this] { - if (!m_state.m_active) { - m_state.m_currentState = - RobotState::AutoSequenceAmp; - m_state.SetDesiredState(); - } - }).ToPtr()); - - // Maps to 1 on keyboard - m_operatorController.LeftBumper().OnTrue(frc2::InstantCommand([this] { + // Maps to 8 on keyboard + m_operatorController.Button(4).OnTrue(frc2::InstantCommand([this] { if (!m_state.m_active) { m_state.m_currentState = - RobotState::ClimbStageLeft; + RobotState::ScoringSpeaker; m_state.SetDesiredState(); } }).ToPtr()); - // Maps to 2 on keyboard - // m_operatorController.RightBumper().OnTrue( - // frc2::InstantCommand([this] { - // if (!m_state.m_active) { - // m_state.m_currentState = RobotState::ClimbStageCenter; - // m_state.SetDesiredState(); - // } - // }).ToPtr()); - m_operatorController.RightBumper().OnTrue( - m_rightClimb.MoveToPositionAbsolute(18_in)); + // Maps to 9 on keyboard + m_operatorController.Button(5).OnTrue(frc2::InstantCommand([this] { + if (!m_state.m_active) { + m_state.m_currentState = + RobotState::ScoringSubwoofer; + m_state.SetDesiredState(); + } + }).ToPtr()); - // Maps to 3 on keyboard - m_operatorController.LeftStick().OnTrue(frc2::InstantCommand([this] { + // Maps to 4 on keyboard + m_operatorController.Button(7).OnTrue(frc2::InstantCommand([this] { if (!m_state.m_active) { m_state.m_currentState = - RobotState::ClimbStageRight; + RobotState::AutoSequenceAmp; m_state.SetDesiredState(); } }).ToPtr()); - m_operatorController.Button(15).OnTrue(frc2::InstantCommand([this] { - if (!m_state.m_active) { - m_state.m_currentState = - RobotState::SourceLeft; - m_state.SetDesiredState(); - } - }).ToPtr()); + // Maps to 5 on keyboard + m_operatorController.Button(8).OnTrue( + frc2::InstantCommand([this] { m_drive.ZeroHeading(); }).ToPtr()); - m_operatorController.Button(16).OnTrue(frc2::InstantCommand([this] { - if (!m_state.m_active) { - m_state.m_currentState = - RobotState::SourceCenter; - m_state.SetDesiredState(); - } - }).ToPtr()); + // Maps to 6 on keyboard + m_operatorController.Button(9).OnTrue( + m_rightClimb.MoveToPositionAbsolute(18_in).AlongWith( + m_leftClimb.MoveToPositionAbsolute(18_in))); + + // Maps to 1 on keyboard + // m_operatorController.Button(9).OnTrue(frc2::InstantCommand([this] { + // if (!m_state.m_active) { + // m_state.m_currentState = + // RobotState::ClimbStageLeft; + // m_state.SetDesiredState(); + // } + // }).ToPtr()); - m_operatorController.Button(17).OnTrue(frc2::InstantCommand([this] { + // Maps to 2 on keyboard + m_operatorController.Button(15).OnTrue(frc2::InstantCommand([this] { if (!m_state.m_active) { m_state.m_currentState = - RobotState::SourceRight; + RobotState::ClimbStageCenter; m_state.SetDesiredState(); } }).ToPtr()); - m_operatorController.Button(18).OnTrue(frc2::InstantCommand([this] { + // Maps to 3 on keyboard + m_operatorController.Button(16).OnTrue(frc2::InstantCommand([this] { if (!m_state.m_active) { m_state.m_currentState = - RobotState::Funni; + RobotState::ClimbStageRight; m_state.SetDesiredState(); } }).ToPtr()); - m_operatorController.Button(20).OnTrue( - frc2::InstantCommand([this] { m_drive.ZeroHeading(); }).ToPtr()); + // Maps to 0 on keyboard + // m_operatorController.Button(17).OnTrue( + // TODO: FEED SCORING COMMAND + // ); } #endif diff --git a/src/main/deploy/pathplanner/paths/Note 2 to Speaker.path b/src/main/deploy/pathplanner/paths/Note 2 to Speaker.path index 39e8f193..ac0a472f 100644 --- a/src/main/deploy/pathplanner/paths/Note 2 to Speaker.path +++ b/src/main/deploy/pathplanner/paths/Note 2 to Speaker.path @@ -33,7 +33,7 @@ "eventMarkers": [ { "name": "New Event Marker", - "waypointRelativePos": 0.0, + "waypointRelativePos": 0.2, "command": { "type": "parallel", "data": { diff --git a/src/main/include/Constants.h b/src/main/include/Constants.h index fef1a93f..14f998b5 100644 --- a/src/main/include/Constants.h +++ b/src/main/include/Constants.h @@ -376,7 +376,7 @@ constexpr double kVectorSpeed = -0.4; // These need to be different // TODO: CHANGE TO VELOCITY RATHER THAN % OUTPUT -constexpr double kAmpLowerSpeed = -0.254 * 1.4; // .264 +constexpr double kAmpLowerSpeed = -0.254 * 1.9; // .264 constexpr double kAmpUpperSpeed = -0.168 * 1.4; // .278 // These should match @@ -486,7 +486,8 @@ constexpr double kRotationHomingSpeed = .15; constexpr int kArmGearRatio = 125; constexpr units::degree_t kArmRelativeDistancePerRev = 360_deg * (1 / 8.75); constexpr units::degree_t kArmAbsoluteDistancePerRev = 360_deg; -constexpr units::degree_t kAmpRotation = 190_deg; +constexpr units::degree_t kAmpRotation = 142_deg; +constexpr units::degree_t kMaxRotation = 190_deg; constexpr units::degree_t kHomeRotation = 10_deg; constexpr units::degrees_per_second_t kDefaultVelocity = 10_deg_per_s; constexpr double kVelocityScalar = 1.0; diff --git a/src/main/include/subsystems/ArmSubsystem.h b/src/main/include/subsystems/ArmSubsystem.h index 935de25c..516b1a81 100644 --- a/src/main/include/subsystems/ArmSubsystem.h +++ b/src/main/include/subsystems/ArmSubsystem.h @@ -17,7 +17,7 @@ class ArmSubsystem : public RotationalSingleAxisSubsystem< {// Min distance ArmConstants::kHomeRotation, // Max distance - ArmConstants::kAmpRotation, + ArmConstants::kMaxRotation, // Distance per revolution of relative encoder ArmConstants::kArmRelativeDistancePerRev, // Distance per revolution of absolute encoder From 1113e56c2f78e352c43d272b26b35718bf3420f3 Mon Sep 17 00:00:00 2001 From: 5690 <5690Programmers@gmail.com> Date: Wed, 17 Apr 2024 20:00:08 -0500 Subject: [PATCH 2/5] more binding work --- src/main/cpp/RobotContainer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/cpp/RobotContainer.cpp b/src/main/cpp/RobotContainer.cpp index 865a257e..417864ea 100644 --- a/src/main/cpp/RobotContainer.cpp +++ b/src/main/cpp/RobotContainer.cpp @@ -220,7 +220,7 @@ void RobotContainer::ConfigureAutoBindings() { }).ToPtr()); // Maps to 7 on keyboard - m_operatorController.Button(3).OnTrue(frc2::InstantCommand([this] { + m_operatorController.Button(4).OnTrue(frc2::InstantCommand([this] { if (!m_state.m_active) { m_state.m_currentState = RobotState::ScoringAmp; @@ -229,7 +229,7 @@ void RobotContainer::ConfigureAutoBindings() { }).ToPtr()); // Maps to 8 on keyboard - m_operatorController.Button(4).OnTrue(frc2::InstantCommand([this] { + m_operatorController.Button(5).OnTrue(frc2::InstantCommand([this] { if (!m_state.m_active) { m_state.m_currentState = RobotState::ScoringSpeaker; @@ -238,7 +238,7 @@ void RobotContainer::ConfigureAutoBindings() { }).ToPtr()); // Maps to 9 on keyboard - m_operatorController.Button(5).OnTrue(frc2::InstantCommand([this] { + m_operatorController.Button(6).OnTrue(frc2::InstantCommand([this] { if (!m_state.m_active) { m_state.m_currentState = RobotState::ScoringSubwoofer; From 8e540597d06030b82835ff93a0b5034dbdbd1bdc Mon Sep 17 00:00:00 2001 From: 5690 <5690Programmers@gmail.com> Date: Wed, 17 Apr 2024 20:05:18 -0500 Subject: [PATCH 3/5] bindingssss --- src/main/cpp/RobotContainer.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/cpp/RobotContainer.cpp b/src/main/cpp/RobotContainer.cpp index 417864ea..80e75c15 100644 --- a/src/main/cpp/RobotContainer.cpp +++ b/src/main/cpp/RobotContainer.cpp @@ -265,16 +265,16 @@ void RobotContainer::ConfigureAutoBindings() { m_leftClimb.MoveToPositionAbsolute(18_in))); // Maps to 1 on keyboard - // m_operatorController.Button(9).OnTrue(frc2::InstantCommand([this] { - // if (!m_state.m_active) { - // m_state.m_currentState = - // RobotState::ClimbStageLeft; - // m_state.SetDesiredState(); - // } - // }).ToPtr()); + m_operatorController.Button(15).OnTrue(frc2::InstantCommand([this] { + if (!m_state.m_active) { + m_state.m_currentState = + RobotState::ClimbStageLeft; + m_state.SetDesiredState(); + } + }).ToPtr()); // Maps to 2 on keyboard - m_operatorController.Button(15).OnTrue(frc2::InstantCommand([this] { + m_operatorController.Button(16).OnTrue(frc2::InstantCommand([this] { if (!m_state.m_active) { m_state.m_currentState = RobotState::ClimbStageCenter; @@ -283,7 +283,7 @@ void RobotContainer::ConfigureAutoBindings() { }).ToPtr()); // Maps to 3 on keyboard - m_operatorController.Button(16).OnTrue(frc2::InstantCommand([this] { + m_operatorController.Button(17).OnTrue(frc2::InstantCommand([this] { if (!m_state.m_active) { m_state.m_currentState = RobotState::ClimbStageRight; From 6de6eb5463c3b945d321852ce787be47996b4c13 Mon Sep 17 00:00:00 2001 From: 5690 <5690Programmers@gmail.com> Date: Wed, 17 Apr 2024 20:05:55 -0500 Subject: [PATCH 4/5] hopefully final bindings --- src/main/cpp/RobotContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/cpp/RobotContainer.cpp b/src/main/cpp/RobotContainer.cpp index 80e75c15..8b8e7a5d 100644 --- a/src/main/cpp/RobotContainer.cpp +++ b/src/main/cpp/RobotContainer.cpp @@ -210,7 +210,7 @@ void RobotContainer::ConfigureAutoBindings() { // ); // Maps to NUM LOCK on keyboard - m_operatorController.Button(2).OnTrue( + m_operatorController.Button(3).OnTrue( // GOTO SRC frc2::InstantCommand([this] { if (!m_state.m_active) { From eb793f2aab6fd691e39c82ddee7bf89e89682ba3 Mon Sep 17 00:00:00 2001 From: Evan Rust Date: Wed, 17 Apr 2024 20:21:27 -0500 Subject: [PATCH 5/5] guys, that wasn't the last one --- src/main/cpp/RobotContainer.cpp | 2 +- src/main/cpp/subsystems/StateSubsystem.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/cpp/RobotContainer.cpp b/src/main/cpp/RobotContainer.cpp index 80e75c15..2d236ecd 100644 --- a/src/main/cpp/RobotContainer.cpp +++ b/src/main/cpp/RobotContainer.cpp @@ -265,7 +265,7 @@ void RobotContainer::ConfigureAutoBindings() { m_leftClimb.MoveToPositionAbsolute(18_in))); // Maps to 1 on keyboard - m_operatorController.Button(15).OnTrue(frc2::InstantCommand([this] { + m_operatorController.Button(10).OnTrue(frc2::InstantCommand([this] { if (!m_state.m_active) { m_state.m_currentState = RobotState::ClimbStageLeft; diff --git a/src/main/cpp/subsystems/StateSubsystem.cpp b/src/main/cpp/subsystems/StateSubsystem.cpp index 4289b0d5..079dfa14 100644 --- a/src/main/cpp/subsystems/StateSubsystem.cpp +++ b/src/main/cpp/subsystems/StateSubsystem.cpp @@ -253,7 +253,7 @@ bool StateSubsystem::IsControllerActive() { active |= m_driverController.GetPOV(i) != -1; } // Check the operator's "stop" button - active |= m_operatorController.RightStick().Get(); + active |= m_operatorController.Button(19).Get(); if (active) { ConsoleWriter.logVerbose("StateSubsystem", "Controller interrupt! %s", ""); }