Simulation-Based MPC

An Otter uncrewed surface vehicle (USV) from Maritime Robotics follows a path by model predictive control (MPC). At every step of Δt = 0.5 s it predicts where each plan of turn rates would take it, scores every plan by a cost, drops the plans that break a constraint, and carries out the first step of the cheapest one. Drag the kayak along its line, the Otter (or its bow handle to turn it), or a buoy; hover a plan or a cell of the cost grid to see its cost.
▶ Video: Model Predictive Control (MPC) Explained: Simulation-Based MPC for a USV · playlists Guidance and Control, Autonomous Systems
cheapdear
the cheapest plan
dropped: breaks a constraint
t = 0.0 s

Plans

Cost

Constraints

The Otter

Off the path ye [m]: measured, and planned over the horizon

Turn rate r [deg/s]: carried out, and planned

Cost of each plan, J(ra, rb)

The cheapest plan, now

Things to try

How it works

The model (kinematic, no current and no sideslip), one step ahead by forward Euler, with η = [xn, yn, ψ]⊤ the position north and east and the heading:

xnk+1 = xnk + Δt U cos ψk
ynk+1 = ynk + Δt U sin ψk
ψk+1 = ψk + Δt rk

A plan is a turn rate rk for each step k = 0, …, N − 1 up to the horizon NΔt, here held constant in each segment (ra, then rb, then rc), each one of an evenly spaced set from −rmax to rmax.

The cost adds up the squared distance from the path, ye,k, and the squared turn rates. The distance is measured to the path ahead of the Otter, from the point nearest it on, so a plan that turns round and sails the loop backwards does not score well:

J = Σk=1N ye,k2 + λ Σk=0N−1 rk2

The constraints: |rk| ≤ rmax (no plan asks for more), ‖pk − pkkayak‖ ≥ dsafe with the kayak predicted straight on at its present velocity, and 2.2 m from each buoy. A plan that breaks one is dropped. When every plan is dropped, the Otter keeps its last turn rate.

The Otter, a 2 m USV made by Maritime Robotics, is simulated here as the same kinematic model, every 20 ms, except that its turn rate follows the commanded one with a first-order lag τ, which the model leaves out. The numbers are those of the video: U = 1.5 m/s, Δt = 0.5 s, a horizon of 15 s (N = 30), ra for 4 s and rb for 11 s, 9 rates from −8 to 8 deg/s, λ = 0.05 and dsafe = 8 m. The path is a closed loop of straight legs; ye is positive to starboard of the direction it is sailed.

Simulation-based MPC tries every plan in a small set and keeps the cheapest. Optimization-based MPC searches for the best plan with a numerical solver instead. A well-known simulation-based MPC for ships is SB-MPC (Johansen, Perez and Cristofaro, 2016): it simulates the ship for a small set of course and speed offsets, each held over the horizon, and keeps the one with the lowest cost, with collision risk and COLREGs compliance in the cost. The MPC here differs in its details (turn-rate plans in segments, following a path), but the idea is the same.

T. A. Johansen, T. Perez and A. Cristofaro, "Ship collision avoidance and COLREGS compliance using simulation-based control behavior selection with predictive hazard assessment," IEEE Transactions on Intelligent Transportation Systems, 17(12), 3407–3422, 2016.