Skip to content

fix code loop overruns.#15

Open
Sleepy197 wants to merge 4 commits into
comp-devfrom
King-Dev
Open

fix code loop overruns.#15
Sleepy197 wants to merge 4 commits into
comp-devfrom
King-Dev

Conversation

@Sleepy197

Copy link
Copy Markdown
Contributor

mainly did some timing problem changes that was mentioned. main goal was to fix the code loop overruns. TEST BEFORE MERGING.

Precompute mirrored rectangular blockers in Superstructure to avoid rebuilding geometry every cycle and move latency compensation default initialization into the constructor.

Introduce a sampling budget for vision I/O: add MAX_OBSERVATION_SAMPLES_PER_UPDATE and getLatestSampleStartIndex to VisionIO, cap processed samples in VisionIOLimelight and VisionIOPhotonVision, and track/report droppedObservationCount. Refactor detailed-pose logging gating into isDetailedPoseLoggingEnabled helpers and wire up dropped-observation logging in Vision. Add unit tests (VisionPerformanceGuardTest) for the sample-dropping logic and detailed logging behavior.
Add a shared Maple simulation backend and wire it into drivetrain, modules, gyro, and vision systems. Introduces MapleSimManager to host a SimulatedArena and SwerveDriveSimulation, a new GyroIOSim, and a simulation-backed ModuleIOSim that uses Maple simulated motor controllers and modules. Robot lifecycle and RobotState.resetPose now synchronize simulation state; Vision is configured to use PhotonVision sim instances tied to MapleSimManager when simulation is enabled. Also add vendordeps metadata for maple-sim and a small update to VisionIOPhotonVisionSim to throttle sim updates. (Gradle cache/daemon files shown in the diff are environment artifacts and not functionally relevant.)
Add MapleSim integrations and robustness fixes across simulation and drivetrain code.

- Add new autonomous path file: Middle_to_depot.json.
- RobotState: defend against non-finite odometry/vision inputs to avoid corrupting pose buffer and logging rejection correctly.
- VisualizeShot: launch a RebuiltFuelOnFly projectile into MapleSim for physics-based visualization and register hit/trajectory callbacks.
- MapleSimManager: track hub hit count, expose logger output, and print counts for projectile hits.
- IntakeIOSim: integrate IntakeSimulation to spawn/consume MapleSim game pieces, control intake start/stop logic, and expose simulation metrics.
- Shooter: guard against non-finite angle/velocity inputs in setters to prevent invalid actuator commands.
- SwerveDrive: add filtered odometry buffers, rejection of tilted odometry samples (based on max tilt config), continuity handling for wheel travel while tilted, helper routines for odometry updates, and additional logging of filtered states.

These changes improve simulation fidelity (game pieces and scoring) and harden the robot code against bad sensor inputs and tilt-induced odometry errors.
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.

1 participant