Activity 5.10: Use a Vendor Example
🎯 Goal
By the end of this activity you will have:
- Found a relevant vendor example project on GitHub
- Read and understood the example’s motor configuration and control approach
- Compared the example’s pattern to your team’s current implementation
- Identified one improvement you could adapt from the example
Step 1: Choose a Mechanism to Improve
Pick one mechanism from your team’s robot to focus on:
| Mechanism | Your Team’s File | What to Look For in Examples |
|---|---|---|
| Shooter flywheels | Velocity closed-loop, feedforward, spin-up optimization | |
| Intake rollers | Current limiting, beam break detection, jam handling | |
| Turret aiming | Position closed-loop, Motion Magic, soft limits | |
| Climber | Position control, current limiting, brake mode |
Mechanism I’m focusing on: _______________
Step 2: Find the Right Vendor Example
Navigate to the Phoenix 6 examples repository and find an example that matches your mechanism’s control needs.
Phoenix 6 Examples to Look For
| Your Need | Example to Find | Folder Name (approx.) |
|---|---|---|
| Flywheel speed control | Velocity closed-loop | VelocityClosedLoop |
| Position control (turret, elevator) | Position closed-loop | PositionClosedLoop |
| Smooth position moves | Motion Magic | MotionMagic |
| Following another motor | Follower mode | Follower |
| Current limiting | Current limits config | Check within any example’s configuration |
- Open the Phoenix 6 examples repo: github.com/CrossTheRoadElec/Phoenix6-Examples
- Navigate to the
java/directory - Find the example that matches your mechanism
- Open the main robot file (usually
Robot.javaor the subsystem file)
Example I found: _______________ Example URL: _______________
Step 3: Study the Example
Read through the example code and document what you find:
Configuration
What motor configuration does the example use? Fill in what you find:
| Setting | Example’s Value | Your Team’s Value | Different? |
|---|---|---|---|
| PID kP | |||
| PID kI | |||
| PID kD | |||
| Feedforward kV | |||
| Current limit | |||
| Neutral mode (brake/coast) |
Control Approach
How does the example command the motor?
- What control request does it use? (e.g.,
VelocityVoltage,PositionVoltage,MotionMagicVoltage) - How does it set the target? (Direct value? Calculated from sensor input?)
- Does it use feedforward? (kS, kV, kA values?)
- How does it read feedback? (Which status signals does it check?)
Pay special attention to:
- How they initialize the motor — what configuration is applied in the constructor?
- How they handle units — Phoenix 6 uses rotations and rotations-per-second, not raw encoder ticks
- How they handle errors — do they check if configuration was applied successfully?
- What they log — what values do they publish for debugging?
Step 4: Compare to Your Team’s Code
Open your team’s subsystem file and compare it to the example:
-
Configuration differences: Does your team configure the motor the same way? Are there settings in the example that your team doesn’t use?
-
Control approach differences: Does your team use the same control request type? If your team uses simple percent output (
motor.set(0.5)) and the example uses closed-loop control (VelocityVoltage), that’s a significant difference. -
Missing features: Does the example implement something your team’s code doesn’t have? (Current limits, feedforward, status signal logging, etc.)
Step 5: Identify One Improvement
Based on your comparison, identify one specific improvement you could make to your team’s code:
| Question | Your Answer |
|---|---|
| What improvement would you make? | |
| Which file would you modify? | |
| What would you add or change? | |
| What benefit would this provide? | |
| What risk does this change carry? |
A strong answer includes:
-
A specific difference — e.g., “The Phoenix 6 VelocityClosedLoop example uses feedforward (kV = 0.12) in addition to PID. Our shooter only uses PID with no feedforward, which means the PID has to do all the work to maintain speed.”
-
A specific change — e.g., “I would add a kV feedforward term to our shooter’s TalonFXConfiguration. Based on the example, I’d start with kV = 0.12 and tune from there.”
-
A safe testing approach — e.g., “I’d make the change on a Git branch, deploy to the robot during practice, and use AdvantageScope to compare the spin-up time and steady-state accuracy before and after the change. I wouldn’t merge to main until the data shows improvement.”
Bonus: Document Your Findings for the Team
Create a short write-up (3-5 bullet points) summarizing what you learned from the vendor example. Share it with your team so everyone benefits from your research.
Include:
- Which example you studied and why
- The key pattern or technique it demonstrates
- How it compares to your team’s current approach
- Your recommended improvement and how to test it
What’s Next?
You’ve learned to find and adapt vendor examples for your team’s mechanisms. In Lesson 5.1: Deploying and Testing on the Robot, you’ll learn the full deploy-test-debug cycle — from gradlew deploy to Driver Station operation to diagnosing issues under competition pressure.