Conversation
…er and some for operator
…ntake and climber extension
…hood stowing, and gating shots based on possibility
There was a problem hiding this comment.
Pull request overview
This pull request adds basic driver control functionality for teleop operation, establishing a coordination layer that manages robot actions based on controller inputs. The PR implements manual and smart autonomy modes, shooting controls, intake deployment coordination, and hood stowing logic for navigating under field obstacles.
Changes:
- Added CoordinationLayer class to coordinate subsystem actions based on driver/operator inputs with support for manual and smart autonomy modes
- Implemented driver and operator controller bindings for intake, shooting, climbing, and autonomy mode switching
- Added utility classes (EnhancedLine2d, OptionalUtil, AllianceUtil) and subsystem state checking methods (isAimedCorrectly, isAtGoalVelocity, isStowed)
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| EnhancedLine2d.java | New utility class for 2D line intersection detection to support trench collision detection |
| OptionalUtil.java | New utility class providing helper methods for working with multiple Optional values |
| AllianceUtil.java | Added getOppAlliance() method to get the opposing alliance |
| TurretSubsystem.java | Added isAimedCorrectly() method to check if turret is at goal heading |
| ShooterSubsystem.java | Added coast state, velocity getters, stopShooter(), and isAtGoalVelocity() methods |
| ShooterState.java | Added CoastState for coasting the shooter to a stop |
| IntakeSubsystem.java | Added isStowed() method to check if intake is within frame perimeter |
| HoodSubsystem.java | Added setShouldStowForTrench(), getCurrentAngle(), and isAimedCorrectly() methods |
| MatchState.java | Renamed auto override parameters to weWonAuto/weLostAuto for clarity |
| CoordinationLayer.java | Major refactor: added button loop, state machines for extension coordination, manual/smart mode switching, shot aiming, and hood stowing logic |
| RobotContainer.java | Updated to use CoordinationLayer for bindings and vision localizer initialization |
| ControllerSetup.java | Removed intake and match state bindings (moved to CoordinationLayer) |
| ShotCalculations.java | Modified calculateShotFromMap to always return a shot (clamped if out of range) with isReal flag |
| VisionConstants.java | Added disconnectedDebounceTime for vision connection debouncing |
| TurretConstants.java | Added turretSetpointEpsilon for determining when turret is at target |
| ShooterConstants.java | Added shooterVelocitySetpointEpsilon for velocity tolerance checking |
| ManualModeConstants.java | New constants class for manual mode shooting parameters |
| JsonConstants.java | Added manualModeConstants loading and tuning server route |
| IntakeConstants.java | Added stowThresholdAngle for determining when intake is stowed |
| IndexerConstants.java | Removed indexerDemoMode flag, added indexingVelocity constant |
| HopperConstants.java | Removed hopperDemoMode flag, added indexingVelocity constant |
| HoodConstants.java | Added hoodSetpointEpsilon and timeToStowHood constants |
| FieldLocations.java | Added getManualHubShootingPosition() method |
| FieldLocationInstance.java | Added manualHubShootingPosition field |
| FieldConstants.java | Added oppInnerCenterPoint() method for opponent hub center |
| AllianceBasedFieldConstants.java | New class providing alliance-based field location accessors |
| controllers-xbox.json | Added comprehensive driver and operator bindings for all teleop controls |
| VisionConstants.json | Added disconnectedDebounceTime configuration |
| ManualModeConstants.json | New JSON configuration for manual mode constants |
| IntakeConstants.json | Added stowThresholdAngle configuration |
| HopperConstants.json | Removed hopperDemoMode configuration |
| FeatureFlags.json | Enabled runHood flag |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 36 out of 36 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| double D = l.d.cross(dneg); | ||
|
|
||
| // Use Cramer’s rule | ||
| if (D == 0.0) { |
There was a problem hiding this comment.
The comparison uses exact equality (==) for floating-point numbers, which is generally unreliable due to floating-point precision issues. Consider using a small epsilon for comparison instead, such as Math.abs(D) < EPSILON.
There was a problem hiding this comment.
@godmar is this necessary? I feel like if it's very very small, that just means the lines are super close to parallel right?
There was a problem hiding this comment.
Yes. I think that's fine here. If D is very small (close to zero), then dividing by it will be very large, so the test params.[st] < 1.0 should fail; this would be true even if were positive infinity.
The check == 0.0 guards against getting NaN here.
make every subsystem write a graph viz of its state machine when in sim
godmar
left a comment
There was a problem hiding this comment.
I didn't see anything obviously wrong. This will evolve further anyhow.
| * When the turret heading is within turretSetpointEpsilon of its goal heading, it is considered | ||
| * to be "at the target" | ||
| */ | ||
| public final Angle turretSetpointEpsilon = Degrees.of(1.0); |
There was a problem hiding this comment.
What if the turrent never makes it this close? Should there be a timeout?
There was a problem hiding this comment.
Hopefully the shooter will always make it this close. We could add a timeout but I think if it's acceptable to shoot outside of this range then it means we need a wider range.
| driveController.setD(gains.kD()); | ||
| DRIVE_KV = gains.kV(); | ||
| System.out.println("setDriveGains called with " + gains); | ||
| // Don't actually update gains as it causes awful drive performance in sim. |
There was a problem hiding this comment.
I think we might want to just leave these as they are, unless we're going to retune the physical sim constants of drive to make it behave properly. If you enable setting the gains in sim, it makes the steer wheels unable to target their setpoint properly and they oscillate indefinitely.
| // location for a manual mode shot if we ever have to run "no turret" | ||
| && turret.map(TurretSubsystem::isAimedCorrectly).orElse(true)); | ||
|
|
||
| if (canShoot) { |
There was a problem hiding this comment.
Am I reading this logic right that that hopper and indexer won't be activated until the robot is aiming at the target? This will add delay, won't it?
Should we turn the indexer at least on before that?
There was a problem hiding this comment.
We might want to start running the indexer a bit sooner. The problem is, based on shop testing tonight, the indexer was grabbing fuel by itself without ever running hopper. It managed to shoot 4 before I had time to turn the hopper on.
There was a problem hiding this comment.
We might want to start running the indexer a bit sooner. The problem is, based on shop testing tonight, the indexer was grabbing fuel by itself without ever running hopper. It managed to shoot 4 before I had time to turn the hopper on.
Nice.
Adds driver controls and a
coordinateRobotActionsmethod which: