前进之路 发表于 2024-6-14 21:33:37

Linux 35.5 + JetPack v5.1.3@RACER编译安装

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 +0800

    Merge pull request #22 from yinleung/patch-1

    Update 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 directory
    5 | #include <multi_map_server/MultiOccupancyGrid.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** Error 1
make: *** Error 2
make: *** 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_env
target_link_libraries( plan_env
   ${catkin_LIBRARIES}
   ${PCL_LIBRARIES}
+    ${OpenCV_LIBS}
   )

add_executable(obj_generator
   src/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, RelWithDebInfo
SET(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 directory
    6 | #include <lkh_tsp_solver/SolveTSP.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** Error 1
make: *** 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 directory
    7 | #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 directory
    7 | #include <plan_env/ChunkStamps.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** Error 1
make: *** 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 type
   24 | Response response;
      | ^~~~~~~~
/home/daniel/SYSU-STAR/RACER/devel/include/lkh_tsp_solver/SolveTSP.h:27:9: error: ‘Response’ does not name a type
   27 | 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 invalid
   93 | 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 invalid
108 | 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 declared
   11 | 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.txt
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_1.atsp
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_1.par
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_1.tour
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_2.atsp
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_2.par
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_2.tour
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_3.atsp
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_3.par
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_3.tour
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_4.atsp
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_4.par
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp2_4.tour
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_1.atsp
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_1.par
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_1.tour
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_2.atsp
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_2.par
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_2.tour
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_3.atsp
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_3.par
      modified:   swarm_exploration/utils/lkh_mtsp_solver/resource/amtsp3_3.tour
      modified:   uav_simulator/local_sensing/CMakeLists.txt

no 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.txt
      modified:   uav_simulator/local_sensing/CMakeLists.txt

no 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)来创建你的地图。两个一连点击的点形成一面墙。以下是一个示例:
https://img-blog.csdnimg.cn/img_convert/cde5854fe107bbf6d3b5e2e46117d6b0.gif#pic_center


[*]完成后,在另一个终端运行以下节点来保存地图:
$ source devel/setup.bash && rosrun map_generator map_recorder ~/
通常,一个名为 tmp.pcd 的文件会保存在 ~/. 你可以将 ~/ 替换为任何你想要的位置。最后,你可以按照这里提到的方法使用这个文件举行探索。
5. 总结

总的来说,仍然存在一些问题,模拟器无法使用: latest code on jetson orin got stucked, any idea? #23
无法看到下面动态的模拟图像:
https://img-blog.csdnimg.cn/img_convert/6b9a679493b2b9201f0bf0993affdbc3.gif#pic_center

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: Linux 35.5 + JetPack v5.1.3@RACER编译安装