文章目录
Git
Git: https://github.com/uzh-rpg/agile_autonomy
论文: Learning High-Speed Flight in the Wild
子文链接
后续写了额外三篇博客,可供参考:
仿真环境中生成专家轨迹
仿真器采集无人机仿真数据
网络训练生成飞行轨迹
代码运行
编译环境
Ubuntu18.04 + gcc6 + cuda11.3 + ROS melodic + anaconda3(conda 4.10.1) + python3.8 + open3d v0.10.0
编译步骤
参考git源码的Readme.md
【可选】
可以选择修改下载依赖包的方式为https. 即修改 src/agile_autonomy/dependencies.yaml 的内容如下:
repositories:
catkin_boost_python_buildtool:
type: git
url: https://github.com/ethz-asl/catkin_boost_python_buildtool.git
version: master
catkin_simple:
type: git
url: https://github.com/catkin/catkin_simple.git
version: master
eigen_catkin:
type: git
url: https://github.com/ethz-asl/eigen_catkin.git
version: master
eigen_checks:
type: git
url: https://github.com/ethz-asl/eigen_checks.git
version: master
gflags_catkin:
type: git
url: https://github.com/ethz-asl/gflags_catkin.git
version: master
glog_catkin:
type: git
url: https://github.com/ethz-asl/glog_catkin.git
version: master
mav_comm:
type: git
url: https://github.com/ethz-asl/mav_comm.git
version: master
minimum_jerk_trajectories:
type: git
url: https://github.com/uzh-rpg/minimum_jerk_trajectories.git
version: master
minkindr:
type: git
url: https://github.com/ethz-asl/minkindr.git
version: master
minkindr_ros:
type: git
url: https://github.com/ethz-asl/minkindr_ros.git
version: master
numpy_eigen:
type: git
url: https://github.com/ethz-asl/numpy_eigen.git
version: master
rpg_common:
type: git
url: https://github.com/kelia/rpg_common.git
version: main
rotors_simulator:
type: git
url: https://github.com/ethz-asl/rotors_simulator.git
version: master
rpg_mpc:
type: git
url: https://github.com/uzh-rpg/rpg_mpc.git
version: feature/return_full_horizon
rpg_quadrotor_common:
type: git
url: https://github.com/uzh-rpg/rpg_quadrotor_common.git
version: master
rpg_quadrotor_control:
type: git
url: https://github.com/uzh-rpg/rpg_quadrotor_control.git
version: devel/elia
rpg_single_board_io:
type: git
url: https://github.com/uzh-rpg/rpg_single_board_io.git
version: master
rpg_flightmare:
type: git
url: https://github.com/antonilo/flightmare_agile_autonomy.git
version: main
rpg_mpl_ros:
type: git
url: https://github.com/uzh-rpg/rpg_mpl_ros.git
version: master
assimp_catkin:
type: git
url: https://github.com/uzh-rpg/assimp_catkin.git
version: master
[1] 下载源码
mkdir agile_autonomy_ws
cd agile_autonomy_ws
mkdir -p agile_autonomy_ws/src
cd agile_autonomy_ws
catkin init
catkin config --extend /opt/ros/melodic
catkin config --merge-devel
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-fdiagnostics-color
cd src
git clone https://github.com/uzh-rpg/agile_autonomy.git
vcs-import < agile_autonomy/dependencies.yaml
cd rpg_mpl_ros
git submodule update --init --recursive
#install extra dependencies (might need more depending on your OS)
sudo apt-get install libqglviewer-dev-qt5
# Install external libraries for rpg_flightmare
sudo apt install -y libzmqpp-dev libeigen3-dev libglfw3-dev libglm-dev
# Install dependencies for rpg_flightmare renderer
sudo apt install -y libvulkan1 vulkan-utils gdb
[2] 先安装Open3D
源码安装C++版本的open3D, v0.10.0. 由于采用gcc6编译,因此不用最新版本v0.13.0的open3D。
git clone --recursive https://github.com/intel-isl/Open3D
# You can also update the submodule manually
git submodule update --init --recursive
# 切换到指定版本
git checkout v0.10.0
# On Ubuntu
util/install_deps_ubuntu.sh
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=<open3d_install_directory> ..
# On Ubuntu
make -j$(nproc)
make install
[3] 修改Open3D的相关路径
由于Open3D安装到指定的路径,因此,需要修改源码里面相应的open3D的查找路径。
修改下面三个文件中的Open3D查找路径:
- mpl_test_node/CMakeLists.txt
- open3d_conversions/CMakeLists.txt
- agile_autonomy/data_generation/traj_sampler/CMakeLists.txt
对应行 find_package(Open3D HINTS *:
find_package(Open3D HINTS /home/yourname/open3d_install/lib/cmake/)
[4] 开始编译
catkin build
这里还是会报找不到Open3D, 如下:
CMake Error at /home/wxm/Documents/codes/agile_automomy_wxm/devel/share/open3d_conversions/cmake/open3d_conversionsConfig.cmake:173 (message):
Project 'mpl_test_node' tried to find library 'Open3D'. The library is
neither a target nor built/installed properly. Did you compile project
'open3d_conversions'? Did you find_package() it before the subdirectory
containing its code is included?
解决方法: 修改 agile_automomy_ws/devel/share/open3d_conversions/cmake/open3d_conversionsConfig.cmake 的第157行,增加Open3D的路径:
foreach(path *;/home/yourname/open3d_install/lib)
然后再继续编译,
# Build and re-source the workspace
catkin build
[5] 报错2
error: missing template arguments before ‘timing_spline’
解决方法: 修改文件 agile_automomy_wxm/src/agile_autonomy/data_generation/traj_sampler/src/traj_sampler.cpp 第266行,如下:
Timing<double> timing_spline;
[6] 报错3
error: missing template arguments before ‘(’ token
Eigen::Quaternion(std::cos(-cam_pitch_angle_ / 2.0), 0.0,
解决方法:
修改 agile_automomy_wxm/src/agile_autonomy/data_generation/agile_autonomy/src/agile_autonomy.cpp的第461行为:
Eigen::Quaterniond(std::cos(-cam_pitch_angle_ / 2.0), 0.0,
std::sin(-cam_pitch_angle_ / 2.0), 0.0);
[7] 运行中报错
运行时,可能会报找不到一些python库,根据提示,直pip安装即可。
运行时如果报cv_bridge报如下错误,这是需要源码编译一个cv_bridge.
from cv_bridge.boost.cv_bridge_boost import getCvType
ImportError: dynamic module does not define module export function (PyInit_cv_bridge_boost)
源码安装cv_bridge