Linux 35.5 + JetPack v5.1.3@Fast-Planner编译安装

1. 源由

香港HKUST Aerial Robotics Group开发了一系列基础技术,使空中无人机能够在复杂环境中自主运行。研究涵盖了空中自主导航建模比较完整技术栈,重点在于状态估计、地图绘制、轨迹规划、多机协调以及使用低成本传感和计算组件进行测试平台开发,其代码也被开源在Github - HKUST-Aerial-Robotics

若能很好的借鉴并应用上述技术,在实际领域进行应用拓展,将会对无人机的应用得到显著提升,进而突破闭源商业系统的垄断地位。

Fast-Planner 的开发目标是使四旋翼飞行器能够在复杂的未知环境中快速飞行。它包含了一系列精心设计的规划算法。它还提供了一个基础代码框架和算法,支持包括 ego-plannerFUELRACER 等在内的多个流行的开源无人机项目。

2021年5月13日作为里程碑,正式确立了该代码的可行性。

作为基础和入手点,我们从Fast-Planner安装逐步进入这块领域的探索!

2. 编译&安装

注:为了更好的理解整个软件包对系统的依赖关系,我们之前选用的是ros-base安装。

编译方式看上去非常简单,但是其实里面有很多隐含的依赖关系,在脚本方面做的非常不到位。毕竟在研究方面更多是算法,所以在实际应用面的考虑有所不足,不过后续应该可以通过patch方式帮助完善,这也是为什么我们这里采用base方式安装。

$ git log -n 1
commit 40d41a101e91992b08b1ccf3814c83c641c48bca (HEAD -> master, origin/master, origin/HEAD)
Author: Boyu Zhou <405540572@qq.com>
Date:   Tue May 28 19:48:05 2024 +0800

    Update README.md

Step 1:依赖库安装

$ sudo apt-get install libarmadillo-dev ros_${ROS_VERSION_NAME}_nlopt

Step 2:建立工程

$ mkdir -p ${YOUR_WORKSPACE_PATH}/src
$ cd ${YOUR_WORKSPACE_PATH}/src
$ git clone https://github.com/HKUST-Aerial-Robotics/Fast-Planner.git

注:若存在网络问题,请使用git协议clone代码。git协议始终比https稳定,但需要注意ssh key的安装问题。

Step 3:编译工程

$ cd ${YOUR_WORKSPACE_PATH}
$ catkin_make

Step 4:安装工程

略,因为暂时不涉及软件的部署应用,相关模拟命令参考:

  • 第一次运行Rviz
$ cd ${YOUR_WORKSPACE_PATH}
$ source devel/setup.bash && roslaunch plan_manage rviz.launch
  • 运行quadrotor simulator和Fast-Planner
$ cd ${YOUR_WORKSPACE_PATH}
$ source devel/setup.bash && roslaunch plan_manage kino_replan.launch  //Kinodynamic Path Searching & B-spline Optimization
$ cd ${YOUR_WORKSPACE_PATH}
$ source devel/setup.bash && roslaunch plan_manage topo_replan.launch  //Topological Path Searching & Path-guided Optimization

3. 问题汇总

3.1 Eigen3 组件问题

-- +++ processing catkin package: 'quadrotor_msgs'
-- ==> add_subdirectory(Fast-Planner/uav_simulator/Utils/quadrotor_msgs)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- quadrotor_msgs: 13 messages, 0 services
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find Eigen3 (missing: EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
  (Required is at least version "2.91.0")
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  Fast-Planner/uav_simulator/Utils/quadrotor_msgs/cmake/FindEigen3.cmake:76 (find_package_handle_standard_args)
  Fast-Planner/uav_simulator/Utils/quadrotor_msgs/CMakeLists.txt:101 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/daniel/HKUST/build/CMakeFiles/CMakeOutput.log".
See also "/home/daniel/HKUST/build/CMakeFiles/CMakeError.log".

解决方案:

$ sudo apt-get install libeigen3-dev

3.2 pcl_conversions 组件问题

-- +++ processing catkin package: 'map_generator'
-- ==> add_subdirectory(Fast-Planner/uav_simulator/map_generator)
-- Could NOT find pcl_conversions (missing: pcl_conversions_DIR)
-- Could not find the required component 'pcl_conversions'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "pcl_conversions"
  with any of the following names:

    pcl_conversionsConfig.cmake
    pcl_conversions-config.cmake

  Add the installation prefix of "pcl_conversions" to CMAKE_PREFIX_PATH or
  set "pcl_conversions_DIR" to a directory containing one of the above files.
  If "pcl_conversions" provides a separate development package or SDK, be
  sure it has been installed.
Call Stack (most recent call first):
  Fast-Planner/uav_simulator/map_generator/CMakeLists.txt:8 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/daniel/HKUST/build/CMakeFiles/CMakeOutput.log".
See also "/home/daniel/HKUST/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

解决方案:

$ sudo apt-get install ros-noetic-pcl-ros

3.3 cv_bridge组件问题

-- +++ processing catkin package: 'plan_env'
-- ==> add_subdirectory(Fast-Planner/fast_planner/plan_env)
-- Found OpenCV: /usr (found version "4.5.4")
-- Could NOT find cv_bridge (missing: cv_bridge_DIR)
-- Could not find the required component 'cv_bridge'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "cv_bridge" with
  any of the following names:

    cv_bridgeConfig.cmake
    cv_bridge-config.cmake

  Add the installation prefix of "cv_bridge" to CMAKE_PREFIX_PATH or set
  "cv_bridge_DIR" to a directory containing one of the above files.  If
  "cv_bridge" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  Fast-Planner/fast_planner/plan_env/CMakeLists.txt:7 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/daniel/HKUST/build/CMakeFiles/CMakeOutput.log".
See also "/home/daniel/HKUST/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

解决方案:

$ sudo apt-get install ros-noetic-cv-bridge

3.4 laser_geometry 组件问题

-- +++ processing catkin package: 'multi_map_server'
-- ==> add_subdirectory(Fast-Planner/uav_simulator/Utils/multi_map_server)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Could NOT find laser_geometry (missing: laser_geometry_DIR)
-- Could not find the required component 'laser_geometry'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "laser_geometry"
  with any of the following names:

    laser_geometryConfig.cmake
    laser_geometry-config.cmake

  Add the installation prefix of "laser_geometry" to CMAKE_PREFIX_PATH or set
  "laser_geometry_DIR" to a directory containing one of the above files.  If
  "laser_geometry" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  Fast-Planner/uav_simulator/Utils/multi_map_server/CMakeLists.txt:45 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/daniel/HKUST/build/CMakeFiles/CMakeOutput.log".
See also "/home/daniel/HKUST/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

解决方案:

$ sudo apt-get install ros-noetic-laser-geometry

3.5 Eigen组件问题

-- +++ processing catkin package: 'local_sensing_node'
-- ==> add_subdirectory(Fast-Planner/uav_simulator/local_sensing)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Warning at /opt/ros/noetic/share/catkin/cmake/catkin_package.cmake:166 (message):
  catkin_package() DEPENDS on 'Eigen' but neither 'Eigen_INCLUDE_DIRS' nor
  'Eigen_LIBRARIES' is defined.
Call Stack (most recent call first):
  /opt/ros/noetic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package)
  Fast-Planner/uav_simulator/local_sensing/CMakeLists.txt:69 (catkin_package)


-- +++ processing catkin package: 'rviz_plugins'
-- ==> add_subdirectory(Fast-Planner/uav_simulator/Utils/rviz_plugins)
-- Could NOT find rviz (missing: rviz_DIR)
-- Could not find the required component 'rviz'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "rviz" with any of
  the following names:

    rvizConfig.cmake
    rviz-config.cmake

  Add the installation prefix of "rviz" to CMAKE_PREFIX_PATH or set
  "rviz_DIR" to a directory containing one of the above files.  If "rviz"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  Fast-Planner/uav_simulator/Utils/rviz_plugins/CMakeLists.txt:6 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/daniel/HKUST/build/CMakeFiles/CMakeOutput.log".
See also "/home/daniel/HKUST/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

解决方案:

$ sudo apt-get install ros-noetic-rviz

3.6 PCL requires C++14组件问题

#error PCL requires C++14 or above

**解决方案:**在全局CMakeLists.txt中添加CMAKE_CXX_STANDARD 14

# set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
$ sudo vi ${YOUR_WORKSPACE_PATH}/src/CMakeLists.txt
$ cat ${YOUR_WORKSPACE_PATH}/src/CMakeLists.txt |head -n 5

示例:

daniel@nvidia:~/HKUST$ cat src/CMakeLists.txt |head -n 10
# toplevel CMakeLists.txt for a catkin workspace
# catkin/cmake/toplevel.cmake

cmake_minimum_required(VERSION 3.0.2)

project(Project)

set(CATKIN_TOPLEVEL TRUE)
set(CMAKE_CXX_STANDARD 14)

3.7 undefined reference to `cv::Mat::Mat()’

[100%] Linking CXX executable /home/daniel/HKUST/devel/lib/plan_manage/fast_planner_node
/usr/bin/ld: CMakeFiles/fast_planner_node.dir/src/planner_manager.cpp.o: in function `MappingData::MappingData()':
/home/daniel/HKUST/src/Fast-Planner/fast_planner/plan_env/include/plan_env/sdf_map.h:115: undefined reference to `cv::Mat::Mat()'
/usr/bin/ld: /home/daniel/HKUST/src/Fast-Planner/fast_planner/plan_env/include/plan_env/sdf_map.h:115: undefined reference to `cv::Mat::Mat()'
collect2: error: ld returned 1 exit status
make[2]: *** [Fast-Planner/fast_planner/plan_manage/CMakeFiles/fast_planner_node.dir/build.make:311: /home/daniel/HKUST/devel/lib/plan_manage/fast_planner_node] Error 1
make[1]: *** [CMakeFiles/Makefile2:5244: Fast-Planner/fast_planner/plan_manage/CMakeFiles/fast_planner_node.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Invoking "make -j6 -l6" failed

**解决方案:**这个绝对是脚本问题了,需要链接${OpenCV_LIBS}库,不知道为什么没有PR上去!!!

target_link_libraries( plan_env
    ${catkin_LIBRARIES} 
    ${PCL_LIBRARIES}
    ${OpenCV_LIBS}
    )  
$ sudo vi ${YOUR_WORKSPACE_PATH}/src/Fast-Planner/fast_planner/plan_env/CMakeLists.txt

示例:

$ git diff fast_planner/plan_env/CMakeLists.txt
diff --git a/fast_planner/plan_env/CMakeLists.txt b/fast_planner/plan_env/CMakeLists.txt
index a700b8d..d14ae73 100755
--- a/fast_planner/plan_env/CMakeLists.txt
+++ b/fast_planner/plan_env/CMakeLists.txt
@@ -45,6 +45,7 @@ add_library( plan_env
 target_link_libraries( plan_env
     ${catkin_LIBRARIES}
     ${PCL_LIBRARIES}
+    ${OpenCV_LIBS}
     )

 add_executable(obj_generator

4. 总结

至此,我们完成了FasPlanner的编译安装,后续我们将另外章节,来介绍如何执行模拟。

CUDA编译优化

$ git diff uav_simulator/local_sensing/CMakeLists.txt
diff --git a/uav_simulator/local_sensing/CMakeLists.txt b/uav_simulator/local_sensing/CMakeLists.txt
index a868546..fe0ebad 100644
--- a/uav_simulator/local_sensing/CMakeLists.txt
+++ b/uav_simulator/local_sensing/CMakeLists.txt
@@ -3,8 +3,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
 SET(CMAKE_BUILD_TYPE Release) # Release, RelWithDebInfo
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

-set(ENABLE_CUDA false)
-# set(ENABLE_CUDA true)
+#set(ENABLE_CUDA false)
+set(ENABLE_CUDA true)

 if(ENABLE_CUDA)
   find_package(CUDA REQUIRED)
@@ -17,8 +17,9 @@ if(ENABLE_CUDA)
 #       -gencode arch=compute_50,code=sm_50;
 #       -gencode arch=compute_52,code=sm_52;
 #       -gencode arch=compute_60,code=sm_60;
-      -gencode arch=compute_61,code=sm_61;
-  )
+#       -gencode arch=compute_61,code=sm_61;
+        -gencode arch=compute_87,code=sm_87;
+)

   SET(CUDA_PROPAGATE_HOST_FLAGS OFF)

5. 补充 - FUEL新版

从HKUST维护的Fast-Planner情况看,可能更偏向学术,有很多兼容性问题,也没有足够的人力维护;不过貌似HKUST - FUEL可能是更加新的版本。不过,总体来说github上的作者还是ZbyLGsc在维护。

  • 24
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值