Giter VIP home page Giter VIP logo

pyadvancedcontrol's Introduction

PyAdvancedControl

Build Status

Python Codes for Advanced Control

Dependencies

  • Python 3.7.x

  • cvxpy 1.0.x

  • ecos 2.0.7

  • cvxopt 1.2.x

  • scipy 1.1.0

  • numpy 1.15.0

  • matplotlib 2.2.2

lqr_sample

This is a sample code of Linear-Quadratic Regulator

This is LQR regulator simulation.

1

This is LQR tracking simulation.

1

finite_horizon_optimal_control

This is a finite horizon optimal control sample code

1

mpc_sample

This is a sample code of a simple Model Predictive Control (MPC) regulator simulation

1

mpc_tracking

This is a sample code of a Model Predictive Control (MPC) traget tracking simulation

1

mpc_modeling

This is a sample code for model predictive control optimization modeling without any modeling tool (e.g cvxpy)

This means it only use a solver (cvxopt) for MPC optimization.

It includes two MPC optimization functions:

1 opt_mpc_with_input_const()

It can be applied input constraints (not state constraints).

2 opt_mpc_with_state_const()

It can be applied state constraints and input constraints.

This figure is a comparison of MPC results with and without modeling tool.

1

inverted_pendulum_mpc_control

1

This is a inverted pendulum mpc control simulation.

tools

c2d

This is a API compatible function of MATLAB c2d function.

Convert model from continuous to discrete time MATLAB c2d

pyadvancedcontrol's People

Contributors

atsushisakai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyadvancedcontrol's Issues

Guides on how to use the regulators?

I am very new to regulators and controllers in general. It would be helpful if there were some information on how the provided controllers could be applied to specific use-cases.

In my specific use-case I'm trying to replace a system that uses two PID controllers with a single LQR (or other) controller. There are two variables that can be adjusted, but they both affect a single observable variable that I want to be a set value. In my understanding I'm looking for a MISO (multi input single output) controller. Is this possible to achieve with any of the controllers in this repo or are they only SIMO?

I especially enjoyed this repo since it only uses numpy (and scipy.linalg which I could replace with numpy.linalg).

some bug ?

when i run mpc_path_tracking and mpc_sample

Traceback (most recent call last):
File "main.py", line 177, in
Main()
File "main.py", line 129, in Main
ustar, xstar, cost = CalcInput(A, B, C, x, u)
File "main.py", line 84, in CalcInput
constr = [x[:, t + 1] == A * x[:, t] + B * u[:, t] + C]
File "/usr/local/lib/python3.5/dist-packages/cvxpy/expressions/expression.py", line 46, in cast_op
return binary_op(self, other)
File "/usr/local/lib/python3.5/dist-packages/cvxpy/expressions/expression.py", line 452, in add
return cvxtypes.add_expr()([self, other])
File "/usr/local/lib/python3.5/dist-packages/cvxpy/atoms/affine/add_expr.py", line 33, in init
super(AddExpression, self).init(arg_groups)
File "/usr/local/lib/python3.5/dist-packages/cvxpy/atoms/atom.py", line 45, in init
self._shape = self.shape_from_args()
File "/usr/local/lib/python3.5/dist-packages/cvxpy/atoms/affine/add_expr.py", line 41, in shape_from_args
return u.shape.sum_shapes([arg.shape for arg in self.args])
File "/usr/local/lib/python3.5/dist-packages/cvxpy/utilities/shape.py", line 49, in sum_shapes
len(shapes)
" %s" % tuple(shapes))
ValueError: Cannot broadcast dimensions (4,) (4, 1)

Exception occured when running inverted_pendulum_mpc_control.py

$ python3 inverted_pendulum_mpc_control.py

Exception has occurred: exceptions.TypeError
Variable name 31 must be a string.
  File "/home/***/code/mpc_inv/inverted_pendulum_mpc_control.py", line 67, in mpc_control
  File "/home/***/code/mpc_inv/inverted_pendulum_mpc_control.py", line 43, in main
  File "/home/***/code/mpc_inv/inverted_pendulum_mpc_control.py", line 188, in <module>

Which versions are you using?

Could you perhaps write in the README which versions of the various Python libraries you are using when running the tests?
I'm thinking of Numpy,Scipy, ecos, cvxpy, etc...
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.