Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements functionality to turn the robot toward an April Tag using vision feedback. The implementation introduces a new RobotState singleton to share vision yaw data between subsystems and adds commands to coordinate vision updates with drive rotation.
- Introduces
RobotStatesingleton for sharing vision yaw data across subsystems - Adds
rotateToTag()command chain fromOrchestratorthroughDriveandVisionsubsystems - Configures closed-loop control on drive motors with PID tuning placeholders
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| RobotState.java | New singleton class to store shared vision yaw data |
| Vision.java | Adds updateYaw() command to update RobotState with current yaw |
| Drive.java | Adds toAprilTag() command to execute rotation via IO layer |
| DriveIO.java | Adds rotateToTag() interface method for implementations |
| DriveIOSparkMax.java | Implements rotateToTag() with velocity control and configures PID |
| DriveConstants.java | Adds RPM_PER_RAD conversion constant |
| Orchestrator.java | Adds rotateToTag() command combining vision update and drive rotation |
| RobotContainer.java | Wires up orchestrator with vision/drive subsystems and binds X button |
| ShooterIOSparkMax.java | Adds unused import for SparkClosedLoopController |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ShayanHasNo
left a comment
There was a problem hiding this comment.
Please check all comments
| @Override | ||
| public void rotateToTag() { | ||
| var newVelocity = pidController.calculate(RobotState.get().visionYaw, 0); | ||
| leftLeader.set(newVelocity); |
There was a problem hiding this comment.
You’re going to have to figure out a constant that turns the degree value into a range of -1 and 1 as motor.set only accepts that range. Multiple the constant and the PID output to get your ‘velocity’
There was a problem hiding this comment.
I've just clamped it for now, I think we'll need to create a function for PID to properly work. I'll work on that.
This is to turn the robot to an April Tag. The constant in drive is very badly named…