Control Toolbox 学习过程

18 篇文章 2 订阅
3 篇文章 1 订阅

Control Toolbox 学习过程

Overview

Control Toolbox

  1. 这个库可以用于建模, 控制, 估计, 轨迹优化和模型预测控制.
  2. 可以对由微分方程或者差分方程表达的系统直接建模.intuitive modelling of systems governed by ordinary differential- or difference equations.
  3. 依赖 Eigen 和 Kindr 两个库.
  4. CT 的结构:
    1. 三个主要模块: The Core module (ct_core), the Optimal Control (ct_optcon) module and the rigid body dynamics (ct_rbd) module.
    2. ct_core: 提供通用的数据类型定义和数学工具,比如:数据类型定义,系统定义,控制器定义,数值积分
    3. ct_optcon: 依赖于ct_core, 增加了用于定义和解决最佳控制问题的基础架构, 能够定义损失函数, 约束条件, 求解器后端, 和一个同用的 MPC 封装.
    4. ct_rbd: 刚体动力学建模工具,
    5. 还有一个额外的包 ct_models: 包含各种机器人模型,包括四足机器人,机械臂,普通四旋翼和带有倾斜负载的四旋翼.
  5. CT Core

fatal error: Python.h: No such file or directory #include <Python.h>

解决方案:

  1. 在CmakeLists.txt文件里面添加
    find_package(PythonLibs REQUIRED)
    include_directories(${PYTHON_INCLUDE_DIRS})
    target_link_libraries( ${PYTHON_LIBRARIES})

无法加载matplotlib

退出anaconda的工作环境,在CMakeLists.txt文件里面添加
include_directories(/usr/include/python3.6)
include_directories(/usr/lib/python3/dist-packages/matplotlib)

target_link_libraries(ct_plot ${ct_core_LIBS} /home/sjtuer/anaconda3/lib/libstdc++.so.6
/usr/lib/x86_64-linux-gnu/libboost_python-py36.so
/usr/lib/x86_64-linux-gnu/libpython3.6m.so)

安装编译过程:

安装blasfeo

git clone https://github.com/giaf/blasfeo.git;
cd blasfeo
mkdir build
cd build
cmake …
make
sudo make install

再安装 hpipm

git clone https://github.com/giaf/hpipm.git
cd hpipm
mkdir build
cd build
cmake …
make
sudo make install

从git上面直接clone下来的ct源码是基于ROS 1.0的,为了在ROS 2.0里面能够正常编译且可以用ros2run启动节点,需要的修改内容:

在每个package的package.xml文件里面,将

ct_core里面

<package format="3">
  <name>ct_core</name>
  <version>3.0.2</version>
  <description>
    Control toolbox - core module.
  </description>
  <author>Markus Giftthaler</author>
  <author>Michael Neunert</author>
  <author>Markus Stäuble</author>
  <maintainer email="markusgft@gmail.com">Markus Giftthaler</maintainer>
  <license>BSD-2</license>

  <buildtool_depend>ament_cmake</buildtool_depend>
  <depend>eigen</depend>
  <!-- <exec_depend>catkin</exec_depend>  ROS compatibility -->

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <export>    <!-- Specify that this is not a ROS package-->
    <build_type>ament_cmake</build_type>
  </export>
</package>

ct_doc里面:

<package format="3">
  <name>ct_doc</name>
  <version>3.0.2</version>
  <description>
    Control toolbox - Documentation
  </description>

  <maintainer email="markusgft@gmail.com">Markus Giftthaler</maintainer>

  <license>BSD-2</license>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <depend>ct_core</depend>
  <depend>ct_optcon</depend>
  <depend>ct_rbd</depend>
  <depend>ct_models</depend>

  <!-- <exec_depend>catkin</exec_depend>  ROS compatibility -->

  <export>    <!-- Specify that this is not a ROS package-->
    <build_type>ament_cmake</build_type>
  </export>

</package>

ct_models里面:

<package format="3">
	<name>ct_models</name>
	<version>3.0.2</version>
	<description>
        Control toolbox - models module.
	</description>

	<maintainer email="markusgft@gmail.com">Markus Giftthaler</maintainer>

	<license>BSD-2</license>

	<buildtool_depend>ament_cmake</buildtool_depend>

	<depend>ct_rbd</depend>
	<!-- <exec_depend>catkin</exec_depend>	ROS compatibility -->

	<export>		<!-- Specify that this is not a ROS package-->
		<build_type>ament_cmake</build_type>
	</export>
</package>

ct_optcon里面:

<package format="3">
  <name>ct_optcon</name>
  <version>3.0.2</version>
  <description>
    Control toolbox - optcon module.
  </description>
  <license>BSD-2</license>

  <author>Markus Giftthaler</author>
  <author>Michael Neunert</author>
  <author>Markus Stäuble</author>
  <maintainer email="markusgft@gmail.com">Markus Giftthaler</maintainer>

  <buildtool_depend>ament_cmake</buildtool_depend>
  <depend>ct_core</depend>

  <!-- <exec_depend>catkin</exec_depend>  ROS compatibility -->

  <export>    <!-- Specify that this is not a ROS package-->
    <build_type>ament_cmake</build_type>
  </export>
</package>

ct_rbd里面:

<package format="3">
  <name>ct_rbd</name>
  <version>3.0.2</version>
  <description>
    Control toolbox - rbd module.
  </description>
  <license>BSD-2</license>
  
  <author>Markus Giftthaler</author>
  <author>Michael Neunert</author>
  <maintainer email="markusgft@gmail.com">Markus Giftthaler</maintainer>

  <buildtool_depend>ament_cmake</buildtool_depend>
  <depend>ct_optcon</depend>
  <depend>kindr</depend>

  <!-- <exec_depend>catkin</exec_depend>  ROS compatibility -->

  <export>    <!-- Specify that this is not a ROS package-->
    <build_type>ament_cmake</build_type>
  </export>
</package>

CMakeLists.txt文件里面

添加

find_package(ament_cmake REQUIRED)
ament_package()

添加后编译可能会报错,有些包提示找不到ct_core,这个时候在将对应报错的包的ament_package()注释掉,然后再编译一边就可以了.

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值