Skip to content

PedroTaborda/mpc-for-rendezvous

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

MPC for Rendezvous

This repository contains the code necessary to perform simple rendezvous maneuvers using Model Predictive Control (MPC).

Code Structure

There are two main folders in this repository: code/main/ and code/circle. The latter simply contains code regarding obstacle avoidance and does not contain any space-related code, so it is not discussed here. All following discussion will be regarding the code in code/main/.

The parameters for the simulations are contained in one structure, instantiated by the params() function. This structure also contains the dynamics of the system, thruster definition, gravitational parameters, simulation time, the initial conditions, MPC parameters such as prediction horizon, among others.

The simulation of the system is handled completely by the simulate() function, which requires only the parameters structure as input. This function will simulate the system and return the state and control histories, as well as the time it took for the MPC to solve the optimization problem at each time step. By default, the simulation will be cached in the cache/ folder, so that the simulation does not need to be repeated if the same parameters are used again. The cache can be cleared by deleting the cache/ folder and making sure all persistent variables are cleared from the workspace.

There are two main plotting functions, plotlvlh() and ploteci(), which plot the state histories in the LVLH and ECI frames, along the orbital plane. There is currently no function to plot the trajectory outside of the orbital plane.

A simple example of how to use the code is shown below:

% Instantiate parameters structure
cfg = params();

% Simulate system
[X, U, Tsolve] = simulate(cfg);

% Plot results
plotlvlh(gca, cfg, res);

The MPC controllers are each defined in their own function and are called by the simulate() function depending on the method used, defined by the cfg.simulation.method parameter, which can be set to the following values:

  • cfg.simulation.method = 'standard':
    • mpcStandard.m: MPC controller solving a mixed-integer linear program
  • cfg.simulation.method = 'projected':
    • mpcProjected.m: MPC controller solving a set of convex optimization problems
  • cfg.simulation.method = 'relaxed':
    • mpcRelaxed.m: MPC controller solving a single convex optimization problem

By default, the standard method is used, but the relaxed method is the fastest and very accurate.

The simulate() function allows the user to interact with the state and control input generated by the MPC at each time step. This results in the user being able to view the trajectory as it is being generated. The simSingle.m uses this functionality.

The validation.m script performs several simulations without a controller, and is used to test the accuracy of the dynamics model. Each section of the code along the script tests a different aspect of the dynamics model.

Software required

  • Matlab
  • Gurobi Optimizer
  • pdfcrop

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages