|
3 | 3 | []() |
4 | 4 | [](https://travis-ci.org/Shunichi09/PythonLinearNonlinearControl) |
5 | 5 |
|
6 | | -# PythonLinearNonLinearControl |
| 6 | +# PythonLinearNonlinearControl |
7 | 7 |
|
8 | | -PythonLinearNonLinearControl is a library implementing the linear and nonlinear control theories in python. |
| 8 | +PythonLinearNonlinearControl is a library implementing the linear and nonlinear control theories in python. |
9 | 9 | Due to use only basic libralies (scipy, numpy), this library is easy to extend for your own situations. |
10 | 10 |
|
11 | 11 | <div><img src="assets/concept.png" width="500"/></div> |
@@ -78,7 +78,7 @@ All states and inputs of environments are continuous. |
78 | 78 |
|
79 | 79 | You could know abount our environmets more in [Environments.md](Environments.md) |
80 | 80 |
|
81 | | -# Usage |
| 81 | +# Installation |
82 | 82 |
|
83 | 83 | ## To install this package |
84 | 84 |
|
|
104 | 104 | pip install -e . |
105 | 105 | ``` |
106 | 106 |
|
107 | | -## Run Experiments |
108 | | - |
109 | | -You can run the experiments as follows: |
110 | | - |
111 | | -``` |
112 | | -python scripts/simple_run.py --env FirstOrderLag --controller CEM |
113 | | -``` |
114 | | - |
115 | | -**figures and animations are saved in the ./result folder.** |
116 | | - |
117 | 107 | # Basic concepts |
118 | 108 |
|
119 | 109 | When we design control systems, we should have **Model**, **Planner**, **Controller** and **Runner** as shown in the figure. |
@@ -141,6 +131,71 @@ Runner runs the simulation. |
141 | 131 |
|
142 | 132 | Please, see more detail in each scripts. |
143 | 133 |
|
| 134 | +# Getting started |
| 135 | + |
| 136 | +## [QuickStart Guide](scripts/quickstart/quickstart.md) |
| 137 | + |
| 138 | +This is a quickstart guide for users who just want to try PythonLinearNonlinearControl. |
| 139 | +If you have not installed PythonLinearNonLinearControl, please see the section of "how to setup" in README.md |
| 140 | + |
| 141 | +When we design control systems, we should have Environment, Model, Planner, Controller and Runner. |
| 142 | +Therefore your script contains those Modules. |
| 143 | + |
| 144 | +First, import each Modules from PythonLinearNonlinearControl. |
| 145 | + |
| 146 | +```py |
| 147 | +from PythonLinearNonlinearControl import configs |
| 148 | +from PythonLinearNonlinearControl import envs |
| 149 | +from PythonLinearNonlinearControl import models |
| 150 | +from PythonLinearNonlinearControl import planners |
| 151 | +from PythonLinearNonlinearControl import controllers |
| 152 | +from PythonLinearNonlinearControl import runners |
| 153 | +``` |
| 154 | + |
| 155 | +Configs contains each modules configurations such as cost functions, prediction length, ...etc. |
| 156 | + |
| 157 | +Then you can make each module. (This is example about CEM and CartPole env) |
| 158 | + |
| 159 | +```py |
| 160 | +config = configs.CartPoleConfigModule() |
| 161 | +env = envs.CartPoleEnv() |
| 162 | +model = models.CartPoleModel(config) |
| 163 | +planner = controllers.CEM(config, model) |
| 164 | +runner = planners.ConstantPlanner(config) |
| 165 | +controller = runners.ExpRunner() |
| 166 | +``` |
| 167 | + |
| 168 | +The preparation for experiment has done! |
| 169 | +Please run the runner. |
| 170 | + |
| 171 | +```py |
| 172 | +history_x, history_u, history_g = runner.run(env, controller, planner) |
| 173 | +``` |
| 174 | + |
| 175 | +You can get the results of history of state, history of input and history of goal. |
| 176 | +Use that histories to visualize the Animation or Figures. |
| 177 | +(Note FirstOrderEnv does not support animation) |
| 178 | + |
| 179 | +```py |
| 180 | +# plot results |
| 181 | +plot_results(args, history_x, history_u, history_g=history_g) |
| 182 | +save_plot_data(args, history_x, history_u, history_g=history_g) |
| 183 | + |
| 184 | +# create animation |
| 185 | +animator = Animator(args, env) |
| 186 | +animator.draw(history_x, history_g) |
| 187 | +``` |
| 188 | + |
| 189 | +## Run Experiments |
| 190 | + |
| 191 | +You can run the experiments as follows: |
| 192 | + |
| 193 | +``` |
| 194 | +python scripts/simple_run.py --env CartPole --controller CEM --save_anim 1 |
| 195 | +``` |
| 196 | + |
| 197 | +**figures and animations are saved in the ./result folder.** |
| 198 | + |
144 | 199 | # Old version |
145 | 200 |
|
146 | 201 | If you are interested in the old version of this library, that was not a library just examples, please see [v1.0](https://github.com/Shunichi09/PythonLinearNonlinearControl/tree/v1.0) |
@@ -168,4 +223,4 @@ author = {Shunichi Sekiguchi}, |
168 | 223 | title = {PythonLinearNonlinearControl}, |
169 | 224 | note = "\url{https://github.com/Shunichi09/PythonLinearNonlinearControl}", |
170 | 225 | } |
171 | | -``` |
| 226 | +``` |
0 commit comments