Skip to content

MPC controller: linear time-varying MPC with OSQP for diff, omni, Ackermann and aerial robots - #169

Open
fmrico wants to merge 1 commit into
rollingfrom
mpc_ltv
Open

fmrico wants to merge 1 commit into
rollingfrom
mpc_ltv

Conversation

@fmrico

@fmrico fmrico commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Closes #165.

Rewrites easynav_mpc_controller as a linear time-varying MPC solved as a sparse QP with OSQP (osqp_vendor), in place of NLopt.

  • Motion models: diff, omni, ackermann and aerial (x, y, z, yaw), linearized around a nominal trajectory: the previous solution shifted, or the reference when the robot lags it. A time_constant models actuator lag.

  • Constraints:

    • velocity and acceleration limits from robot_limits, including the vertical ones;
    • the turning radius (|w| ≤ v / R);
    • one half-plane per nearby obstacle and step, from the footprint plus safety_margin.

    Bounds always include the nominal, so the QP stays feasible.

  • Reference:

    • the path is projected forward only;
    • its speed profile is limited by curvature, lateral acceleration, the goal and obstacle stops;
    • for turning-radius robots, the path is smoothed adaptively.
  • Topics: <node>/<plugin>/predicted, /reference and /obstacles.

  • Parameters: renamed parameters still work with a deprecation warning. safety_radius, use_collision_checker and verbose are no longer used and only warn.

  • OSQP versions: works with OSQP 0.6 (Humble, Jazzy, Kilted) and 1.x (Lyrical, Rolling).

It needs the new robot_limits fields from #156 (max_vertical_vel/acc/decel, min_turning_radius), so CI will fail until that is merged.

Tests: unit tests for the model, QP and reference; 13 closed-loop scenarios with a simulated robot (corners, narrow passages, obstacles, Ackermann turns, aerial climbs); and parameter validation.

In Gazebo:

  • Kobuki: 8/8 goals.
  • Omni: 6/6 goals.
  • Prius: a lap of Sonoma at ~7.5 m/s, with a mean lateral error of 0.08 m.
  • UFO: across a town, 10/10 waypoints.

Builds: Humble, Jazzy, Kilted, Lyrical and Rolling.

Rewrites easynav_mpc_controller as an LTV-MPC for differential, omnidirectional,
Ackermann and aerial robots, solved as a sparse QP with OSQP (osqp_vendor),
replacing NLopt.

Signed-off-by: Francisco Martín Rico <fmrico@gmail.com>
@juanscelyg
juanscelyg self-requested a review November 1, 2026 15:37

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MPC controller: rewrite as a linear time-varying MPC

2 participants