mpc_for_inverted_pendulum_on_a_cart_stabilization

Model Predictive Control (MPC) for stabilization of a cart-pendulum system. The files in this repository evaluate LQR, linear MPC, nonlinear MPC and Reference Governor (RG) algorithms.

https://github.com/japaredes/mpc_for_inverted_pendulum_on_a_cart_stabilization

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.4%) to scientific vocabulary

Keywords

casadi model-predictive-control mpc mpc-control
Last synced: 6 months ago · JSON representation ·

Repository

Model Predictive Control (MPC) for stabilization of a cart-pendulum system. The files in this repository evaluate LQR, linear MPC, nonlinear MPC and Reference Governor (RG) algorithms.

Basic Info
  • Host: GitHub
  • Owner: JAParedes
  • Language: MATLAB
  • Default Branch: main
  • Homepage:
  • Size: 13.6 MB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Topics
casadi model-predictive-control mpc mpc-control
Created over 1 year ago · Last pushed 8 months ago
Metadata Files
Readme Citation

README.md

MPC for Inverted Pendulum on a Cart Stabilization

Model Predictive Control (MPC) for stabilization of a cart-pendulum system. The files in this repository evaluate LQR, linear MPC, nonlinear MPC and Reference Governor (RG) algorithms. More details about the implementation are given in the Inverted Pendulum on a Cart system stabilization via MPC control schemes and Inverted Pendulum on a Cart system stabilization via MPC control schemes_Presentation .pdf files. This code is used to obtain training data in [1].

Setup for CasADi in Matlab for Windows

Download CasADi binaries from here, unzip the files and place them in a directory of your choice. Then, in Matlab, run the following command depending on the file you downloaded. addpath('<yourpath>/casadi-3.6.6) In order to run this command each time Matlab starts, run open startup.m and paste the addpath command in the startup.m file.

Demonstration Video

The Youtube video in this link shows the results of each of the main files.

Main Files

  • CartPendulumLinearMPC.m : Implements linear MPC and LQR, and compares the performance of both. The objective is to stabilize the pendulum at the upwards position from an initial angle close to said upwards position.
  • CartPendulumLinearMPCHorizontalPosition.m : Implements linear MPC and LQR, and compares the performance of both. The objective is to stabilize the pendulum at the upwards position while the cart moves horizontally.
  • CartPendulumReferenceGovernorHorizontalPosition.m : Implements LQR and Reference Governor (RG) aided LQR, and compares the performance of both. The objective is to stabilize the pendulum at the upwards position while the cart moves horizontally.
  • CartPendulumNonlinearMPCSwingUp.m : Implements Nonlinear MPC (NMPC). The objective is to swing up the pendulum from a downwards position.
  • CartPendulumSwitchingMPCSwingUp.m : Implements Switching NMPC for extremely-constrained wind-up maneuvers.The objective is to swing up the pendulum from a downwards position under small input and position constraints.

Support Files

  • cartpend.m : Differential equations that describe cart-pendulum dynamics.
  • cartpendCas.m : Version of cartpend.m compatible with CasADi programming scheme.
  • CreateInvertedPendulumonaCartanimation.m : Function that creates an animation from the .mat files created at the end of each of the main programs. Uncomment the instructions at the end of each program to create these files.
  • formQPMatrices.m : Function that creates matrices to set MPC as a Quadratic Programming (QP) problem.
  • myQP.m : Simple dual projected optimization algorithm for solving QP problems, used for implementing MPC at each step.
  • nmpc.m : Implementation of Nonlinear MPC by applying Sequential Quadratic Programming (SQP) by solving QP subsystems and adding up the results.
  • switching_nmpc.m : Implementation of Nonlinear MPC with similar implementation to nmpc.m. This scheme switches Q and Qf matrices depending on proximity to target bearing.

Citing Work

  • [1] Juan Augusto Paredes Salazar, and Ankit Goel. "MPC-guided, Data-driven Fuzzy Controller Synthesis." arXiv preprint arXiv:2410.06556 (2024).

Owner

  • Name: Juan Augusto Paredes
  • Login: JAParedes
  • Kind: user
  • Location: Ann Arbor, MI
  • Company: University of Michigan

I'm an Aerospace Engineering PhD Candidate at the University of Michigan whose research interests are machine learning (adaptive control) and quadcopter GN&C.

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: MPC for cart pendulum stabilization
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Juan Augusto
    family-names: Paredes Salazar
    name-particle: Juan Augusto
    email: juan.augusto.paredes@gmail.com
    orcid: 'https://orcid.org/0000-0001-7486-1231'
repository-code: >-
  https://github.com/JAParedes/MPC-for-cart-pendulum-stabilization

GitHub Events

Total
  • Watch event: 1
  • Push event: 1
Last Year
  • Watch event: 1
  • Push event: 1