Activity 5.2: Deploy-Test-Fix Cycle
🎯 Goal
By the end of this activity you will have:
- Practiced deploying code to the roboRIO (or simulated the process)
- Diagnosed an intentional code issue using Driver Station output
- Applied a fix and verified it with a second deploy
- Built confidence in the deploy-test-fix cycle under time pressure
Step 1: Set Up a Practice Branch
Before making any intentional changes, create a safe branch:
git checkout -b practice/deploy-test-fixThis ensures you can always get back to working code with git checkout main.
Step 2: Introduce an Intentional Issue
Choose one of these exercises. Each introduces a common bug that you’ll diagnose and fix.
Exercise A: Wrong CAN ID (Hardware Communication Error)
- Open
IntakeSubsystem.java - Find where the intake motor CAN IDs are defined (should reference CAN IDs 31 and 32)
- Change one CAN ID to an unused number (e.g., change 31 to 99)
- Save the file
What to expect: The code will compile and deploy successfully, but the intake won’t work correctly. The Driver Station console should show a warning about a device not found on the CAN bus.
Exercise B: Inverted Motor Direction
- Open
IntakeSubsystem.java - Find the
runIntake()method - Change the speed from positive to negative:
intakeLeftMotor.set(-speed)instead ofintakeLeftMotor.set(speed) - Save the file
What to expect: The code will compile, deploy, and the motor will spin — but in the wrong direction. The intake will push game pieces out instead of pulling them in.
Exercise C: Null Command (Runtime Crash)
- Open
RobotContainer.java - Find one of the button bindings
- Comment out the command but leave the binding:
controller.x().toggleOnTrue(null); - Save the file
What to expect: The code may compile but will crash at runtime when the button is pressed. The DS console will show a NullPointerException.
Exercise I’m doing: _______________
Step 3: Deploy the Buggy Code
Deploy the code with your intentional bug:
./gradlew deployWatch the deploy output carefully:
- Did it compile successfully? (Exercise C might fail at compile time depending on null checks)
- Did it connect to the roboRIO?
- Did the upload complete?
Document what happened:
| Deploy Stage | Result |
|---|---|
| Compile | ✅ / ❌ |
| Connect | ✅ / ❌ |
| Upload | ✅ / ❌ |
| Robot program started | ✅ / ❌ |
Step 4: Diagnose the Issue
Now enable the robot and observe the behavior. Use the Driver Station to gather information:
- Check the DS console — Are there any error messages or warnings?
- Try the affected mechanism — Does it respond at all? Does it behave incorrectly?
- Check other mechanisms — Do unrelated subsystems still work? (This helps isolate the problem)
Document your diagnosis:
| Observation | What I Saw |
|---|---|
| DS console messages | |
| Mechanism behavior | |
| Other subsystems affected? | |
| My diagnosis |
Exercise A (Wrong CAN ID):
- DS console will show: “Warning: TalonFX ID 99 not found on CAN bus” (or similar)
- The intake motor on the wrong ID won’t respond
- Other motors will work fine
- Diagnosis: CAN ID mismatch — the code is looking for a device that doesn’t exist
Exercise B (Inverted Motor):
- DS console won’t show any errors — the code is technically correct
- The intake will spin backwards when activated
- Diagnosis: Motor direction is inverted — need to negate the speed or invert the motor configuration
Exercise C (Null Command):
- DS console will show a NullPointerException stack trace when the button is pressed
- The robot may continue running but the button won’t work
- Diagnosis: Null command passed to a trigger binding — need to provide a valid command
Step 5: Fix the Issue
Now fix the bug you introduced:
- Open the file you modified
- Revert your intentional change (or fix it properly)
- Save the file
- Deploy again:
./gradlew deploy- Enable the robot and verify the mechanism works correctly
Alternatively, practice the fast revert approach:
git stash # Instantly reverts all changes./gradlew deploy # Deploys the original working codeStep 6: Time Yourself
Now do the entire cycle again, but time yourself. At competition, speed matters.
The challenge: Introduce a bug, deploy, diagnose, fix, and redeploy — all within 3 minutes.
| Step | Target Time | Your Time |
|---|---|---|
| Introduce bug | 15 seconds | |
| Deploy buggy code | 30-60 seconds | |
| Diagnose the issue | 30 seconds | |
| Fix the bug | 15 seconds | |
| Redeploy fixed code | 30-60 seconds | |
| Verify the fix | 15 seconds | |
| Total | ~3 minutes |
Strong answers include:
-
The specific exercise and what you changed.
-
The first diagnostic clue — e.g., “The DS console showed a CAN warning immediately after enabling” or “The intake spun but game pieces flew out instead of in.”
-
Diagnosis time — Ideally under 30 seconds for these simple bugs. At competition, you need to be even faster.
-
Competition strategy — e.g., “I would immediately
git stashand redeploy the last working code. I’d fix the bug after the match when there’s no time pressure. A working robot with old code is better than a broken robot with new code.”
Bonus: Partner Exercise
Pair up with a teammate. Have them introduce a bug in the code without telling you what it is. Then:
- They deploy the buggy code
- You diagnose the issue using only the DS console and robot behavior
- You fix the bug and redeploy
- Switch roles and repeat
This simulates real competition debugging where you don’t always know what changed.
What’s Next?
You’ve practiced the deploy-test-fix cycle that you’ll use throughout the season. In Lesson 5.3: CAN Bus and Hardware Debugging, you’ll go deeper into hardware communication — understanding the CAN bus architecture, using Phoenix Tuner X and REV Hardware Client, and interpreting the error messages that appear when hardware goes wrong.