Post

Mintime Optimization: The Minimum-Time Raceline that Solves the Dynamics Directly

Mintime Optimization: The Minimum-Time Raceline that Solves the Dynamics Directly

IQP and SP approximate a fast line using geometric criteria like curvature and distance. Neither uses the vehicle’s dynamics nor computes the lap time itself, so they cannot push the line all the way to the limit of what the car can actually do.

mintime (opt_mintime) goes one step further: it solves the vehicle dynamics and tire model directly to find the theoretically fastest line. This post covers what makes mintime different from IQP/SP, how it finds the line and speed together, which parameters drive it — and why the UNICORN Racing team does not use it in actual operation.

mintime is an optional feature available in the stack, not the method the UNICORN Racing team uses in practice. This post aims to introduce the principle and usage; why the team does not adopt it is covered in “Thoughts on mintime” at the end.

Design Goals

  • Direct lap-time minimization: whereas IQP (minimum curvature) and SP (shortest path) approximate a “geometrically good line,” mintime takes the lap time itself as the objective and finds the optimal line and velocity profile satisfying the vehicle dynamics simultaneously.
  • Optional and expensive: it solves a nonlinear optimal control problem (OCP) with CasADi/IPOPT, so it is computationally heavy and has many parameters. It is disabled by default (enable_mintime=false) and enabled only when needed.

Overview: How It Differs from IQP/SP

IQP SP mintime lines and lap-time comparison IQP / SP / mintime lines and lap-time comparison

IQP and SP optimize geometric objectives — reducing curvature or distance — with alpha (normal displacement) as the variable. They lean on the empirical fact that lower curvature allows higher speed, without computing the lap time directly.

mintime makes lap time the objective itself. It formulates a time-minimizing optimal control problem (OCP) along the track, with the vehicle’s equations of motion (state: lateral position, heading, speed, slip, etc.), the tire friction limit (Magic Formula), and actuator dynamics as constraints. The result is the fastest feasible line and speed within the dynamic limits, found together.

 IQPSPmintime
Variablesalphaalphaalpha + speed + vehicle state
Objectivemin curvature²min distancemin lap time
Modelgeometricgeometricdynamics + tires + actuators
Solveriterative QPsingle QPnonlinear OCP (CasADi/IPOPT)
Velocity profilecomputed afterwardscomputed afterwardsbuilt into the optimization
Costmoderatefastslow (tens of seconds to minutes)

Core Idea: A Time-Minimizing OCP

mintime solves an optimal control problem with the track position $s$ as the independent variable. Intuitively, it treats “in what state and how fast the car passes each point of the track” entirely as unknowns and minimizes the total traversal time.

\[\min_{u} \; T = \int_{0}^{s_{end}} \frac{1}{\dot{s}} \, ds \quad \text{s.t.} \quad \begin{cases} \dot{x} = f(x, u) \\ g(x, u) \le 0 \end{cases}\]

Terms in the formula

  • $x$: vehicle state (lateral displacement, heading error, speed, slip angle, …)
  • $u$: control input (steering, drive/brake)
  • $f$: vehicle equations of motion

Tire forces are modeled with the Magic Formula (Pacejka), constrained so the combined longitudinal/lateral grip limit (friction circle) is never exceeded.

The problem has no closed-form solution, so it is discretized with CasADi and solved numerically with IPOPT (an interior-point nonlinear solver). Solving nonlinear optimal control iteratively makes the computational cost high.

Joint Optimization of Path and Speed

Unlike IQP/SP, which optimize only the line and compute the speed afterwards, mintime finds the line and the velocity profile within a single optimization. Because the line and speed are decided together to minimize lap time under the dynamic constraints, it enables strategic path generation that reflects the vehicle dynamics of the racing domain.

mintime’s decisive difference is that speed is determined inside the optimization rather than computed afterwards. Instead of deciding “where to drive” and “how fast to drive” separately, it finds the fastest combination within the dynamic limits at once.

Parameters

mintime uses settings from two places together.

  • stack_master/config/global_planner_params.yaml: run parameters shared regardless of the optimization method (safety_width, required_laps, …). mintime’s effective car width (width_opt) is also overridden by this safety_width value.
  • stack_master/config/CAR/racecar_f110.ini: mintime-only parameters. The three major sections below are defined here and are parsed only when enable_mintime is on and the mintime optimization is selected.

optim_opts_mintime (Optimization Behavior)

KeyValue (CAR)Meaning
width_opt0.8Effective car width mintime secures [m] (overridden by safety_width)
penalty_delta10.0Steering-rate penalty (smooths the control)
penalty_F0.01Drive-force-rate penalty
mue0.6Friction coefficient (tire D parameter: D = F_z · mue)
safe_trajfalseIf true, additionally limits acceleration

vehicle_params_mintime (Vehicle Dynamics)

Physical properties the OCP uses in the equations of motion — center of mass, inertia, wheelbase, etc. (partial, CAR values)

KeyValueMeaning
wheelbase_front / rear0.15875 / 0.17145Front/rear wheelbase [m]
I_z0.04712Yaw inertia [kg·m²]
cog_z0.074Center-of-gravity height [m]
power_max267Maximum power [W]
f_drive_max / f_brake_max33.4 / 47.4Maximum drive/brake force [N]
delta_max0.34Maximum steering angle [rad]

The front/rear wheelbases are summed as wheelbase_front + wheelbase_rear to compute the total wheelbase automatically.

tire_params_mintime (Tire Magic Formula)

The B/C/E coefficients of the Pacejka Magic Formula, which shape the tire force–slip curve.

KeyValueMeaning
B_front / B_rear7.4 / 7.4Stiffness factor
C_front / C_rear1.2 / 1.2Shape factor
E_front / E_rear0.85 / 0.85Curvature factor
f_z08.6Nominal vertical load [N]

pwr_params_mintime (the powertrain thermal model) is turned off with pwr_behavior=false and unused in the default flow. It is an advanced option that also accounts for motor, battery, and inverter temperatures.

Output

The mintime result follows the same format as IQP/SP (s, x, y, psi, kappa, vx, ax) and is saved along the same path into global_waypoints.json.

Running It

mintime runs through the same raceline-generation launch as IQP; enabling the enable_mintime argument swaps the optimization module to the mintime option.

1
ros2 launch stack_master raceline_generator.launch.xml map:=<map> enable_mintime:=true

Comparing the trajectories that minimum curvature (mincurv) and mintime produce on the same track shows how differently the two methods handle corners.

Minimum-curvature (mincurv) trajectorymintime trajectory

Left: minimum-curvature (mincurv) trajectory · Right: mintime trajectory

mintime driving video

Thoughts on mintime

Strengths

If the vehicle dynamics can be measured accurately, mintime can generate a strategic raceline with the maximum theoretical efficiency. Because it optimizes the lap time itself rather than proxy objectives like curvature or distance, it yields a path that pushes the vehicle to its performance limit.

Weaknesses

  • Measuring the vehicle dynamics accurately is difficult.
  • Due to the nature of nonlinear optimization, the solution frequently fails to converge.
  • Factors that are hard to model — controller performance, actuator latency — are difficult to reflect.

How the UNICORN Racing Team Applies It

In a situation where the vehicle dynamics are hard to know precisely, the UNICORN Racing team operates multiple planners together to respond robustly to diverse driving situations. A separate Velocity Planner layers speed onto each planner’s trajectory based on the friction ellipse and curvature, and this velocity profile is the key tuning target that determines performance.

In other words, the team’s tuning refines speed based on curvature, so the smoother the trajectory’s curvature, the better. But the trajectory mintime produces has less even curvature than minimum curvature does, which fits poorly with this curvature-dependent tuning pipeline. For these reasons the team does not use mintime in actual operation.

Wrap-up

mintime takes the lap time itself as the objective instead of proxy goals like curvature or distance, puts the vehicle dynamics and tire model in as constraints, and optimizes the line and speed at once. It is a powerful tool that yields the theoretically fastest line if the dynamics can be measured precisely — but because of the difficulty of measurement, solver instability, and its less smooth curvature, it was not adopted in the UNICORN Racing team’s curvature-based tuning pipeline. The capability is built into the stack, so in an environment with precisely identified vehicle dynamics it can be considered as an option.

References

This post is licensed under CC BY 4.0 by the author.