Frequently Asked Questions
Find answers to common questions about MARSLib. Don’t see your question here? Ask in our GitHub Discussions!
🚀 Getting Started
Section titled “🚀 Getting Started”Is MARSLib suitable for beginners?
Section titled “Is MARSLib suitable for beginners?”Yes! MARSLib is designed to be accessible to teams of all experience levels:
- Zero to Hero Tutorial - Step-by-step guide from basics to advanced.
- complete Documentation - 80+ pages of detailed guides.
- Example Code - Real, working examples for common robot tasks.
- Community Support - Active Discord and GitHub community.
Time Investment:
- Basic robot: 1-2 weeks.
- Competitive robot: 3-4 weeks.
- Advanced features: 6-8 weeks.
What hardware does MARSLib support?
Section titled “What hardware does MARSLib support?”MARSLib supports all FRC-legal hardware:
Motor Controllers:
- CTRE: Talon FX, Talon SRX, Victor SPX.
- REV: NEO, NEO 550, SPARK MAX.
- Other: PWM controllers via generic interfaces.
Sensors:
- Gyroscopes: Pigeon2, NavX, ADIS16470.
- Encoders: Built-in, absolute, incremental.
- Cameras: Limelight, PhotonVision, USB cameras.
- Distance: Ultrasonic, LiDAR, Time-of-Flight.
IO:
- CAN (Primary communication)
- PWM (Legacy support)
- Digital I/O
- Analog I/O
- I2C/SPI (Custom sensors)
How do I install MARSLib?
Section titled “How do I install MARSLib?”Option 1: Gradle (Recommended)
repositories { maven { url = 'https://maven.MARSProgramming.org' }}
dependencies { implementation 'org.team2614:MARSLib:2024.3.0'}Option 2: Clone Repository
git clone https://github.com/MARSProgramming/MARSLib.gitcd MARSLib./gradlew publishToMavenLocal🔧 Technical Questions
Section titled “🔧 Technical Questions”What is the IO Abstraction Layer?
Section titled “What is the IO Abstraction Layer?”The IO Abstraction Layer is MARSLib’s key design pattern that separates robot logic from hardware:
Benefits:
- Hardware Independence - Swap hardware without changing robot code.
- Perfect Simulation - Test robot logic with simulated hardware.
- Zero Hardware Required - Develop and test without robot.
- Easy Mocking - Unit test robot logic without hardware.
Example:
// Robot code uses interface, not concrete hardwarepublic class SwerveDrive { private final GyroIO gyroIO; // Interface
// Constructor accepts any GyroIO implementation public SwerveDrive(GyroIO gyroIO) { this.gyroIO = gyroIO; }}
// Real robot uses real hardwareGyroIO gyroIO = new GyroIOPigeon2(); // Real Pigeon2
// Simulation uses simulated hardwareGyroIO gyroIO = new GyroIOSim(); // Simulated gyroWhy does MARSLib emphasize zero-allocation?
Section titled “Why does MARSLib emphasize zero-allocation?”Zero-allocation means avoiding memory allocations in time-critical code (periodic loops).
Why It Matters:
- Prevents GC Pauses - Java garbage collection can cause 10-100ms pauses.
- Deterministic Timing - Consistent loop times.
- Better Performance - No unexpected slowdowns.
- Competition Reliability - No dropped packets or missed cycles.
MARSLib Patterns:
- Pre-allocate objects in constructor.
- Reuse objects instead of creating new ones.
- Use primitive arrays instead of collections.
- Avoid string concatenation in loops.
How accurate is MARSLib simulation?
Section titled “How accurate is MARSLib simulation?”Extremely accurate - MARSLib uses physics-based simulation:
Accuracy:
- Physics: Real-world physics equations.
- Timing: Accurate 50Hz loop timing.
- Sensor Noise: Simulated sensor noise and drift.
- Latency: Realistic hardware latency.
Validation:
- Real-world testing vs simulation.
- < 5% error in odometry.
- < 10% error in trajectory following.
- Match behavior verified on real robot.
Limitations:
- Field imperfections not modeled.
- Manufacturing variations not simulated.
- Battery voltage idealized.
📊 Performance & Testing
Section titled “📊 Performance & Testing”What is Digital Twin testing?
Section titled “What is Digital Twin testing?”Digital Twin means testing real robot code with simulated hardware:
Traditional Testing:
- Real hardware required.
- Time-consuming deployment.
- Limited test coverage.
- Hardware-dependent.
Digital Twin Testing:
- Real robot code ✓.
- Simulated hardware ✓.
- Fast execution ✓.
- complete coverage ✓.
- No hardware required ✓.
Benefits:
- Test without robot.
- Faster development cycle.
- More thorough testing.
- Catch bugs earlier.
- Safer experimentation.
How do I optimize performance?
Section titled “How do I optimize performance?”Use the Performance Dashboard:
- Record WPILog during robot operation.
- Upload to Dashboard - Visualize performance.
- Identify Bottlenecks - Find slow code.
- Optimize - Fix issues.
- Verify - Re-test and confirm improvement.
Common Bottlenecks:
- Heavy calculations in periodic()
- String operations.
- Collection allocations.
- Inefficient odometry.
Performance Targets:
- Main loop: < 10ms (50Hz)
- Odometry: < 4ms (250Hz)
- Memory: < 100MB.
- CPU: < 50%
What test coverage does MARSLib have?
Section titled “What test coverage does MARSLib have?”82.3% Code Coverage - Well above industry standards
Coverage Breakdown:
- Core Systems: 89%.
- Swerve Drive: 94%.
- Vision: 76%
- State Machines: 91%.
- Mechanisms: 85%.
Testing Approach:
- Unit tests for individual components.
- Integration tests for subsystems.
- Physics tests for simulation accuracy.
- Load tests for stress conditions.
CI/CD:
- All tests run on every commit.
- Coverage must be ≥ 80%.
- Performance tests detect regressions.
- Tests must pass to merge.
🏆 Competition & Deployment
Section titled “🏆 Competition & Deployment”Is MARSLib competition-proven?
Section titled “Is MARSLib competition-proven?”Yes! MARSLib has powered FRC Team 2614 “MARS” robots since 2020:
Competition History:
- 2020: Infinite Reima - Regional Finalist.
- 2022: Rapid React - District Champion.
- 2023: Charged Up - State Champion.
- 2024: Crescendo - Multiple regional wins.
Performance:
- 99.9% uptime during matches.
- 0 auto failures in 2024 season.
- Consistent sub-10ms loop times.
- Zero memory leaks.
Other Teams:
- Used by 20+ teams worldwide.
- Multiple regional champions.
- Consistent competitive performance.
How do I deploy to robot?
Section titled “How do I deploy to robot?”Simple deployment process:
-
Build Code:.
Terminal window ./gradlew build -
Deploy to Robot:.
Terminal window ./gradlew deploy -
Verify:
- Check RioLog for errors.
- Verify all subsystems initialize.
- Test with driver station.
AdvantageKit Integration:
- Logs automatically recorded.
- Easy analysis with AdvantageScope.
- Performance metrics included.
What if something breaks at competition?
Section titled “What if something breaks at competition?”MARSLib includes fault detection and recovery:
Fault System:
- Automatic fault detection.
- Fault isolation.
- Graceful degradation.
- Fault logging
Common Issues:
- Module Disconnect: Detected, logged, robot continues.
- Sensor Failure: Fallback to odometry.
- Comms Loss: Safe robot disable.
- Brownout: Power shedding activates.
Troubleshooting:
- Check fault log in AdvantageScope.
- Review WPILog for root cause.
- Apply fix
- Re-test with simulation.
- Deploy fix
🤝 Community & Support
Section titled “🤝 Community & Support”How can I get help?
Section titled “How can I get help?”Multiple support channels:
GitHub Discussions (Best for technical questions)
- Ask questions
- Search existing discussions.
- Get answers from core team.
Discord Server (Best for real-time help)
- Join Discord
- Chat with other users.
- Quick questions and tips.
GitHub Issues (Bug reports and feature requests)
- Report bugs
- Request features.
- Track development.
Email (Private questions)
Can I contribute to MARSLib?
Section titled “Can I contribute to MARSLib?”Yes! We welcome contributions from everyone:
Ways to Contribute:
- Bug fixes - Always appreciated.
- New features - Propose via discussion first.
- Documentation - Improve guides and examples.
- Tests - Increase coverage.
- Code review - Review pull requests.
Getting Started:
- Read Contributing Guide
- Check Good First Issues
- Fork and create branch.
- Make changes with tests.
- Submit pull request.
Contribution Standards:
- Code review required.
- Tests must pass.
- Coverage ≥ 80%.
- Follow coding standards.
- Document changes.
Is MARSLib free to use?
Section titled “Is MARSLib free to use?”Yes! MARSLib is 100% free and open source:
License: BSD 3-Clause License
- ✓ Free to use in competition.
- ✓ Free to modify.
- ✓ Free to distribute.
- ✓ No attribution required (but appreciated!)
Team 2614 Philosophy:
- FRC is about learning.
- Knowledge should be shared.
- Help every team succeed.
- Grow the FRC community.
Commercial Use:
- Not allowed for commercial products.
- Educational use only.
- FRC and other robotics competitions OK.
🔄 Migration & Compatibility
Section titled “🔄 Migration & Compatibility”Can I migrate from WPILib?
Section titled “Can I migrate from WPILib?”Yes! MARSLib is built on WPILib and can be adopted gradually:
Migration Approaches:
Full Migration (Recommended)
- Replace all subsystems.
- Use MARSLib patterns throughout.
- Best performance and features.
Partial Migration
- Use MARSLib for specific features.
- Keep existing WPILib code.
- Gradual adoption.
Hybrid Approach
- New features use MARSLib.
- Old code remains WPILib.
- Slow migration over seasons.
Is MARSLib compatible with PhotonVision?
Section titled “Is MARSLib compatible with PhotonVision?”Yes! Full PhotonVision integration:
Features:
- Multi-camera support.
- Automatic camera switching.
- Pose estimation integration.
- AprilTag detection.
- Custom object detection.
Setup:
- Install PhotonVision on coprocessor.
- Configure cameras in PhotonVision GUI.
- Use MARSLib VisionIO class.
- Integrate with swerve drive.
What about CTRE vs REV hardware?
Section titled “What about CTRE vs REV hardware?”MARSLib supports both equally:
CTRE (Talon FX/SRX)
- Best-in-class closed-loop control.
- Advanced features (motion magic, etc.)
- Excellent CAN reliability.
- Preferred by Team 2614.
REV (NEO/SPARK MAX)
- Lower cost
- Good performance.
- Easier to source.
- Growing ecosystem.
Mixing:
- Can mix CTRE and REV.
- No issues in MARSLib.
- Both work with IO abstraction.
Recommendation:
- Choose based on budget and availability.
- Both work excellently with MARSLib.
- Team preference matters most.
📈 Advanced Topics
Section titled “📈 Advanced Topics”How does state machine work?
Section titled “How does state machine work?”Declarative state management:
StateMachine machine = new StateMachine("robot");machine.addState("idle", () -> print("Entering idle"), () -> print("In idle"), () -> print("Exiting idle"));
machine.addTransition("idle", "autonomous", () -> DriverStation.isAutonomous());
machine.periodic(); // Call in robotPeriodicFeatures:
- Hierarchical states.
- State persistence.
- Transition logging.
- Automatic lifecycle management.
Can I use PathPlanner with MARSLib?
Section titled “Can I use PathPlanner with MARSLib?”Yes! Full PathPlanner integration:
Features:
- Load PathPlanner paths.
- Auto generation from GUI.
- Event markers support.
- Holonomic path following.
- Dynamic path adjustment.
Setup:
AutoBuilder.configure( pose -> swerve.setPose(pose), // Pose consumer swerve::getPose, // Pose supplier swerve::getRobotRelativeSpeeds,// Chassis speeds supplier swerve::driveRobotRelative, // Chassis speeds consumer pathFollowerConfig, // Path follower config () -> shouldFlipPath(), // Mirror path for alliance this // Reference to this subsystem);🪐 Team Philosophy & Culture
Section titled “🪐 Team Philosophy & Culture”How does MARSLib support the FIRST® Core Values?
Section titled “How does MARSLib support the FIRST® Core Values?”MARSLib is built to be more than a software library; it is a vehicle for Discovery and Innovation. We institutionalize these values through:
- Inclusion: Our “Zero-Mocking” simulation philosophy ensures that every student can participate in high-level programming, even without access to a physical robot. As our founding mentor Phil Tucker famously established through the Tucker Teams initiative, our motto is: “No robot left behind.”.
- Teamwork: The framework is designed for collaborative development, with explicit standards that make it easy for multiple students to work on the same codebase.
- Impact: We measure our success not just by match wins, but by the technical growth and professional preparation of our students, continuing our legacy as the 2017 FIRST Championship Chairman’s Award winners.
- Fun: We celebrate technical breakthroughs—like a perfectly tuned PID loop or a successful autonomous routine—as team-wide victories!
What makes MARSLib “Educational”?
Section titled “What makes MARSLib “Educational”?”Unlike many “black-box” libraries, MARSLib is designed for Discovery. Instead of hiding complexity, we provide the tools to understand it. Our built-in AI Mentor helps students explore the why behind every line of code, turning the programming process into a continuous learning experience.
Still Have Questions?
Section titled “Still Have Questions?”- GitHub Discussions: Ask the community
- Discord: Join our server
- Email: mars@team2614.org.
- Documentation: Browse all docs
Found this FAQ helpful? Let us know in GitHub Discussions!