Skip to content
learnFRC.org
programminglesson35 min

Choreo vs PathPlanner & Kinodynamic Optimization

Contrasting geometric splines with time-optimal kinodynamic trajectory optimization in Choreo and executing trajectory files in PathPlannerLib.

What you will learn

  • Contrast geometric Hermite splines with time-optimal kinodynamic trajectory optimization.
  • Formulate robot plant constraints including brushless motor torque curves, friction circles, and moments of inertia.
  • Parameterize a 4-module swerve chassis accurately within the Choreo trajectory solver.
  • Import `.traj` kinodynamic trajectory files into WPILib using PathPlannerLib's AutoBuilder.

Prerequisites:Guided Learning Course

Creating fast, repeatable autonomous routines requires striking a balance between speed and wheel traction. Traditional path generators rely on geometric splines with static velocity and acceleration caps. While simple to configure, static limits cannot account for motor torque dropoff at high speed or the fact that a robot cannot accelerate maximally while already cornering hard.

Kinodynamic trajectory optimization solves for the mathematically fastest trajectory that the physical robot can execute without exceeding motor torque limits or breaking carpet traction.


Before diving into kinodynamic trajectory optimization:

  1. Ensure your swerve drivetrain is characterized with accurate wheel radius, gear ratios, and track dimensions as taught in Swerve Configuration.
  2. Understand WPILib coordinate conventions: +X points downfield away from the driver alliance wall, and +Y points to the left.

2. Geometric Splines vs Kinodynamic Optimization

Section titled “2. Geometric Splines vs Kinodynamic Optimization”

Understanding the difference between the two approaches explains why kinodynamic trajectories run noticeably faster without wheel slip:

  • Uses cubic or quintic Hermite splines to define the shape of the path.
  • Samples velocity and acceleration along the curve based on fixed scalar maximums:
    • Max Linear Velocity (e.g., 4.5 m/s)
    • Max Linear Acceleration (e.g., 3.5 m/s²)
    • Max Angular Velocity (e.g., 6.28 rad/s)
  • Limitation: The robot cannot accelerate at 3.5 m/s² while already traveling at 4.0 m/s because the drive motors are operating near their back-EMF limit where available torque approaches zero. A static acceleration limit either underutilizes low-speed torque or commands unreachable high-speed acceleration that causes wheel slip.

Choreo (Numerical Interior-Point Optimization)

Section titled “Choreo (Numerical Interior-Point Optimization)”
  • Solves a non-linear optimization problem using the interior-point optimizer IPOPT.
  • Minimizes total transit time:
minimize T = integral(0 to T) 1 dt
  • Subject to dynamic equality constraints:
    • Chassis Newton-Euler equations: sum(F_x) = m * a_x, sum(F_y) = m * a_y, sum(tau) = J * alpha
    • Motor torque-speed curves: available torque tau(omega) = tau_stall * (1 - omega / omega_free)
    • Wheel friction circle: sqrt(F_x^2 + F_y^2) <= mu * F_N
  • Result: The solver commands maximum motor torque when velocity is low, naturally rolls off acceleration as back-EMF rises, and coordinates chassis rotation with translation to prevent saturating wheel traction.

To produce valid trajectories, enter exact physical dimensions into the Choreo robot configuration:

  1. Chassis Mass: Total weighed mass of the robot, including bumpers and battery (e.g., 52.0 kg).
  2. Moment of Inertia (J_z): Rotational inertia about the vertical axis. A typical 28 in × 28 in FRC robot has J_z ≈ 4.0 to 6.5 kg·m².
  3. Module Locations: Offsets of the four wheel contact points from the center of mass in meters (e.g., (±0.28 m, ±0.28 m)).
  4. Drive Motor Model:
    • Motor type: Kraken X60, NEO, or Falcon 500.
    • Motor quantity: 1 per module (4 total drive motors).
    • Gear ratio: Overall drive reduction (e.g., 6.75:1 for L2 MK4i).
    • Wheel radius: Measured rolling radius (e.g., 0.0508 m for 4-inch wheels).
  5. Coefficient of Friction (μ):
    • Billet wheels with neoprene tread on standard FRC carpet typically exhibit μ ≈ 1.1 to 1.3.
    • Setting μ too high (> 1.4) causes the solver to plan violent turns that break traction in practice.

  1. In Choreo, place start, intermediate, and end waypoints across the field.
  2. Add rotational constraints: fix the robot’s heading at scoring positions, but let the solver freely rotate the chassis during transit to align drive wheels with the acceleration vector.
  3. Click Generate. Choreo runs the IPOPT solver locally, converging on a time-optimal state sequence in 1 to 3 seconds.
  4. Export the .traj file into your robot project’s src/main/deploy/choreo/ directory.

PathPlannerLib includes native support for loading and following Choreo trajectories using the same AutoBuilder pipeline:

package frc.robot.commands;
import com.pathplanner.lib.auto.AutoBuilder;
import com.pathplanner.lib.path.PathPlannerPath;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import frc.robot.subsystems.SwerveSubsystem;
public class AutonomousRoutines {
/**
* Loads a pre-optimized Choreo trajectory and constructs a follow command.
*/
public static Command getChoreoAutoCommand(SwerveSubsystem swerve, String trajName) {
try {
// Load pre-computed kinodynamic trajectory from deploy/choreo/<trajName>.traj
PathPlannerPath path = PathPlannerPath.fromChoreoTrajectory(trajName);
// AutoBuilder follows the trajectory using onboard pose estimation
return AutoBuilder.followPath(path);
} catch (Exception e) {
// Fallback command in case trajectory file is missing
return Commands.print("[ERROR] Failed to load Choreo trajectory: " + trajName);
}
}
}
Decouple Heading from Translation

Because swerve drivetrains are holonomic, Choreo can rotate the robot 180 degrees to face an intake while translating sideways toward a game piece. Always leave heading unconstrained at intermediate waypoints so the optimizer can find the fastest wheel vectors.


  1. Solver Convergence:
    • Verify that the Choreo generation indicator shows green (convergence achieved). If red, relax intermediate velocity constraints or increase maximum allowable time steps.
  2. AdvantageScope Trajectory Overlay:
    • In simulation or log replay, compare Swerve/ActualPose against Choreo/DesiredPose.
    • Translation tracking error should remain under 0.08 meters across the entire routine.
    • Heading tracking error should remain under 2.0 degrees.
  3. No Wheel Slip:
    • Inspect wheel speed graphs in AdvantageScope. Commanded module speeds must never saturate abruptly against the physical free speed limit.

Now proceed to Dynamic Obstacle Avoidance & On-the-Fly Navigation to generate collision-free paths in real time when unexpected obstacles block pre-planned routes.

Verified Sources & Standards

Evergreen Standard Verified: Sep 25, 2026