Pathfinding & Autonomous
To win on Einstein, a robot cannot simply drive straight lines from point A to point B in the autonomous period. The field is littered with obstacles, standard trajectories lack fluidity, and sudden game piece collisions require dynamic recalculations. MARSLib integrates deeply with PathPlanner to bring seamless, holistic pathfinding to the FRC field.
1. Catmull-Rom Splines
Instead of hardcoding angles and trapezoidal movement profiles manually, we utilize Catmull-Rom splines. Splining allows the robot’s Holonomic Drive Controller to continuously traverse a curved trajectory without having to decelerate at individual waypoints.
Try dragging the waypoints (nodes) on the field simulator below to watch how the trajectory natively curves to intercept them smoothly. Press FOLLOW SPLINE to witness the holonomic controller drive the trajectory:
2. A* NavGrid Traversal
During the tele-op period, the driver may need to command the robot to auto-align or traverse from the Loading Zone directly to the Hub. MARSLib uses a NavGrid A* solver running on the Driver Station (or Coprocessor) to intelligently weave a safe path around the Stage/Ladder obstacles.
// Dynamically request a path to a scoring node safely avoiding the StageCommand autoScoreCmd = AutoBuilder.pathfindToPose( new Pose2d(14.5, 5.5, Rotation2d.fromDegrees(180)), new PathConstraints(3.0, 4.0, Units.degreesToRadians(540), Units.degreesToRadians(720)), 0.0, 0.0);3. Fusing Vision with Odometry
Path execution relies 100% on where the robot thinks it is on the field. Without AprilTags, the wheel encoders slowly drift over time. This implies that your Autonomous Splines will gradually shift away from their hardcoded positions as the match progresses.
Path execution relies 100% on where the robot thinks it is on the field. Without AprilTags, the wheel encoders slowly drift over time. This implies that your Autonomous Splines will gradually shift away from their hardcoded positions as the match progresses.
To guarantee mm-perfect precision, we feed the Limelight 4’s MegaTag 2.0 poses directly into the SwerveDrivePoseEstimator. This organically corrects the internal map as the robot drives, ensuring PathPlanner always knows the true distance remaining to the next Spline knot!
📖 Further Reading & External Resources
- PathPlanner Documentation - Standardized GUI for creating autonomous paths.
- WPILib Trajectory Tutorial - Understanding the math behind spline-based pathing.
- CTRE Phoenix 6 Control Requests - Explaining 250Hz frequency CANivore utilization.
- WPILib System Identification (SysId) - Advanced mathematical breakdowns of Quasistatic friction and Dynamic OLS regression curves.
- Team 364 BaseFalconSwerve - The historic FRC architecture that inspired modern template geometries.