用TensorFlow 2实现模型预测控制算法
tfmpc的Python项目详细描述
tf mpc
快速启动
tfmpc是PyPI中提供的Python3.6+包。在
$ pip3 install -U tfmpc
使用
LQR
^{pr2}$$ tfmpc lqr -a 2 -hr 10 -- "-1.0 0.5 3.6" Trajectory(init=[-1. 0.5 3.6], final=[-6.8887715 -5.8231974 -2.4906292], total=-22.6460) Steps | States | Actions | Costs ===== | ============================== | ==================== | ======== 0 | [ 2.4519, -3.4247, 1.5683] | [ -2.4000, -1.9967] | 1.7630 1 | [ -1.3597, 0.6466, 0.4730] | [ -0.4974, -2.2108] | -4.9768 2 | [ 1.2518, -2.4087, 1.8576] | [ -0.8572, -1.7336] | 0.6628 3 | [ -0.5029, -0.3449, 1.0460] | [ -0.9881, -2.3027] | -3.9363 4 | [ 0.7103, -1.8426, 1.4427] | [ -0.9374, -1.8516] | -1.2144 5 | [ -0.2330, -0.6179, 1.4067] | [ -0.9244, -2.2985] | -3.2234 6 | [ 0.5808, -1.8719, 1.0914] | [ -1.0021, -1.7919] | -1.7650 7 | [ -0.5810, -0.5750, 1.7039] | [ -0.7238, -2.5045] | -3.1283 8 | [ -0.1008, -2.8592, 0.9244] | [ -0.8470, -2.0201] | -1.7682 9 | [ -6.8888, -5.8232, -2.4906] | [ 2.1113, -2.2470] | -5.0595
线性导航
$ tfmpc navlin --help Usage: tfmpc navlin [OPTIONS] INITIAL_STATE GOAL Generate and solve the linear navigation LQR problem. Args: initial_state: list of floats. goal: list of floats. Options: -b, --beta FLOAT The weight of the action cost. -hr, --horizon INTEGER RANGE The number of timesteps. --help Show this message and exit.
$ tfmpc navlin -b 5.0 -hr 10 -- "0.0 0.0" "8.0 -9.0" Trajectory(init=[0. 0.], final=[ 7.757592 -8.727291], total=-1045.4086) Steps | States | Actions | Costs ===== | ==================== | ==================== | ========= 0 | [ 2.8645, -3.2225] | [ 2.8645, -3.2225] | 92.9486 1 | [ 4.7018, -5.2895] | [ 1.8373, -2.0670] | -47.0048 2 | [ 5.8795, -6.6145] | [ 1.1777, -1.3249] | -104.6422 3 | [ 6.6331, -7.4623] | [ 0.7536, -0.8478] | -128.3791 4 | [ 7.1134, -8.0025] | [ 0.4802, -0.5403] | -138.1544 5 | [ 7.4163, -8.3433] | [ 0.3029, -0.3408] | -142.1795 6 | [ 7.6025, -8.5528] | [ 0.1862, -0.2094] | -143.8354 7 | [ 7.7091, -8.6727] | [ 0.1067, -0.1200] | -144.5131 8 | [ 7.7576, -8.7273] | [ 0.0485, -0.0545] | -144.7817 9 | [ 7.7576, -8.7273] | [ 0.0000, 0.0000] | -144.8669
文件
请参考https://tfmpc.readthedocs.io/获取代码文档。在
许可证
版权所有(c)2020-Thiago p.Bueno保留所有权利。在
tfmpc是免费软件:您可以重新发布和/或修改它 根据GNU发布的通用公共许可证条款 自由软件基金会,许可证的版本3,或 你的选择)任何更新的版本。在
发布tfmpc是希望它会有用,但是 没有任何保证;甚至没有 适销性或对特定目的的适用性。看看GNU小一点 通用公共许可证获取更多详细信息。在
你应该已经收到了GNU通用公共许可证的副本 以及tfmpc。如果没有,请参见http://www.gnu.org/licenses/。在
- 项目
标签: