Nonlinear predictive control of unicycle robot (2): code analysis, part I, preliminaries

Antonio Sala, UPV

Difficulty: *** ,       Relevance: PIC,      Duration: 27:59

Materials:    [ Cód.: RobotTrajectoryOptimizationCode.zip ]

Summary:

This video presents the Python code (Matlab code also available) which executes the nonlinear trajectory optimization whose problem statement was discussed in video [mpcunic1EN].

The code explanation will be split in two videos, this one explaining some preliminary setup and the next on [mpcunic3EN] continuing with the core optimization problem.

In the present video, we discuss the size of states and actions, the differential equation model of the unicycle robot abstraction, the polyhedral Ax ≤ b representation of the safe corridor and the generation of an initial guess for the optimizer to start upon. The initial guess will be inconsistent, infeasible, but luckily, the optimizer seemed to find its way towards feasible solutions.

The robot has linear velocity and angular velocity constraints; it is left to the reader to amend the code towards a more realistic two-wheel robot model with wheel velocity constraints instead.

As commented above, discussion on the code continues on video [mpcunic3EN], and actual simulation runs and animation will be the objective of video [mpcunic4EN].

*Link to my [whole collection] of videos in English. Link to larger [Colección completa] in Spanish.

© 2026, A. Sala. All rights reserved for materials from authors affiliated to Universitat Politecnica de Valencia.
Please consult original source/authors for info regarding rights of materials from third parties.