Skip to content

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:

MechanismYour Team’s FileWhat to Look For in Examples
Shooter flywheelsShooterSubsystem.javaVelocity closed-loop, feedforward, spin-up optimization
Intake rollersIntakeSubsystem.javaCurrent limiting, beam break detection, jam handling
Turret aimingTurretSubsystem.javaPosition closed-loop, Motion Magic, soft limits
ClimberClimberSubsystem.javaPosition 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 NeedExample to FindFolder Name (approx.)
Flywheel speed controlVelocity closed-loopVelocityClosedLoop
Position control (turret, elevator)Position closed-loopPositionClosedLoop
Smooth position movesMotion MagicMotionMagic
Following another motorFollower modeFollower
Current limitingCurrent limits configCheck within any example’s configuration
  1. Open the Phoenix 6 examples repo: github.com/CrossTheRoadElec/Phoenix6-Examples
  2. Navigate to the java/ directory
  3. Find the example that matches your mechanism
  4. Open the main robot file (usually Robot.java or 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:

SettingExample’s ValueYour Team’s ValueDifferent?
PID kP
PID kI
PID kD
Feedforward kV
Current limit
Neutral mode (brake/coast)

Control Approach

How does the example command the motor?

  1. What control request does it use? (e.g., VelocityVoltage, PositionVoltage, MotionMagicVoltage)
  2. How does it set the target? (Direct value? Calculated from sensor input?)
  3. Does it use feedforward? (kS, kV, kA values?)
  4. 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:

  1. Configuration differences: Does your team configure the motor the same way? Are there settings in the example that your team doesn’t use?

  2. 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.

  3. 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:

QuestionYour 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?
Checkpoint: Vendor Example Adaptation
Describe the vendor example you studied and the one improvement you identified. Explain: (1) What does the example do differently from your team's code? (2) What specific change would you make? (3) How would you test this change safely before using it in competition?

A strong answer includes:

  1. 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.”

  2. 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.”

  3. 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.