Skip to content

95 better shot lookahead#102

Merged
aidnem merged 27 commits intomainfrom
95-better-shot-lookahead
Mar 10, 2026
Merged

95 better shot lookahead#102
aidnem merged 27 commits intomainfrom
95-better-shot-lookahead

Conversation

@aidnem
Copy link
Copy Markdown
Contributor

@aidnem aidnem commented Mar 8, 2026

No description provided.

@aidnem
Copy link
Copy Markdown
Contributor Author

aidnem commented Mar 8, 2026

This isn't ready for merge yet, it needs the remainder of the shot maps for the hub and then I'll probably also use it for passing. I wanted to create it so we could track it and make sure to keep it up to date.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the robot’s shot lookahead / passing-vs-hub behavior, plus several related mechanism and match-state improvements (dejam logic, timing, and field-location representations).

Changes:

  • Add position/time-of-flight lookahead to map-based shot calculation, and switch yaw representation to Rotation2d.
  • Introduce ShotMode-dependent “ready to shoot” thresholds for turret/hood/shooter, and auto-switch ShotMode based on alliance-zone position.
  • Rework hopper/transfer-roller dejam state transitions and add more robust match-time tracking.

Reviewed changes

Copilot reviewed 39 out of 39 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
state_machine_graphs/transferroller.dot Updates transfer roller state machine transitions (adds dejam transition + timeout).
state_machine_graphs/hopper.dot Updates hopper dejam transition label to timeout-based behavior.
src/main/java/frc/robot/subsystems/turret/TurretSubsystem.java Makes aim correctness depend on ShotMode threshold and logs manually.
src/main/java/frc/robot/subsystems/transferroller/TransferRollerSubsystem.java Adds debounced dejam detection and changes dejam transitions (spin→dejam + timeout).
src/main/java/frc/robot/subsystems/shooter/ShooterSubsystem.java Adds ShotMode-based velocity threshold + falling-edge debounced “at goal”.
src/main/java/frc/robot/subsystems/intake/IntakeState.java Updates pivot “set current position” reference to minPivotAngle.
src/main/java/frc/robot/subsystems/indexer/IndexerSubsystem.java Brakes instead of profiling when commanded near-zero velocity.
src/main/java/frc/robot/subsystems/hopper/HopperSubsystem.java Adds debounce + cooldown timer and changes dejam exit to timeout-based.
src/main/java/frc/robot/subsystems/hopper/HopperState.java Restarts dejam cooldown on spinning entry; adds WiggleState.
src/main/java/frc/robot/subsystems/hood/HoodSubsystem.java Makes aim correctness depend on ShotMode threshold and logs manually.
src/main/java/frc/robot/coordination/MatchState.java Adds “precise match time” timer and uses it to compute shifts/time-left.
src/main/java/frc/robot/constants/TurretConstants.java Adds passing setpoint epsilon for turret.
src/main/java/frc/robot/constants/TransferRollerConstants.java Adds dejamTime constant.
src/main/java/frc/robot/constants/StrategyConstants.java Adds acceptable error threshold for precise match time.
src/main/java/frc/robot/constants/ShooterConstants.java Adds passing velocity epsilon.
src/main/java/frc/robot/constants/RobotInfo.java Adds derived robotToShooter2d transform for 2D shot math.
src/main/java/frc/robot/constants/IntakeConstants.java Changes pivot neutral mode to coast.
src/main/java/frc/robot/constants/HopperConstants.java Adds dejam debounce/time/cooldown constants.
src/main/java/frc/robot/constants/HoodConstants.java Adds passing setpoint epsilon for hood.
src/main/java/frc/robot/constants/FieldLocations.java Switches pass target locations to Translation2d.
src/main/java/frc/robot/constants/FieldLocationInstance.java Switches stored pass targets to Translation2d.
src/main/java/frc/robot/constants/AllianceBasedFieldConstants.java Adds caching, 2D hub center, and alliance-zone helper.
src/main/java/frc/robot/ShotCalculations.java Refactors map-based shot calc to use pose lookahead + iterative virtual target; yaw is Rotation2d.
src/main/java/frc/robot/CoordinationLayer.java Adds effective autonomy field, auto shot-mode switching by position, integrates ShotMode readiness checks, and updates shot calculator callsites.
src/main/deploy/constants/comp/TurretConstants.json Adds turret passing epsilon in deploy constants.
src/main/deploy/constants/comp/TransferRollerConstants.json Adds dejam time and adjusts dejam velocity in deploy constants.
src/main/deploy/constants/comp/StrategyConstants.json Adds acceptable precise match time error in deploy constants.
src/main/deploy/constants/comp/ShotMaps.json Adjusts numeric formatting and updates pass map datapoints.
src/main/deploy/constants/comp/ShooterConstants.json Updates gains and adds passing epsilon in deploy constants.
src/main/deploy/constants/comp/RedFieldLocations.json Updates pass target coordinates (2D).
src/main/deploy/constants/comp/ManualModeConstants.json Swaps/updates manual pass/hub headings.
src/main/deploy/constants/comp/IntakeConstants.json Updates intake roller speed and homing voltage.
src/main/deploy/constants/comp/IndexerConstants.json Updates indexing velocity and gains.
src/main/deploy/constants/comp/HopperConstants.json Updates dejam voltage/thresholds and adds dejam timing params.
src/main/deploy/constants/comp/HoodConstants.json Adds hood passing epsilon in deploy constants.
src/main/deploy/constants/comp/FeatureFlags.json Disables transfer roller via feature flag in comp config.
src/main/deploy/constants/comp/BlueFieldLocations.json Updates pass target structure to 2D format.
elastic_layouts/competition.json Adds a competition dashboard layout (match time/shift, shot mode, alerts, etc.).
.vscode/settings.json Increases Java language server max heap to 16G.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/main/java/frc/robot/ShotCalculations.java Outdated
Comment thread src/main/java/frc/robot/constants/ShooterConstants.java
Comment thread src/main/java/frc/robot/subsystems/hood/HoodSubsystem.java Outdated
Comment thread src/main/java/frc/robot/subsystems/hopper/HopperState.java Outdated
Comment thread src/main/java/frc/robot/coordination/MatchState.java
Comment thread src/main/deploy/constants/comp/TransferRollerConstants.json
Comment thread src/main/java/frc/robot/ShotCalculations.java
Comment thread src/main/java/frc/robot/coordination/MatchState.java
Comment thread src/main/java/frc/robot/coordination/MatchState.java Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 39 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/main/java/frc/robot/subsystems/shooter/ShooterSubsystem.java Outdated
Comment thread src/main/deploy/constants/comp/FeatureFlags.json
Comment thread src/main/java/frc/robot/coordination/MatchState.java
Comment thread src/main/java/frc/robot/subsystems/hopper/HopperSubsystem.java
Copy link
Copy Markdown
Contributor

@godmar godmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind adding a few clarifications? See below.

Comment thread src/main/deploy/constants/comp/ManualModeConstants.json
Comment thread src/main/deploy/constants/comp/BlueFieldLocations.json
Comment thread src/main/deploy/constants/comp/IntakeConstants.json Outdated
Comment thread src/main/java/frc/robot/ShotCalculations.java Outdated
Comment thread src/main/java/frc/robot/constants/AllianceBasedFieldConstants.java Outdated
Comment thread src/main/java/frc/robot/constants/AllianceBasedFieldConstants.java
@godmar
Copy link
Copy Markdown
Contributor

godmar commented Mar 10, 2026

CachedLocation is no longer the right name since it's not specific to locations. CachedItem, or DerivedItem, or AllianceBasedValue or AllianceBasedConstant or AllianceBasedItem ?

@aidnem
Copy link
Copy Markdown
Contributor Author

aidnem commented Mar 10, 2026

Renamed to AllianceBasedValue. I was thinking it could be named better too, I just hadn't decided on a name yet.

Copy link
Copy Markdown
Contributor

@godmar godmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aidnem
Copy link
Copy Markdown
Contributor Author

aidnem commented Mar 10, 2026

@godmar do we want to go ahead and merge this so that #70 can pick up its changes, and then make a new integration branch for shop testing?

@godmar
Copy link
Copy Markdown
Contributor

godmar commented Mar 10, 2026

no time to waste

@aidnem aidnem merged commit 5ee7f20 into main Mar 10, 2026
3 checks passed
@aidnem aidnem deleted the 95-better-shot-lookahead branch March 10, 2026 18:40
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.

Calculate mechanism delay more properly and actually let us shoot during shoot on the move

3 participants