基于深度强化学习完成移动机器人导航

ROS Gazebo 模拟器中移动机器人导航的深度强化学习。使用TD3神经网络,机器人学习在模拟环境中导航到随机目标点,同时避开障碍物。通过激光读数检测障碍物,并在极坐标中为机器人提供目标。使用 PyTorch 在 ROS Gazebo 模拟器中接受训练。在 Ubuntu 20.04 上使用 python 3.8.10 和 pytorch 1.10 使用 ROS Noetic 进行测试。

本文使用借鉴了 Goal-Driven Autonomous Exploration Through Deep Reinforcement Learning 这篇论文

https://github.com/reiniscimurs/DRL-robot-navigation

1.前期准备

所需要的依赖:

ROS Noetic

PyTorch

https://pytorch.org/get-started/locally/

Tensorboard

https://github.com/tensorflow/tensorboard

2.下载源码

 git clone https://github.com/reiniscimurs/DRL-robot-navigation

3.编译工作空间

 cd ~/DRL-robot-navigation/catkin_ws
 catkin_make_isolated

PS:这里请注意,一般刚开始编译工作空间时,可能会出现各种各样的库缺失,具体缺失的内容可以根据实际报错信息,然后安装

sudo apt install ros-noetic-$ 你缺失的库 $                    

还有可能出现额外的问题,建议删除catkin_ws下除src的所有文件

4.打开终端并设置

 export ROS_HOSTNAME=localhost
 export ROS_MASTER_URI=http://localhost:11311
 export ROS_PORT_SIM=11311
 export GAZEBO_RESOURCE_PATH=~/DRL-robot-navigation/catkin_ws/src/multi_robot_scenario/launch
 source ~/.bashrc
 cd ~/DRL-robot-navigation/catkin_ws
 source devel_isolated/setup.bash

5.进行训练

 cd ~/DRL-robot-navigation/TD3
 python3 train_velodyne_td3.py

终止训练:

 killall -9 rosout roslaunch rosmaster gzserver nodelet robot_state_publisher gzclient python python3

6.tensorboard查看训练结果

 cd ~/DRL-robot-navigation/TD3
 tensorboard --logdir runs

PS:如果tensorboard无法显示相应的曲线,显示No dashboards are active for the current data set,建议更换浏览器,在谷歌浏览器中打开

7.完成训练,测试模型

 cd ~/DRL-robot-navigation/TD3
 python3 test_velodyne_td3.py

PS:训练呈现

  • 10
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 19
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 19
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值