基于KCL的无人车任务规划
参考教程:
https://www.ncnynl.com/archives/201910/3387.html
1. 查看系统环境
要运行本仿真程序,需要保证当前环境为ubuntu18.04
,并安装好terminal
终端程序以及vscode
编程程序
查看ubuntu
版本
rosnoetic@rosnoetic-VirtualBox:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
可知,当前ubuntu
版本满足18.04
2. 部署任务规划环境
安装依赖
rosnoetic@rosnoetic-VirtualBox:~$ sudo apt install flex bison freeglut3-dev libbdd-dev python-catkin-tools ros-$ROS_DISTRO-tf2-bullet ros-melodic-dwa-local-planner
安装rosplan
功能包
rosnoetic@rosnoetic-VirtualBox:~$ mkdir -p car_rosplan/src
rosnoetic@rosnoetic-VirtualBox:~$ cd car_rosplan/src/
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan/src$ git clone https://github.com/KCL-Planning/rosplan
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan/src$ git clone https://github.com/clearpathrobotics/occupancy_grid_utils
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan/src$ git clone https://github.com/KCL-Planning/rosplan_demos.git
编译
rosnoetic@rosnoetic-VirtualBox:~$ cd car_rosplan/
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan$ catkin_make
安装turtlebot3 gazebo simulator
仿真
rosnoetic@rosnoetic-VirtualBox:~$ sudo apt install ros-${ROS_DISTRO}-turtlebot3-gazebo ros-${ROS_DISTRO}-turtlebot3-navigation ros-${ROS_DISTRO}-move-base-msgs
在环境变量中写入小车模型,ctrl+alt+T
打开终端,执行如下指令进入.bashrc
文件中修改
rosnoetic@rosnoetic-VirtualBox:~$ sudo gedit ~/.bashrc
在bashrc
文件夹末尾添加如下代码:
export TURTLEBOT3_MODEL=burger
3. 启动任务规划
3.1 执行任务规划
ctrl+alt+T
打开新的终端,启动roscore
rosnoetic@rosnoetic-VirtualBox:~$ roscore
ctrl+alt+T
打开新的终端,启动仿真环境
rosnoetic@rosnoetic-VirtualBox:~$ cd car_rosplan/
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan$ source ./devel/setup.bash
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan$ roslaunch rosplan_turtlebot3_demo turtlebot.launch
需要等待较长的时间才能完成gazebo
的启动,启动后如下图所示:
调用生成的任务规划进行探索:
rosnoetic@rosnoetic-VirtualBox:~$ cd car_rosplan/
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan$ source ./devel/setup.bash
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan$ rosrun rosplan_turtlebot3_demo turtlebot_explore.bash
有些时候会出现如下的错误,暂时还没有解决办法,或许是DWA
算法的参数设置问题,如果出现了该问题,可以再重新执行
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan$ rosrun rosplan_turtlebot3_demo turtlebot_explore.bash
生成新的任务分配,可能会出现一次成功的任务分配过程,具体内容需要后续进一步研究。
3.2 测试自定义的导航点
ctrl+alt+T
打开新的终端,启动roscore
rosnoetic@rosnoetic-VirtualBox:~$ roscore
ctrl+alt+T
打开新的终端,启动仿真环境
rosnoetic@rosnoetic-VirtualBox:~$ cd car_rosplan/
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan$ source ./devel/setup.bash
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan$ roslaunch rosplan_turtlebot3_demo turtlebot.launch
需要等待较长的时间才能完成gazebo
的启动,启动后如下图所示:
调用自定义的任务规划进行探索:
下载vim编辑包
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan$ sudo apt install vim
执行如下指令可以编辑路径点配置文件
rosnoetic@rosnoetic-VirtualBox:~$ cd car_rosplan/
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan$ source ./devel/setup.bash
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan$ rosed rosplan_turtlebot3_demo waypoints.yaml
执行如下指令测试自定义导航点
rosnoetic@rosnoetic-VirtualBox:~$ cd car_rosplan/
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan$ source ./devel/setup.bash
rosnoetic@rosnoetic-VirtualBox:~/car_rosplan$ rosrun rosplan_turtlebot3_demo turtlebot_explore_wp_from_file.bash
标签:基于,rosnoetic,KCL,turtlebot3,rosplan,bash,car,无人,VirtualBox
From: https://www.cnblogs.com/windandchimes/p/18344930