代码github网址:https://github.com/TempleRAIL/drl_vo_nav?tab=readme-ov-file

论文网址:https://doi.org/10.1109/TRO.2023.3257549(Arxiv可以免费下载)

一、Requirements

ubuntu版本:20.04

1、小鱼安装ros

wget http://fishros.com/install -O fishros && bash fishros

选择1安装ros,不换源,ros1-noetic,安装完成

2、Python 3.8.5

使用conda环境发生了QT5库与系统库冲突,所以使用了系统环境(容易污染环境,慎重!!,我的是专门做的双系统)

3、Pytorch 1.7.1

(1)需要cuda版本为11.0,参考另一篇博客:

ubuntu配置深度学习环境Anaconda+cuda+cudnn+torch+tensorflow_ubuntu配置conda环境,torch1.12 numpy cuda-CSDN博客

cuda官网:

https://developer.nvidia.com/cuda-11-0-1-download-archive

(2)配置cudnn

(3)安装torch

pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html

4、Tensorboard 2.4.1

pip install tensorboard==2.4.1
pip install tensorboard psutil cloudpickle

5、Gym 0.18.0

pip install gym==0.18.0 pandas==1.2.1

gym安装可能会出现和其他库版本冲突,报错,我是根据chatgpt给的方案解决的。过程比较乱,就不放在这里了。

6、Stable-baseline3 1.1.0(一定是这个版本,别的版本会自动安装适应版本的torch,更改环境)

pip install stable-baselines3==1.1.0

检查安装版本

conda list

二、Installation

1、创建工作空间,并编译必要包(报错看后面的报错解决部分)

(1)robot_gazebo:用于 Turtlebot2 导航的自定义配置文件和地图

mkdir DRLVO_ws/src
cd DRLVO/src
git clone https://github.com/TempleRAIL/robot_gazebo.git
cd ..
pip install empy
pip install catkin_pkg
catkin_make

(2)Pedsim_ros_with_gazebo:基于 pedsim_ros 定制的 3D 人机交互凉亭模拟器

cd src
git clone https://github.com/TempleRAIL/pedsim_ros_with_gazebo.git
cd ..
catkin_make

(3)turtlebot2库原安装方法为

wget https://raw.githubusercontent.com/zzuxzt/turtlebot2_noetic_packages/master/turtlebot2_noetic_install.sh 
sudo sh turtlebot2_noetic_install.sh 

但是会一直卡在sh界面,所以我按照sh文件中的指令单独运行了

mkdir turtlebot2_noetic_packages
cd turtlebot2_noetic_packages
sudo apt-get install ros-noetic-kobuki*
sudo apt-get install ros-noetic-joy ros-noetic-joystick-drivers
sudo git clone --branch noetic https://github.com/yujinrobot/kobuki.git
sudo git clone --single-branch --branch noetic https://github.com/yujinrobot/kobuki_desktop.git
mv kobuki_desktop/kobuki_gazebo_plugins ./
rm -rf kobuki_desktop
git clone https://github.com/yujinrobot/yujin_ocs.git
mv yujin_ocs/yocs_cmd_vel_mux yujin_ocs/yocs_controllers yujin_ocs/yocs_velocity_smoother/ ./
rm -rf yujin_ocs/
git clone --branch release/0.61-noetic https://github.com/stonier/ecl_tools.git
git clone --branch release/0.61-noetic https://github.com/stonier/ecl_lite.git
git clone --branch release/0.62-noetic https://github.com/stonier/ecl_core.git
git clone --branch release/0.60-melodic https://github.com/stonier/ecl_navigation.git
git clone https://github.com/turtlebot/turtlebot_simulator.git
git clone https://github.com/turtlebot/turtlebot.git
git clone https://github.com/turtlebot/turtlebot_apps.git
git clone https://github.com/turtlebot/turtlebot_msgs.git
git clone https://github.com/turtlebot/turtlebot_interactions.git
git clone https://github.com/ros-perception/depthimage_to_laserscan.git

编译(报错find_package(catkin) failed看报错4)

cd ~/DRLVO_ws
catkin_make -j1

问题报错:

1、(没有解决,后面出问题再说,少了两个包)

下列软件包有未满足的依赖关系:
 ros-noetic-joystick-drivers : 依赖: ros-noetic-ps3joy 但无法安装它
                               依赖: ros-noetic-wiimote 但无法安装它
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。

2、AttributeError: module 'em' has no attribute 'RAW_OPT'

pip uninstall empy
pip install empy==3.3.4

3、

/usr/bin/ld: /home/tianhr/anaconda3/lib/libQt5Core.so.5.15.2: undefined reference to std::__exception_ptr::exception_ptr::_M_release()@CXXABI_1.3.13'
/usr/bin/ld: /lib/x86_64-linux-gnu/libapr-1.so.0: undefined reference to uuid_generate@UUID_1.0'
/usr/bin/ld: /home/tianhr/anaconda3/lib/libQt5Widgets.so.5.15.2: undefined reference to std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
/usr/bin/ld: /home/tianhr/anaconda3/lib/libQt5Core.so.5.15.2: undefined reference to std::__exception_ptr::exception_ptr::_M_addref()@CXXABI_1.3.13'
collect2: error: ld returned 1 exit status
make[2]: *** [pedsim_ros_with_gazebo/pedsim_simulator/CMakeFiles/pedsim_simulator.dir/build.make:988:/home/tianhr/DRLVO_ws/devel/lib/pedsim_simulator/pedsim_simulator] 错误 1
make[1]: *** [CMakeFiles/Makefile2:22746:pedsim_ros_with_gazebo/pedsim_simulator/CMakeFiles/pedsim_simulator.dir/all] 错误 2
make[1]: *** 正在等待未完成的任务....
[100%] Built target spencer_tracking_rviz_plugin
[100%] Linking CXX executable /home/tianhr/DRLVO_ws/devel/lib/ecl_core_apps/bench_eigen3_transforms
[100%] Built target bench_eigen3_transforms
[100%] Linking CXX executable /home/tianhr/DRLVO_ws/devel/lib/ecl_core_apps/bench_eigen3_decompositions
[100%] Built target bench_eigen3_decompositions
make: *** [Makefile:141:all] 错误 2
Invoking "make -j20 -l20" failed

conda和系统库冲突,决定卸掉conda

4、

CMake Error at CMakeLists.txt:75 (message):
  find_package(catkin) failed.  catkin was neither found in the workspace nor
  in the CMAKE_PREFIX_PATH.  One reason may be that no ROS setup.sh was
  sourced before.


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

解决办法:打开qt-ros项目时报错:find_package(catkin) failed. catkin was neither found in the workspace···_ros2 colcon build 出错 find——package(catkin)failed-CSDN博客

5、EigenSophus 库不兼容

sudo apt-get install --reinstall libeigen3-dev

6、cpp版本不对,std::get函数期望的模板参数类型与传入的类型不匹配。特别是,std::chrono::duration类型的参数与std::get模板推导的类型不兼容。

/usr/include/c++/9/tuple:1332:5: note:   template argument deduction/substitution failed:
/usr/include/c++/9/tuple:1341:5: note: candidate: ‘template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(const std::tuple<_Elements ...>&&)’
 1341 |     get(const tuple<_Elements...>&& __t) noexcept
      |     ^~~
/usr/include/c++/9/tuple:1341:5: note:   template argument deduction/substitution failed:
make[2]: *** [pedsim_ros_with_gazebo/pedsim_gazebo_plugin/CMakeFiles/ActorPosesPlugin.dir/build.make:76:pedsim_ros_with_gazebo/pedsim_gazebo_plugin/CMakeFiles/ActorPosesPlugin.dir/src/actor_poses_plugin.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:6822:pedsim_ros_with_gazebo/pedsim_gazebo_plugin/CMakeFiles/ActorPosesPlugin.dir/all] 错误 2
make: *** [Makefile:146:all] 错误 2
Invoking "make -j1" failed

更改:/home/tianhr/DRLVO_ws/src/pedsim_ros_with_gazebo/pedsim_gazebo_plugin/CMakefiles.txt

第五行add_compile_options(-std=c++17)

11改为17

7、报错QT版本不对,语法出错

更改:/home/tianhr/DRLVO_ws/src/pedsim_ros_with_gazebo/2ndparty/spencer_tracking_rviz_plugin/src

在 additional_topic_subscriber.h 的第 63 行中,
将类 _AdditionalTopicSubscriber: QObject
更改为

类 _AdditionalTopicSubscriber: public QObject

三、训练和测试

1、在桌面上训练(使用 GUI):训练后的模型和日志文件将存储在 “~/drl_vo_runs” 中

roscd drl_vo_nav
cd ..
sh run_drl_vo_policy_training_desktop.sh ~/drl_vo_runs

2、在服务器上训练(没有 GUI):训练后的模型和日志文件将存储在 “~/drl_vo_runs”

roscd drl_vo_nav
cd ..
sh run_drl_vo_policy_training_server.sh ~/drl_vo_runs

3、桌面推理 (导航)

roscd drl_vo_nav
cd ..
sh run_drl_vo_navigation_demo.sh
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐