Implements comprehensive robot localization system as third template option. Teams can now start with professional positioning and navigation code. Template Features: - 12x12 field grid system (12-inch cells) - Multi-sensor fusion (encoders, IMU, vision) - Kalman-filter-style sensor combination - Fault-tolerant positioning (graceful degradation) - 21 files, ~1,500 lines, 3 passing tests Core Components: - GridCell/Pose2D/FieldGrid - Coordinate system - RobotLocalizer - Sensor fusion engine - OdometryTracker - Dead reckoning from encoders - ImuLocalizer - Heading from gyroscope - VisionLocalizer - Position from AprilTags Sensor Fusion Strategy: Priority 1: Vision (AprilTags) → ±2" accuracy, 100% confidence Priority 2: IMU + Odometry → ±4" accuracy, 70% confidence Priority 3: Odometry only → ±12" accuracy, 40% confidence System gracefully degrades when sensors fail, maintaining operation even with partial sensor availability. Hardware Abstraction: - Interfaces (Encoder, GyroSensor, VisionCamera) - Mock implementations for unit testing - Teams implement FTC wrappers for their hardware Documentation: - LOCALIZATION_GUIDE.md - System architecture and usage - GRID_SYSTEM.md - Field coordinate reference - README.md - Quick start and examples Usage: weevil new my-robot --template localization cd my-robot ./gradlew test # 3 tests pass in < 1 second This teaches professional robotics concepts (sensor fusion, fault tolerance, coordinate systems) not found in other FTC tools. Positions Nexus Workshops as teaching advanced autonomous programming. Updated src/templates/mod.rs to register localization template with proper metadata and feature descriptions. All tests passing (10/10 template tests).
54 lines
1.2 KiB
Plaintext
54 lines
1.2 KiB
Plaintext
# {{PROJECT_NAME}} - Localization Template
|
|
|
|
Grid-based robot localization with sensor fusion and fault tolerance.
|
|
|
|
**Created:** {{CREATION_DATE}}
|
|
**Weevil:** {{WEEVIL_VERSION}}
|
|
**Template:** localization
|
|
|
|
## What's Included
|
|
|
|
- **Grid System** - 12x12 field grid (12" cells)
|
|
- **Sensor Fusion** - Combine encoders, IMU, vision
|
|
- **Fault Tolerance** - Graceful sensor failure handling
|
|
- **3 Tests** - All passing
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
./gradlew test # Run tests
|
|
./build.sh # Build
|
|
./deploy.sh # Deploy
|
|
```
|
|
|
|
## Architecture
|
|
|
|
Field divided into 144 cells (12x12 grid):
|
|
- Cell (0,0) = Red backstage
|
|
- Cell (11,11) = Blue backstage
|
|
- Cell (6,6) = Center
|
|
|
|
Sensor fusion priority:
|
|
1. Vision (AprilTags) - ±2" accuracy
|
|
2. IMU + Odometry - ±4" accuracy
|
|
3. Odometry only - ±12" accuracy
|
|
|
|
## Files
|
|
|
|
**Localization:**
|
|
- GridCell.java - Cell representation
|
|
- Pose2D.java - Position + heading
|
|
- FieldGrid.java - Coordinate system
|
|
- RobotLocalizer.java - Sensor fusion engine
|
|
|
|
**Sensors:**
|
|
- OdometryTracker.java - Dead reckoning
|
|
- ImuLocalizer.java - Heading tracking
|
|
- VisionLocalizer.java - AprilTag positioning
|
|
|
|
**Docs:**
|
|
- LOCALIZATION_GUIDE.md - How it works
|
|
- GRID_SYSTEM.md - Field coordinates
|
|
|
|
See docs/ for full documentation.
|