Linux 35.5 + JetPack v5.1.3@RACER编译安装
- 1. 源由
- 2. 编译&安装
- Step 1:依赖库安装
- Step 2:LKH-3安装
- Step 3:建立工程
- Step 4:编译工程
- Step 5:安装工程
- 3. 问题汇总
- 3.1 组件ros-noetic-multi-map-server问题
- 3.2 swarm_exploration/plan_env - OpenCV
- 3.3 uav_simulator/local_sensing - CUDA优化
- 3.4 第二次重复编译错误
- 4. 创建pcd环境
- 5. 总结
1. 源由
鉴于以下两个自动导航规划路径的软件在模拟环节都有不同程度的segfault,那么只能在尝试下他们的后任继承代码。
- Linux 35.5 + JetPack v5.1.3@Fast-Planner编译安装
- Linux 35.5 + JetPack v5.1.3@FUEL编译安装
现在就顺着代码指向或者历史路径找到了RACER, RApid Collaborative ExploRation。这是一种完全分散的方法,用于使用一支四旋翼飞行器队伍进行探索任务。所提出的系统具有针对不稳定通信的鲁棒性,以及高度的协调性。四旋翼团队采用异步和有限通信运作,不需要任何中央控制。为了充分发挥系统的潜力,团队的覆盖路径和工作负载分配进行了优化和平衡。
2. 编译&安装
注1:不清楚ROS版本的,请先查看下版本,注意要ROS而非ROS2。
$ rosversion --distro
noetic
注2:基于RACER最新github上的代码版本。
$ git log -n 1
commit ea774df1f1a40c0bc77dd8cbde74bfd9b8fb690f (HEAD -> main, origin/main, origin/HEAD)
Merge: d8487e2 dcd8a73
Author: Boyu Zhou <uv.boyuzhou@gmail.com>
Date: Tue Apr 23 19:20:42 2024 +0800Merge pull request #22 from yinleung/patch-1Update README.md
Step 1:依赖库安装
$ sudo apt-get install libarmadillo-dev ros_${ROS_VERSION_NAME}_nlopt libelf-dev libdw-dev
Step 2:LKH-3安装
LKH-3 是 LKH-2 的扩展,用于解决受约束的旅行商和车辆路径问题。
注:推荐LKH-3.0.6,当前最新版本LKH-3.0.9。
$ wget http://akira.ruc.dk/~keld/research/LKH-3/LKH-3.0.6.tgz
$ tar xvfz LKH-3.0.6.tgz
$ cd LKH-3.0.6
$ make
$ sudo cp LKH /usr/local/bin
Step 3:建立工程
$ mkdir -p ${YOUR_WORKSPACE_PATH}/src
$ cd ${YOUR_WORKSPACE_PATH}/src
$ git clone git@github.com:SYSU-STAR/RACER.git
注:若存在网络问题,请使用git协议clone代码。git协议始终比https稳定,但需要注意ssh key的安装问题。
Step 4:编译工程
$ cd ${YOUR_WORKSPACE_PATH}
$ catkin_make
Step 5:安装工程
略,因为暂时不涉及软件的部署应用,相关模拟命令参考:
- 运行Rviz虚拟环境
$ source devel/setup.bash && roslaunch exploration_manager rviz.launch
- 运行模拟程序
$ source devel/setup.bash && roslaunch exploration_manager swarm_exploration.launch
3. 问题汇总
3.1 组件ros-noetic-multi-map-server问题
[ 86%] Building CXX object RACER/uav_simulator/Utils/multi_map_server/CMakeFiles/multi_map_visualization.dir/src/multi_map_visualization.cc.o
/home/daniel/HKUST/RACER/src/RACER/uav_simulator/Utils/multi_map_server/src/multi_map_visualization.cc:5:10: fatal error: multi_map_server/MultiOccupancyGrid.h: No such file or directory5 | #include <multi_map_server/MultiOccupancyGrid.h>| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [RACER/uav_simulator/Utils/multi_map_server/CMakeFiles/multi_map_visualization.dir/build.make:63: RACER/uav_simulator/Utils/multi_map_server/CMakeFiles/multi_map_visualization.dir/src/multi_map_visualization.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:6342: RACER/uav_simulator/Utils/multi_map_server/CMakeFiles/multi_map_visualization.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
**解决方案:**安装组件ros-noetic-multi-map-server
$ sudo apt-get install ros-noetic-multi-map-server
3.2 swarm_exploration/plan_env - OpenCV
$ git diff swarm_exploration/plan_env/CMakeLists.txt
diff --git a/swarm_exploration/plan_env/CMakeLists.txt b/swarm_exploration/plan_env/CMakeLists.txt
index bafe24e..cf26968 100644
--- a/swarm_exploration/plan_env/CMakeLists.txt
+++ b/swarm_exploration/plan_env/CMakeLists.txt
@@ -63,10 +63,11 @@ add_library( plan_envtarget_link_libraries( plan_env${catkin_LIBRARIES}${PCL_LIBRARIES}
+ ${OpenCV_LIBS})add_executable(obj_generatorsrc/obj_generator.cpp)target_link_libraries(obj_generator
- ${catkin_LIBRARIES})
\ No newline at end of file
+ ${catkin_LIBRARIES})
3.3 uav_simulator/local_sensing - 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 bd28736..608f0fc 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, RelWithDebInfoSET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")-#set(ENABLE_CUDA true)
-set(ENABLE_CUDA false)
+set(ENABLE_CUDA true)
+#set(ENABLE_CUDA false)if(ENABLE_CUDA)find_package(CUDA REQUIRED)
@@ -17,7 +17,8 @@ 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)
3.4 第二次重复编译错误
/home/daniel/SYSU-STAR/RACER/src/RACER/swarm_exploration/utils/lkh_tsp_solver/src2/tsp_node.cpp:6:10: fatal error: lkh_tsp_solver/SolveTSP.h: No such file or directory6 | #include <lkh_tsp_solver/SolveTSP.h>| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [RACER/swarm_exploration/utils/lkh_tsp_solver/CMakeFiles/tsp_node.dir/build.make:1428: RACER/swarm_exploration/utils/lkh_tsp_solver/CMakeFiles/tsp_node.dir/src2/tsp_node.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/daniel/SYSU-STAR/RACER/src/RACER/swarm_exploration/plan_env/src/sdf_map.cpp:3:
/home/daniel/SYSU-STAR/RACER/src/RACER/swarm_exploration/plan_env/include/plan_env/multi_map_manager.h:7:10: fatal error: plan_env/ChunkStamps.h: No such file or directory7 | #include <plan_env/ChunkStamps.h>| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /home/daniel/SYSU-STAR/RACER/src/RACER/swarm_exploration/plan_env/src/multi_map_manager.cpp:2:
/home/daniel/SYSU-STAR/RACER/src/RACER/swarm_exploration/plan_env/include/plan_env/multi_map_manager.h:7:10: fatal error: plan_env/ChunkStamps.h: No such file or directory7 | #include <plan_env/ChunkStamps.h>| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [RACER/swarm_exploration/plan_env/CMakeFiles/plan_env.dir/build.make:128: RACER/swarm_exploration/plan_env/CMakeFiles/plan_env.dir/src/multi_map_manager.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/daniel/SYSU-STAR/RACER/src/RACER/swarm_exploration/utils/lkh_tsp_solver/src2/tsp_node.cpp:6:
/home/daniel/SYSU-STAR/RACER/devel/include/lkh_tsp_solver/SolveTSP.h:22:9: error: ‘SolveTSPResponse’ does not name a type; did you mean ‘SolveTSPRequest’?22 | typedef SolveTSPResponse Response;| ^~~~~~~~~~~~~~~~| SolveTSPRequest
/home/daniel/SYSU-STAR/RACER/devel/include/lkh_tsp_solver/SolveTSP.h:24:1: error: ‘Response’ does not name a type24 | Response response;| ^~~~~~~~
/home/daniel/SYSU-STAR/RACER/devel/include/lkh_tsp_solver/SolveTSP.h:27:9: error: ‘Response’ does not name a type27 | typedef Response ResponseType;| ^~~~~~~~
/home/daniel/SYSU-STAR/RACER/devel/include/lkh_tsp_solver/SolveTSP.h:93:34: error: ‘SolveTSPResponse’ is not a member of ‘lkh_tsp_solver’; did you mean ‘SolveTSPRequest’?93 | struct MD5Sum< ::lkh_tsp_solver::SolveTSPResponse>| ^~~~~~~~~~~~~~~~| SolveTSPRequest
/home/daniel/SYSU-STAR/RACER/devel/include/lkh_tsp_solver/SolveTSP.h:93:34: error: ‘SolveTSPResponse’ is not a member of ‘lkh_tsp_solver’; did you mean ‘SolveTSPRequest’?93 | struct MD5Sum< ::lkh_tsp_solver::SolveTSPResponse>| ^~~~~~~~~~~~~~~~| SolveTSPRequest
/home/daniel/SYSU-STAR/RACER/devel/include/lkh_tsp_solver/SolveTSP.h:93:50: error: template argument 1 is invalid93 | struct MD5Sum< ::lkh_tsp_solver::SolveTSPResponse>| ^
/home/daniel/SYSU-STAR/RACER/devel/include/lkh_tsp_solver/SolveTSP.h:108:36: error: ‘SolveTSPResponse’ is not a member of ‘lkh_tsp_solver’; did you mean ‘SolveTSPRequest’?108 | struct DataType< ::lkh_tsp_solver::SolveTSPResponse>| ^~~~~~~~~~~~~~~~| SolveTSPRequest
/home/daniel/SYSU-STAR/RACER/devel/include/lkh_tsp_solver/SolveTSP.h:108:36: error: ‘SolveTSPResponse’ is not a member of ‘lkh_tsp_solver’; did you mean ‘SolveTSPRequest’?108 | struct DataType< ::lkh_tsp_solver::SolveTSPResponse>| ^~~~~~~~~~~~~~~~| SolveTSPRequest
/home/daniel/SYSU-STAR/RACER/devel/include/lkh_tsp_solver/SolveTSP.h:108:52: error: template argument 1 is invalid108 | struct DataType< ::lkh_tsp_solver::SolveTSPResponse>| ^
/home/daniel/SYSU-STAR/RACER/src/RACER/swarm_exploration/utils/lkh_tsp_solver/src2/tsp_node.cpp:11:84: error: ‘lkh_tsp_solver::SolveTSP::Response’ has not been declared11 | bool tspCallback(lkh_tsp_solver::SolveTSP::Request& req, lkh_tsp_solver::SolveTSP::Response& res) {
解决方案:
- 重新编译,貌似不行,仍然出错
- 清理git代码库中出现在
swarm_exploration/utils/
下的文件后,正常编译
$ git status
On branch main
Your branch is up to date with 'origin/main'.Changes not staged for commit:(use "git add <file>..." to update what will be committed)(use "git restore <file>..." to discard changes in working directory)modified: swarm_exploration/plan_env/CMakeLists.txtmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_1.atspmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_1.parmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_1.tourmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_2.atspmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_2.parmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_2.tourmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_3.atspmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_3.parmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_3.tourmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_4.atspmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_4.parmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_4.tourmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_1.atspmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_1.parmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_1.tourmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_2.atspmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_2.parmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_2.tourmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_3.atspmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_3.parmodified: swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_3.tourmodified: uav_simulator/local_sensing/CMakeLists.txtno changes added to commit (use "git add" and/or "git commit -a")
daniel@nvidia:~/SYSU-STAR/RACER/src/RACER$ git checkout swarm_exploration/utils
Updated 21 paths from the index
daniel@nvidia:~/SYSU-STAR/RACER/src/RACER$ git status
On branch main
Your branch is up to date with 'origin/main'.Changes not staged for commit:(use "git add <file>..." to update what will be committed)(use "git restore <file>..." to discard changes in working directory)modified: swarm_exploration/plan_env/CMakeLists.txtmodified: uav_simulator/local_sensing/CMakeLists.txtno changes added to commit (use "git add" and/or "git commit -a")
4. 创建pcd环境
- 运行Rviz虚拟环境
$ cd ${YOUR_WORKSPACE_PATH}
$ source devel/setup.bash && roslaunch exploration_manager rviz.launch
- 然后运行map_generator
$ cd ${YOUR_WORKSPACE_PATH}
$ source devel/setup.bash && rosrun map_generator click_map
然后在 Rviz 中,使用 2D Nav Goal 工具(快捷键 G)来创建你的地图。两个连续点击的点形成一面墙。以下是一个示例:
- 完成后,在另一个终端运行以下节点来保存地图:
$ source devel/setup.bash && rosrun map_generator map_recorder ~/
通常,一个名为 tmp.pcd 的文件会保存在 ~/. 你可以将 ~/ 替换为任何你想要的位置。最后,你可以按照这里提到的方法使用这个文件进行探索。
5. 总结
总的来说,仍然存在一些问题,模拟器无法使用: latest code on jetson orin got stucked, any idea? #23
无法看到下面动态的模拟图像: