sudo apt-get update
sudo apt-get install clang
sudo apt-get install clang-format
sudo apt-get install doxygen
sudo apt-get install libeigen3-dev
sudo apt-get install libboost-all-dev
sudo apt-get install ros-melodic-ifopt
git clone https://github.com/coin-or/CppAD.git cppad.git
cd cppad.git
mkdir build
cd build
cmake ..
make -j8
sudo make install
git clone https://github.com/joaoleal/CppADCodeGen.git CppADCodeGen
mkdir cppadcg-build
cd cppadcg-build
cmake ../CppADCodeGen
sudo make install
git clone https://github.com/giaf/blasfeo.git
cd blasfeo
将blasfeo根目录下的CMakeLists.txt
修改为如下形式,以生成动态库
# build shared library
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
mkdir build
cd build
cmake …
make
sudo make install
sudo sh -c "echo '/opt/blasfeo/lib/' >> /etc/ld.so.conf"
sudo ldconfig
git clone https://github.com/giaf/hpipm.git
cd hpipm
将hpipm根目录下的CMakeLists.txt
修改为如下形式,以生成动态库
# build shared library
set(BUILD_SHARED_LIBS ON CACHE STRING "Build shared libraries")
mkdir build
cd build
cmake …
make
sudo make install
sudo sh -c "echo '/opt/hpipm/lib/' >> /etc/ld.so.conf"
sudo ldconfig
cd ~/your_catkin_workspace/src
git clone https://github.com/ANYbotics/kindr.git
git clone https://github.com/ethz-adrl/control-toolbox.git
git clone https://github.com/ethz-adrl/ct_ros.git
to-your-control-toolbox/ct_models/CMakeLists.txt
if(NOT TARGET ${ct_rbd})
find_package(ct_rbd REQUIRED)
endif()
find_package(Boost REQUIRED system filesystem)
find_package(blasfeo QUIET)
find_package(hpipm QUIET)
# extract interface compile definitions from previous ct packages as options
importInterfaceCompileDefinitionsAsOptions(ct_core)
importInterfaceCompileDefinitionsAsOptions(ct_optcon)
importInterfaceCompileDefinitionsAsOptions(ct_rbd)
to-your-control-toolbox/ct_optcon/CMakeLists.txt
if(blasfeo_FOUND AND hpipm_FOUND)
message(STATUS "Found HPIPM and BLASFEO")
set(HPIPM ON)
list(APPEND HPIPM_LIBS hpipm blasfeo)
list(APPEND ct_optcon_COMPILE_DEFINITIONS HPIPM)
list(APPEND blasfeo_INCLUDE_DIRS /opt/blasfeo/include)
list(APPEND hpipm_INCLUDE_DIRS /opt/hpipm/include)
else()
message(WARNING "Could not find HPIPM or BLASFEO")
endif()
to-your-control-toolbox/ct_rbd/include/ct/rbd/systems/FixBaseFDSystem.h
const ct::core::ControlVector<BASE::NJOINTS> torqueRef = this->computeIDTorques(jStateRef);
若仅需要control-toolbox则可以不执行本小节内容
to-your-ct_ros/ct_ros_nodes/CMakeLists.txt
开启hyq示例程序编译
option(BUILD_HYQ_FULL "Compile all examples for HyQ (takes long, should use clang)" on)
加载blasfeo和hpipm库
# after SET(CMAKE_CXX_FLAGS ...)
find_package(blasfeo)
find_package(hpipm)
开启倒立摆示例程序编译
add_executable(InvertedPendulumNLOC examples/InvertedPendulum/InvertedPendulumNLOC.cpp)
target_link_libraries(InvertedPendulumNLOC ${catkin_LIBRARIES} ct_models)
add_executable(InvertedPendulumNLOC_actDyn examples/InvertedPendulum/InvertedPendulumNLOC_actDyn.cpp)
target_link_libraries(InvertedPendulumNLOC_actDyn ${catkin_LIBRARIES} ct_models)
开启HyANLOC_ObstacleAcc示例程序编译
option(CPPADCG "Compile HyANLOC_ObstacleAcc example" on)
if(CPPADCG)
add_executable(HyANLOC_ObstacleAcc examples/HyA/HyANLOC_ObstacleAcc.cpp)
target_link_libraries(HyANLOC_ObstacleAcc ${catkin_LIBRARIES} ct_ros_visualization ct_models)
endif()
cd ~/your_catkin_workspace
catkin build -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true
上述编译步骤耗时约15min(i5-10210U+16G RAM)
cd ~/your_catkin_workspace
source ~/.bashrc
source devel/setup.bash
rosrun ct_optcon ex_NLOC_boxConstrained
cd ~/your_catkin_workspace
source ~/.bashrc
source devel/setup.bash
roslaunch ct_ros_nodes hya_nloc_example.launch
cd ~/your_catkin_workspace
source ~/.bashrc
source devel/setup.bash
roslaunch ct_ros_nodes invertedPendulum_actDyn.launch