Last Updated: 3/9/2026
Development Environment
This guide covers IDE setup, tools, and best practices for developing the BREAD5940 2025 FRC robot code.
VS Code Configuration
WPILib VS Code
The project uses the WPILib-customized version of VS Code, which includes:
- Java language support
- WPILib command palette integration
- Gradle build integration
- Robot deployment tools
- Simulation launcher
Recommended Extensions
While WPILib VS Code includes essential extensions, consider adding:
-
Extension Pack for Java (if not included)
- Enhanced Java IntelliSense
- Debugging support
- Test runner
-
Gradle for Java
- Gradle task visualization
- Build script editing
-
GitLens
- Advanced Git integration
- Blame annotations
- Commit history
Workspace Settings
The project includes .vscode/ configuration:
{
"java.configuration.updateBuildConfiguration": "automatic",
"java.server.launchMode": "Standard",
"files.exclude": {
"**/.git": true,
"**/.gradle": true,
"**/build": true,
"**/bin": true
}
}Building and Deploying
WPILib Commands
Access via Ctrl+Shift+P (or Cmd+Shift+P on Mac):
Build Commands:
WPILib: Build Robot Code- Compile the projectWPILib: Clean Robot Code- Delete build artifactsWPILib: Test Robot Code- Run unit tests
Deploy Commands:
WPILib: Deploy Robot Code- Deploy to RoboRIOWPILib: Deploy Robot Code (Debug)- Deploy with debugging enabled
Simulation Commands:
WPILib: Simulate Robot Code- Launch robot simulatorWPILib: Simulate Robot Code (Debug)- Launch simulator with debugger
Gradle Tasks
View available Gradle tasks in VS Code:
- Open Gradle sidebar (elephant icon)
- Expand project tasks:
- build tasks -
build,clean,assemble - deploy tasks -
deploy - test tasks -
test
- build tasks -
Command Line Alternatives
# Build
./gradlew build
# Clean build
./gradlew clean build
# Deploy to robot
./gradlew deploy
# Run tests
./gradlew test
# Simulate
./gradlew simulateJavaRobot Simulation
Starting Simulation
- Press
Ctrl+Shift+P - Select
WPILib: Simulate Robot Code - Choose simulation type: Desktop
- Simulation GUI launches
Simulation Components
Driver Station Simulation:
- Enable/disable robot
- Switch modes (Teleop, Auto, Test)
- Select autonomous routine
- View joystick inputs
Robot GUI:
- Visualize subsystem states
- View NetworkTables values
- Monitor motors and sensors
- Display field position
AdvantageScope Integration:
- Logs generated in simulation
- Real-time telemetry viewing
- Replay simulation runs
Simulation Limitations
Not Simulated:
- Physical hardware interactions
- Vision processing (cameras)
- Actual motor behavior
- Network latency
Simulated:
- Command scheduling
- State machines
- Path following
- Basic kinematics
Debugging
Debugging on RoboRIO
- Deploy code in debug mode:
WPILib: Deploy Robot Code (Debug)
- VS Code attaches debugger automatically
- Set breakpoints in code
- Use debug console for variable inspection
Debugging in Simulation
- Launch simulation in debug mode:
WPILib: Simulate Robot Code (Debug)
- Debugger attaches to simulation process
- Full debugging capabilities available
Debug Tips
Breakpoints:
- Click left margin to set breakpoints
- Conditional breakpoints: Right-click breakpoint
- Logpoints: Print without stopping execution
Watch Variables:
- Add variables to Watch panel
- Evaluate expressions in Debug Console
- Inspect object hierarchies
Call Stack:
- View execution path
- Navigate between stack frames
- Identify where exceptions occur
Logging with AdvantageKit
Log File Locations
On RoboRIO:
- Logs saved to USB drive:
/U/logs/ - Insert USB drive before powering on robot
- Logs written in WPILog format
In Simulation:
- Logs saved to project directory
- Path displayed in console output
Viewing Logs
AdvantageScope:
- Download from GitHub
- Open log file (
.wpilog) - Explore telemetry data:
- Subsystem states
- Motor outputs
- Sensor readings
- Field position
- Command scheduling
NetworkTables (Live):
- Use WPILib’s Glass or Shuffleboard
- Connect to robot (10.59.40.2 or 172.22.11.2)
- View real-time data
Adding Custom Logging
import org.littletonrobotics.junction.Logger;
// Log a value
Logger.recordOutput("Subsystem/Value", value);
// Log a pose
Logger.recordOutput("Swerve/Pose", swerve.getPose());
// Log an array
Logger.recordOutput("Swerve/ModuleStates", moduleStates);Testing
Unit Tests
The project uses JUnit 5 for testing.
Run Tests:
./gradlew testTest Reports:
- Generated in
build/reports/tests/test/index.html - Open in browser to view results
Writing Tests:
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class SubsystemTest {
@Test
void testInitialization() {
// Test code
assertEquals(expected, actual);
}
}Code Quality Tools
Spotless (Code Formatting)
The project includes Spotless for code formatting (currently commented out in build.gradle).
To enable:
- Uncomment Spotless configuration in
build.gradle - Run:
./gradlew spotlessApply
Format Code:
# Check formatting
./gradlew spotlessCheck
# Apply formatting
./gradlew spotlessApplyManual Formatting
In VS Code:
Shift+Alt+F(Windows/Linux)Shift+Option+F(Mac)
Vendor Configuration Tools
Phoenix Tuner X
Purpose: Configure CTRE motor controllers and sensors
Usage:
- Download from CTRE
- Connect to robot via USB or WiFi
- Configure motor IDs, inversions, limits
- Generate
TunerConstants.javafor swerve
PathPlanner
Purpose: Create and edit autonomous paths
Usage:
- Download from PathPlanner
- Open project directory
- Edit paths in
src/main/deploy/pathplanner/paths/ - Paths automatically loaded by robot code
PhotonVision
Purpose: Configure vision cameras
Usage:
- Access via web browser:
http://photonvision.local:5800 - Configure pipelines for AprilTags
- Calibrate cameras
- Test vision processing
Version Control with Git
Common Git Workflows
Clone Repository:
git clone https://github.com/BREAD5940/2025-Public.gitCreate Feature Branch:
git checkout -b feature/my-featureCommit Changes:
git add .
git commit -m "Descriptive commit message"Push to Remote:
git push origin feature/my-featurePull Latest Changes:
git pull origin mainGit Best Practices
- Commit frequently - Small, logical commits
- Write clear messages - Explain what and why
- Pull before pushing - Avoid merge conflicts
- Use branches - Keep main branch stable
- Review changes - Use
git diffbefore committing
Performance Monitoring
Loop Timing
Monitor robot loop timing:
Logger.recordOutput("Robot/LoopTime", Timer.getFPGATimestamp());Target: 20ms loop time (50 Hz) Warning: Loops over 20ms indicate performance issues
NetworkTables Bandwidth
- Minimize large data publishing
- Use
SmartDashboard.putBoolean()for simple values - Avoid sending large arrays at high frequency
Troubleshooting
VS Code Issues
Issue: Java language server crashes
- Solution: Reload window (
Ctrl+Shift+P→ “Reload Window”) - Delete
.vscodefolder and restart
Issue: Gradle sync fails
- Solution: Delete
.gradleandbuildfolders - Run
./gradlew clean build
Build Issues
Issue: “Could not resolve dependencies”
- Solution: Check internet connection
- Verify
vendordeps/files are valid JSON - Update vendor libraries
Issue: “Main class not found”
- Solution: Verify
ROBOT_MAIN_CLASSinbuild.gradle - Ensure
Main.javaexists
Next Steps
- Learn about Command-Based Architecture
- Explore Subsystem Documentation
- Review Controls Configuration