Skip to content

feat: PedroPathing Integration, OpMode Architecture Overhaul, and Subsystem Refactors#10

Draft
IamCoder18 wants to merge 88 commits intomasterfrom
PedroPathing
Draft

feat: PedroPathing Integration, OpMode Architecture Overhaul, and Subsystem Refactors#10
IamCoder18 wants to merge 88 commits intomasterfrom
PedroPathing

Conversation

@IamCoder18
Copy link
Member

Summary

This PR introduces a major overhaul to the robot's architecture, centering on the integration of the PedroPathing library for navigation. It refactors the OpMode structure to efficiently handle multi-alliance and multi-starting-position configurations through abstraction. Additionally, it includes significant rewrites of the Shooter, Spindexer, and Limelight subsystems to improve reliability, automation, and code maintainability.

Key Features

1. OpMode Architecture & Pose Persistence

  • Abstracted OpModes: MainTeleOp and AudienceAuto are now abstract base classes. Specific implementations (BlueAudienceTeleOp, RedGoalTeleOp, etc.) now inherit from these, enforcing specific starting poses and team enums.
  • Pose Persistence: Implemented a RobotPosition utility. The robot now saves its final pose at the end of Autonomous and automatically loads that pose as the starting point for TeleOp, ensuring seamless transitions.
  • Path Mirroring: Added logic to automatically mirror paths for Red/Blue alliances, reducing duplicate code.

2. PedroPathing Integration

  • Fully integrated PedroPathing for path following in Autonomous and automated maneuvers in TeleOp.
  • Implemented PathChain logic for complex auto routines (e.g., toSpikeOne, toPark).

3. Subsystem Overhauls

  • Shooter:

  • Migrated to a command-based SubsystemBase pattern.

  • Implemented a ShootThree sequential command group for autonomous.

  • Added "Wait for Drop" logic to confirm shots before cycling.

  • Refined PIDF constants and added a dedicated tuning mode.

  • Safety: Motors now default to 0 RPM on initialization.

  • Spindexer:

  • Implemented PIDF control for precise positioning and holding.

  • Added logic to calculate the next target relative to the current position rather than state history.

  • Added zeroSpindexer() functionality to calibrate offsets.

  • Limelight:

  • Major cleanup: removed dead code, optimized memory usage via object pooling for DistanceFromTag.

  • Streamlined LowPass filter logic and telemetry updates.

  • Transfer:

  • Added "Automatic Transfer" mode which only feeds rings when the Shooter is at target RPM and the Spindexer is aligned.

4. QoL & UI Improvements

  • WiFi Channel Selector: Added a menu option in FtcRobotControllerActivity to manually select WiFi Direct channels (2.4GHz, 5GHz, or Auto) to mitigate event interference.
  • RGB Indicators: Simplified logic for LED indicators to show "Ready to Shoot" (Green) vs "Not Ready" (Red).

Refactoring & Cleanup

  • Deleted legacy OpModes (OldTeleOp, TestDrive, AllianceAssistAuto).
  • Renamed GoalsideAuto to GoalAuto.
  • Standardized formatting (imports, whitespace) across the codebase.
  • Moved Utills to Utils and added GamepadUtils for joystick deadzone handling.

Testing

  • Verified Autonomous pathing reliability with new timeouts.
  • Tested transition from Auto to TeleOp to confirm pose persistence works.
  • Validated PIDF tuning on Shooter and Spindexer.

Jaydenwithawhy and others added 30 commits December 29, 2025 16:46
…d pattern

Migrated Shooter subsystem from manual command implementation to SubsystemBase pattern for better integration with command scheduler. Key changes include:

- Converted Shooter class to extend SubsystemBase
- Replaced manual command methods with SetTarget() and WaitForTarget() commands
- Simplified command structure by removing ToTarget() and MindlessToTarget() methods
- Added periodic() method for automatic RPM updates and motor control
- Maintained all existing PID/FF control logic and constants

This change improves code organization and enables better integration with the command-based architecture used throughout the robot codebase.
# Conflicts:
#	TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpModes/AudienceAuto.java
#	TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpModes/TestDrive.java
- Rename the `Utills` package to `Utils` to correct a typo. Update all corresponding import statements.
- Introduce `GamepadUtils` to handle joystick deadzone logic.
- In `OldTeleOp`, implement hold position logic when the driver is not providing input.
- Adjust spindexer power values.
- Clean up unused imports in `MainTeleOp`, `Limelight`, and `Shooter`.
Comments out the `shooter.periodic()` method call in `OldTeleOp`.
This commit replaces the `OldTeleOp` file with a functionally identical `MainTeleOp` and introduces significant refinements to the autonomous routine and related subsystems.

### Major Changes
- **TeleOp:** Deletes `OldTeleOp.java` and replaces it with `MainTeleOp.java`, which contains the same implementation.
- **Autonomous (`AudienceAuto`):**
    - Implements conditional transfer logic. The transfer now waits until the shooter reaches its target RPM before feeding artifacts, improving shooting consistency.
    - Replaces fixed `WaitCommand` timeouts for shooter spin-up with a `WaitUntilCommand` that proceeds once the shooter is ready.
    - Adds configurable static variables for wait times (`SHOOT_DWELL_TIME`, `SPIKE_COLLECTION_WAIT`) to make tuning easier.
    - Resets the `CommandScheduler` at the start of `init()` to prevent leftover commands from previous runs.

### Subsystem & Utility Refinements
- **`Transfer`:**
    - Adds logic to perform a conditional transfer out, only activating the transfer servos if the shooter is at its target RPM.
    - A `setShooter` method is added to provide the `Transfer` subsystem with a `Shooter` instance.
- **`Limelight`:**
    - Refactored from a standard class into a `SubsystemBase`.
    - Methods like `start()` and `update()` are now wrapped in `Command` objects (`InstantCommand`) to integrate with the command-based framework.
- **`Shooter`:**
    - Adjusts the motor stop condition to check for an absolute target RPM below 50, preventing unintended motor stoppage.
- **`ShooterDistanceTuning`:**
    - Converts the OpMode to be command-based, utilizing `CommandScheduler`.
    - Integrates `PanelsTelemetry` for a clearer dashboard view during tuning.
    - Adds more operator controls for intake, transfer, and spindexer to facilitate testing.
Inverts the `left_stick_y` and `left_stick_x` inputs when calling `follower.setTeleOpDrive`. This corrects the robot's movement direction in tele-operated mode, aligning it with driver expectations. The commented-out legacy drive logic has also been removed.
This commit introduces a conditional transfer mechanism that activates the transfer only when the shooter is ready and the operator is commanding it.

Changes:
- In `MainTeleOp`, the `Transfer` subsystem is now aware of the `Shooter` subsystem.
- The transfer outtake is conditionally updated each loop via `transfer.updateConditionalTransferOut()`.
- The operator's right trigger now toggles a boolean (`isTransferOutActive`) in the `Transfer` class, indicating the intent to shoot, rather than directly controlling the transfer motor.
- Increase `SHOOTER_RPM_TOLERANCE` in `Transfer` from 61 to 150.
- Modify `updateConditionalTransferOut` to use the average RPM of the shooter wheels for determining when to transfer. The transfer now runs in reverse if the shooter is not at the target RPM.
- Invert the right stick x-axis for turning in `MainTeleOp`.
- Add `shooter.periodic()` call to the main loop in `MainTeleOp`.
- Implement `PanelsTelemetry` for displaying telemetry data.
- Schedule `transfer.TransferStop()` when the shooter is disengaged.
- Increase `SHOOT_DWELL_TIME` from 2500ms to 3200ms.
- Increase `SPIKE_COLLECTION_WAIT` from 30ms to 800ms.
This commit introduces live PID and FeedForward tuning for the `Shooter` subsystem and updates several dependencies.

- **`Shooter.java`**:
    - Adds `updatePIDCoefficients()` to allow for live tuning of P, I, D, and FeedForward (Ks, Kv) constants from a dashboard.
    - Sets motor run mode to `RUN_WITHOUT_ENCODER` as PID is handled manually.
    - Removes hardcoded motor offsets (`UPPER_OFFSET`, `LOWER_OFFSET`).

- **`ShooterDistanceTuning.java`**:
    - Calls `shooter.updatePIDCoefficients()` in the loop to apply tuned values.
    - Simplifies telemetry output by removing formatted strings and commenting out limelight distance data.

- **`build.dependencies.gradle`**:
    - Upgrades `com.bylazar:fullpanels` from version `1.0.6` to `1.0.12`.

- **`gradle.properties`**:
    - Enables non-transitive R classes by setting `android.nonTransitiveRClass=true`.

- **`FtcRobotControllerActivity.java` & `PermissionValidatorWrapper.java`**:
    - Updates resource calls (e.g., `R.string.pref_...`) to use the fully qualified `com.qualcomm.robotcore.R` or `com.qualcomm.ftccommon.R` namespace to conform with non-transitive R classes.

- **`TeamCode/build.gradle`**:
    - Removes SolversLib dependencies, as they are now managed in the root `build.dependencies.gradle` file.
This commit refines the shooter's PID and feedforward constants for better performance and introduces a dedicated tuning mode to prevent live PID/FF updates during normal operation.

- **PID & Feedforward Tuning:**
  - `UPPER_P` increased from 0.0024 to 0.004.
  - `LOWER_P` increased from 0.001 to 0.009.
  - `UPPER_KS` decreased from 0.15 to 0.14.
  - `UPPER_KV` increased from 0.000074 to 0.000149.
  - `LOWER_KS` decreased from 0.3 to 0.25.
  - `LOWER_KV` decreased from 0.00017 to 0.000146.
- **RPM Adjustment:**
  - `AUDIENCE_RPM` and `GOAL_RPM` both reduced from 2310 to 2300.
- **Tuning Mode Implementation:**
  - A `TUNING_MODE` boolean now gates the live update of PIDF coefficients, preventing accidental changes outside of the tuning OpMode.
  - `ShooterDistanceTuning` now explicitly enables this mode on initialization.
IamCoder18 and others added 30 commits February 3, 2026 19:02
This commit introduces haptic feedback to the controllers for key game events, improving driver awareness.

### `MainTeleOp.java`
- **New Method `handleRumbleFeedback()`:** This method is called in the main `loop()` to manage controller vibrations.
- **Driver 1 (gamepad1) Feedback:** The controller now rumbles for 500ms when an automated path-following sequence (initiated by the 'A' button) is completed. This is achieved by tracking the `follower.isBusy()` state.
- **Driver 2 (gamepad2) Feedback:** The controller rumbles for 500ms when the shooter wheels reach their target RPM, indicating the robot is ready to shoot.

### `GoalAuto.java`
- A minor cleanup was performed to remove a redundant comment (`// Panels`) from the `@Configurable` annotation.
This commit introduces a major refactoring of the TeleOp controls for improved operator experience and updates the autonomous and spindexer logic for better reliability.

### TeleOp Controls (`MainTeleOp.java`)

-   **Spindexer Control:**
    -   The left joystick now provides proportional power to the spindexer instead of using threshold-based activation. The deadzone is set to `0.1`.
    -   Manual spindexer rotation is now mapped to `dpad_up` (hold to run, release to advance to the next target).
    -   The `A` button on gamepad2 is now used to reset the spindexer's position (`zeroSpindexer`).

-   **Button Remapping:**
    -   The override for transferring pixels out (reverse) has been moved from `Y` to `X`.
    -   The `Y` button is now used to disable automatic transfer.

-   **Code Cleanup:**
    -   Renamed `lowershooterSpeed` to `lowerShooterSpeed` for consistency.
    -   Corrected a logic error where `b1ButtonPressed` was used in place of `aButtonPressed` for the cross button.
    -   Removed unused logic related to `transfer.updateAutomaticTransfer()`.

### Spindexer Subsystem (`Spindexer.java`)

-   **Smarter Target Advancement:** The `NextTarget()` command has been improved to account for the spindexer's current position. It now fast-forwards to the correct next shooting position if the spindexer has already passed the next calculated target, preventing it from rotating backward.
-   **State Management:**
    -   When `DirectPower()` is called, the `isAtTarget` flag is now correctly set to `false`.

### Autonomous (`AudienceAuto.java`)

-   **Removed RGB Indicator:** The `rgbIndicator` servo and its associated voltage-based blinking logic have been completely removed to simplify the codebase.
-   **Corrected Post-Shooting Action:** After the shooting sequence, the spindexer is now correctly advanced to the `NextTarget()` instead of being stopped with `DirectPower(0)`.
This commit introduces a new 2-spike parking autonomous path and improves the overall OpMode flow by resetting the command scheduler and preselecting the appropriate TeleOp.

### Autonomous Changes (`AudienceAuto.java`)

-   **New 2-Spike Park Path:**
    -   Added a `toParkSpikeTwo` path for both Red and Blue audience autonomous routines.
    -   This path allows the robot to park after scoring the second spike, providing a simpler and more reliable alternative to the full 3-spike sequence.
-   **Commented Out 3-Spike Logic:** The commands for collecting and shooting the third spike have been commented out, making the new 2-spike park path the default behavior.
-   **Scheduler Reset:** The `CommandScheduler` is now reset in the `stop()` method of `AudienceAuto` and `GoalAuto`. This prevents commands from carrying over between OpModes, improving reliability when chaining from Auto to TeleOp.

### OpMode Usability (`BlueAudienceAuto.java`, `RedAudienceAuto.java`)

-   **Preselect TeleOp:** The `@Autonomous` annotation in `BlueAudienceAuto` and `RedAudienceAuto` now includes the `preselectTeleOp` parameter. This automatically selects the correct TeleOp program on the Driver Station after the autonomous period ends, streamlining the transition for the drive team.

### Code Cleanup (`MainTeleOp.java`)

-   Minor cleanup was performed, removing unused empty methods (`init_loop()`) and extra whitespace for better code readability.
This commit introduces a series of refactoring changes across the codebase to remove unused code, improve formatting consistency, and enhance clarity in various subsystems and OpModes.

### Code Cleanup and Refactoring
- **Removed Unused Imports:** Unnecessary imports were removed from multiple files, including `Limelight.java`, `AudienceAuto.java`, `RedAudienceAuto.java`, and `MainTeleOp.java`, cleaning up dependencies.
- **Instance Variable Formatting:** Instance variables in `MainTeleOp`, `GoalAuto`, `DistanceSensorTest`, `ShooterDistanceTuning`, `LimeLightTest`, and `TestSpindexer` were made `private` or `protected` and reformatted for consistency.
- **Dead Code Removal:**
    - Deleted a large block of commented-out legacy pathing code in `GoalAuto.java`.
    - Removed the empty `init_loop()` method and other commented-out logic (like Limelight pose updates) from `MainTeleOp.java`.
    - Cleaned up obsolete telemetry comments in `AudienceAuto.java`.

### `MainTeleOp` Enhancements
- **Simplified Logic:** Removed redundant `else` statements and streamlined conditional checks for intake and transfer commands.
- **Clarified Variable Names:** Renamed boolean flags like `ArtifactFound` to `artifactFound` and `ToggleDistance` to `toggleDistance` to follow Java conventions.
- **Consolidated Hardware Initialization:** Grouped `rgbIndicator` and `distanceSensor` initializations.

### Minor Fixes and Formatting
- **Spindexer:** Corrected a minor formatting issue in the `DirectPower` command.
- **OpModes:** Standardized code formatting (indentation, spacing) across all modified OpMode files (`RedGoalAuto`, `BlueGoalAuto`, `BlueAudienceAuto`, `AudienceAuto`, `GoalAuto`, etc.).
- **README:** Fixed spacing and indentation in the `readme.md` file.
# Conflicts:
#	TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpModes/TeleOp/MainTeleOp.java
This commit updates the starting pose for the red alliance in `MainTeleOp`.

The previous hardcoded starting pose has been replaced with a simpler, rounded value (`new Pose(5, 6, Math.toRadians(180))`). This change likely fine-tunes the robot's initial position for better autonomous pathing or localization.

A minor whitespace change was also made by removing an empty line in the `handleDriveInput()` method.
# Conflicts:
#	TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpModes/TeleOp/MainTeleOp.java
This commit refactors `MainTeleOp.java` by removing dead code and unused dependencies, and it also adjusts the starting pose for the red alliance.

### Code Cleanup
- **Removed Unused Imports:** Several unused imports from the `com.seattlesolvers.solverslib.command`, `org.firstinspires.ftc.robotcore.external.navigation`, and `org.firstinspires.ftc.teamcode.Subsystem` packages have been deleted.
- **Removed Dead Code:**
    - The `indicatorValue()` method, which contained logic for a voltage-based RGB indicator, has been completely removed.
    - All code related to the Limelight subsystem, including its initialization, telemetry, and instance variable, has been commented out or deleted.

### Autonomous Pose Correction
- **Red Alliance Start Pose:** The starting Y-coordinate for the red alliance in `MainTeleOp` has been adjusted from `6` to `5`, changing the pose from `(5, 6)` to `(5, 5)`.
This commit refines the coordinates for the automatic aiming paths used in TeleOp to improve shooting accuracy.

- **Blue Alliance Path:** The target pose for the `pathFrontBlue` path was adjusted from `(79, 96.361)` to `(81, 94.361)`.
- **Red Alliance Path:** The target pose for the `redGoalShootingPath` path was adjusted from `(63, 96.361)` to `(61, 94.361)`.
- **Code Cleanup:** A redundant blank line within the cross-button press logic was removed.
This commit introduces a new `Colour` subsystem to detect game elements in the spindexer and retunes the shooter's PIDF constants for improved performance.

### New Features
- **Colour Subsystem:**
    - A new `Colour.java` subsystem has been added to detect the color (Green, Purple, or None) of game elements in the spindexer slots using two `NormalizedColorSensor` instances.
    - The subsystem includes logic to map sensor readings to the correct spindexer slot based on its current position.
    - A confirmation filter is implemented to prevent sensor noise from causing incorrect color readings.
- **MainTeleOp Integration:**
    - The `Colour` subsystem is initialized in `MainTeleOp.java`.
    - Telemetry has been added to display the detected color for each of the three spindexer slots.
    - `TODO` comments have been added to integrate the colour sensor's `update()` logic with the spindexer's future `getCurrentSlot()` method.

### Shooter Tuning
- **PIDF Gains:** The PID and feedforward constants (`P`, `kS`, `kV`) for both the upper and lower shooter flywheels in `Shooter.java` have been updated to new, tuned values.
- **Shooter RPM Logic:** The logic in `MainTeleOp` for setting the shooter RPM based on the robot's Y-position has been corrected. It was previously setting goal RPMs when it should have been setting audience RPMs.

### Refactoring
- **Transfer Logic:** The condition for automatic transfer in `Transfer.java` has been changed from checking an average RPM tolerance to ensuring both the upper and lower flywheels are individually within their target RPMs.
- **Spindexer:** A `TODO` comment was added in `Spindexer.java` to remind developers to implement the `getCurrentSlot()` method.
This commit removes a redundant `break;` statement and a trailing newline from the `switch` statement in `Colour.java`.
This commit removes the now-unused `Drive.java` subsystem, which was based on a previous implementation of SolversLib, and cleans up the codebase by removing dependencies and annotations related to ACME Robotics Dashboard.

### Refactoring
- **Deleted `Drive.java` Subsystem:** The entire `Drive.java` file, which contained a Mecanum drive implementation using SolversLib and a `GoBildaPinpointDriver`, has been deleted as it is no longer in use.
- **Removed ACME Dashboard:**
    - The `com.acmerobotics.dashboard:dashboard:0.4.17` dependency has been removed from `build.dependencies.gradle`.
    - All `@Config` annotations from ACME Dashboard have been removed from the following files:
        - `MainTeleOp.java`
        - `Shooter.java`
        - `ShooterDistanceTuning.java`
- **Deleted `readme.md`:** The default `readme.md` file in the `TeamCode` module has been removed.

### Dependency Updates
- **SolversLib:** The versions for `solverslib:core` and `solverslib:pedroPathing` have been updated from `0.3.3` to `0.3.4` in `TeamCode/build.gradle`.
…tants

This commit updates the SolversLib dependency to version `0.3.3`, removes a deprecated Maven repository, and retunes constants for both the PedroPathing follower and the shooter subsystem.

### Dependency & Build Changes
- **SolversLib Update:** The `core` and `pedroPathing` dependencies for SolversLib have been updated from version `0.3.4` to `0.3.3`.
- **RoadRunner Removed:** Unused dependencies for RoadRunner (`ftc`, `core`, `actions`, `dashboard`) have been removed from `TeamCode/build.gradle`.
- **Repository Cleanup:** A deprecated Maven repository URL (`https://maven.brott.dev/`) was removed from both `build.dependencies.gradle` and `TeamCode/build.gradle`.

### Pathing Constant Tuning
The follower and drive constants in `PedroPathing/Constants.java` have been significantly updated to reflect new tuning values:
- **Follower Constants:** `mass`, `zeroPowerAcceleration`, `PIDFCoefficients`, and `centripetalScaling` have all been updated.
- **Drive Constants:** Maximum `xVelocity` and `yVelocity` have been increased.
- **Path Constraints:** The maximum translational velocity (`maxTranslationalVelocity`) has been increased from `0.85` to `1.3`.

### Shooter Tuning
- **PID & Feedforward:** The PID (`P`) and Feedforward (`kS`, `kV`) constants for both the upper and lower shooter flywheels have been updated in `Shooter.java` for improved performance.

### Code Cleanup
- **Deleted Test File:** The temporary autonomous test file `OpModes/Auto/test.java` has been deleted.
This commit introduces a new modular framework for autonomous OpModes, allowing for more flexible route definitions using a step-based architecture. It also centralizes field coordinates into a unified database.

### New Features
- **Modular Autonomous Framework:**
    - Added `ModularAuto.java` as an abstract base class that handles hardware initialization, command scheduling, and path execution using Pedro Pathing.
    - Introduced `RouteStep.java` enum to define discrete actions like `SHOOT_PRELOAD`, `COLLECT_SPIKE`, and `PARK`.
    - Implemented specific modular OpModes: `BlueModularAudienceAuto`, `BlueModularHumanAuto`, and `RedModularAudienceAuto`.
- **Pose Database:**
    - Created `PoseDatabase.java` to store all standardized coordinates (poses) for Blue and Red alliances, including start positions, spike collection points, and shooting locations.

### Logic Improvements
- **Route Handling:** `ModularAuto` now dynamically builds sequential command groups based on the steps added to the route, improving code reuse between different auto configurations.
- **Pathing Curves:** Added specific `BezierCurve` logic in `getShootStepCommand` to handle complex return paths from spike 3 locations to the shooting position.
- **State Management:** Added `currentExpectedPose` tracking to ensure seamless path chaining between modular steps.

### Refactoring & Cleanup
- **TeleOp:** Cleaned up `MainTeleOp.java` by removing unused motor declarations (`frontRight`, `rearRight`, etc.) and redundant boolean flags (`ArtifactFound`, `ToggleDistance`).
- **Code Quality:** Removed various redundant blank lines and commented-out code (e.g., the `Colour` subsystem reference) across `AudienceAuto`, `AudienceHumanAuto`, and `MainTeleOp`.
- **Consistency:** Standardized the use of `ShootArtifacts` command across autonomous routines.
This commit enhances the `Spindexer` subsystem by adding logic to detect the current rotating slot and introduces a mechanism to persist the spindexer's position across OpMode transitions (Auto to TeleOp).

### Spindexer Subsystem Enhancements
- **Slot Detection:**
    - Implemented `getCurrentSlot()` to identify which of the three slots (1, 2, or 3) is currently at the shooting position based on encoder degrees.
    - Added `getDegrees()` to convert motor ticks to degrees using a calculated `DEGREES_PER_TICK` constant based on a 2:1 gear reduction.
    - Defined `SLOT_TOLERANCE` to handle small physical offsets when determining slot alignment.
- **Persistent Positioning:**
    - Added `savePosition()` to store the current encoder ticks in the `RobotPosition` utility class.
    - The constructor now checks `RobotPosition.isSpindexerSet` to apply an offset, allowing the spindexer to maintain its coordinate system after an autonomous routine.
- **Refactoring:** Replaced hardcoded conversion factors with `TICKS_PER_DEGREE` and `DEGREES_PER_TICK` constants for better maintainability.

### TeleOp Integration
- **Colour Sensor Integration:**
    - Re-enabled the `Colour` subsystem and integrated it with `spindexer.getCurrentSlot()`.
    - Added logic to update the color sensor state only when a valid slot is detected.
    - Implemented `clearCurrentSlot()` logic to reset the detected color when the transfer mechanism is active.
- **Telemetry:** Added "Current Slot" and "Spindexer Degrees" to the driver station telemetry for real-time debugging.

### Autonomous Adjustments
- Updated `AudienceHumanAuto`, `OverFlowAuto`, `ModularAuto`, and `AudienceAuto` to call `spindexer.savePosition()` upon completion, ensuring the spindexer state is handed off correctly to TeleOp.

### Utilities
- **RobotPosition:** Added `spindexerTicks` and `isSpindexerSet` fields to facilitate state sharing between OpModes.
This commit enhances the `Spindexer` subsystem by adding logic to detect the current rotating slot and introduces a mechanism to persist the spindexer's position across OpMode transitions (Auto to TeleOp).

### Spindexer Subsystem Enhancements
- **Slot Detection:**
    - Implemented `getCurrentSlot()` to identify which of the three slots (1, 2, or 3) is currently at the shooting position based on encoder degrees.
    - Added `getDegrees()` to convert motor ticks to degrees using a calculated `DEGREES_PER_TICK` constant based on a 2:1 gear reduction.
    - Defined `SLOT_TOLERANCE` to handle small physical offsets when determining slot alignment.
- **Persistent Positioning:**
    - Added `savePosition()` to store the current encoder ticks in the `RobotPosition` utility class.
    - The constructor now checks `RobotPosition.isSpindexerSet` to apply an offset, allowing the spindexer to maintain its coordinate system after an autonomous routine.
- **Refactoring:** Replaced hardcoded conversion factors with `TICKS_PER_DEGREE` and `DEGREES_PER_TICK` constants for better maintainability.

### TeleOp Integration
- **Colour Sensor Integration:**
    - Re-enabled the `Colour` subsystem and integrated it with `spindexer.getCurrentSlot()`.
    - Added logic to update the color sensor state only when a valid slot is detected.
    - Implemented `clearCurrentSlot()` logic to reset the detected color when the transfer mechanism is active.
- **Telemetry:** Added "Current Slot" and "Spindexer Degrees" to the driver station telemetry for real-time debugging.

### Autonomous Adjustments
- Updated `AudienceHumanAuto`, `OverFlowAuto`, `ModularAuto`, and `AudienceAuto` to call `spindexer.savePosition()` upon completion, ensuring the spindexer state is handed off correctly to TeleOp.

### Utilities
- **RobotPosition:** Added `spindexerTicks` and `isSpindexerSet` fields to facilitate state sharing between OpModes.
…lar auto framework

This commit introduces a new autonomous routine for the blue alliance that focuses on human player collection and refactors the modular autonomous system for better flexibility and telemetry.

### New Features
- **Blue Modular Double Human Auto:** Added a new autonomous OpMode `BlueModularDoubleHumanAuto` that executes a sequence of shooting preloads, collecting spikes, and performing double human player collections with a "wiggle" maneuver.
- **Modular Auto Enhancements:**
    - Support for timed wait steps within the route.
    - Added `COLLECT_HUMAN_PLAYER_WIGGLE` and `SHOOT_LONG_PRESPIN` route steps.
    - Improved command sequencing with `ParallelCommandGroup` to allow simultaneous path following and subsystem preparation (e.g., spinning up the shooter while moving).
    - Added comprehensive telemetry for tracking the current autonomous step and subsystem status.

### Subsystem Improvements
- **Spindexer:**
    - Added `getDistanceFromSlot()` to calculate the angular distance to the nearest valid slot (0°, 120°, 240°).
    - Added `isAlignedWithSlot()` to provide a boolean check for slot alignment.
- **Colour Subsystem:**
    - Added detailed logging fields for Raw RGB and HSV values for both sensors.
    - Implemented update tracking (count, timing, and status) for better debugging in TeleOp.
    - Refactored `detectColour` to support logging for specific sensors.
- **ShootArtifacts Utility:** Added new constructors to support custom wait times and integrated audience RPM constants.

### Tuning and Refactoring
- **Pose Adjustments:** Fine-tuned coordinates in `PoseDatabase.java` for both Red and Blue alliance spike and human player collection points to improve intake reliability.
- **Collection Logic:** Updated `ModularAuto` to use configurable collection wait times (`COLLECTION_WAIT`, `HUMAN_PLAYER_COLLECTION_WAIT`) and adjusted intake/spindexer power levels during collection.
- **Cleanup:** Removed unused `Touch` subsystem references from the autonomous paths.
- **TeleOp Telemetry:** Reorganized `MainTeleOp.java` telemetry to provide a clearer breakdown of Spindexer alignment and detailed Colour sensor diagnostics (RGB, HSV, and Mapped Slots).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants