ubuntu 16.04+ros kinetic + gazebo+ aws-robotics 室内环境导航仿真

简介: ubuntu 16.04+ros kinetic + gazebo+ aws-robotics 室内环境导航仿真

背景:aws-robotic ros-gazebo 仿真在ros2以及ros melodic 中的使用网上讲解较多,本文主要介绍ros kinetic +gazebo9 下turtlebot3 机器人在 aws-robomaker-small-house-world中的导航仿真。

一、 gazebo 室内环境

Project:  aws-robotics/ aws-robomaker-small-house-world git链接:https://github.com/aws-robotics/aws-robomaker-small-house-world

(1)下载源码

$ cd catkin_ws/src
$ git clone https://github.com/aws-robotics/aws-robomaker-small-house-world
$ cd ../
$ catkin_make

(2)运行

$ source develop/setup.bash
$ roslaunch aws_robomaker_small_house_world view_small_house.launch

结果如下 :

7ff6db1ddd3146c482f23f3cac6e0637.jpg

01c3867ce8c94de1904ca33063598846.jpg

该室内环境需要在gazebo9以上版本中才能正常显示,因为ros-kinetic自带的gazebo7,运行以上launch会出现黑屏,此时需要将ros中的gazebo7卸载,重装gazebo9 环境,具体如下

卸载gazebo7

$ sudo apt-get remove gazebo7 gazebo7-common gazebo7-plugin-base libgazebo7:amd64 libgazebo7-dev:amd64 ros-kinetic-gazebo-*

设置镜像和 key

$ sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
$ wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -

安装gazebo 9

$ sudo apt-get update
$ sudo apt-get install gazebo9
$ sudo apt-get install libgazebo9-dev

新终端 输入gazebo 看是否启动环境。

此类安装方法的问题是 单纯的安装 Gazebo,但没有安装 gazebo_ros_pkgs。之前 ROS-full 安装会自动安装,但是单独安装 Gazebo 还需要手动安装。

根据网上可行教程

  • gazebo_ros_pkgs 的官方仓库为 GitHub - ros-simulation/gazebo_ros_pkgs: Wrappers, tools and additional API's for using ROS with Gazebo。

    记得选择 kinetic-devel 分支。

  • 在工作空间,src 目录下克隆或者粘贴这些项目。
$ cd ~/catkin_ws/src
$ git clone https://github.com/ros-simulation/gazebo_ros_pkgs/tree/kinetic-devel
  • 之前版本的 gazebo_ros 包中都会设置环境变量 gazebo_ros,现在也需要手动设置。在 home 下 ctrl + H 显示隐藏文件,在文件末尾加入环境变量。这样,就可以在 launch 文件中用 $(find gazebo_ros)指代这个路径。同时也加入工作空间的环境变量。
$ export find gazebo_ros=/home/usrname/catkin_ws/src/gazebo_ros
$ source /home/usrname/catkin_ws/devel/setup.bash
  • 终端输入 $ gazebo 或者 $ roslaunch gazebo_ros empty_world.launch 命令打开。
  • 若出现gazebo 界面一直卡在启动中,可以尝试
  • (1)把 gazebo_model模型提前下载解压放在home 下的.gazebo/modles 中 (home xia ctrl+h 可显示隐藏文件夹)。
  • gazebo models 模型链接
  • http://pan.baidu.com/s/1pKaeg0F 密码:cmxc (来自rosclub.cn)或

osrf / gazebo_models / Downloads — Bitbucket

https://bitbucket.org/osrf/gazebo_models/downloads/

参考 教程:

  • 下载Gazebo模型_一只努力翻身的咸鱼的博客-CSDN博客_下载gazebo模型

.  下载Gazebo模型这时运行下面Gazebo命令,OK,错误没有了,但怎么是一抹黑啊!roscore & rosrun gazebo_ros gazebo首次运行Gazebo,加载模型会出现非常缓慢,原因可能是不能正确下载模型。Warning [ModelDatabase.cc:356] Getting models from[http://gazebosim.org/models/...

https://blog.csdn.net/qq_40213457/article/details/81021562

(2)若下载了模型还卡,则重启计算机试试。

接下来,我们要在这个环境里放入 turtlebot3机器人并进行导航仿真。

二、导航包

Project :aws-robotics/aws-robomaker-sample-application-navigation

git链接:https://github.com/aws-robotics/aws-robomaker-sample-application-navigation

(1)

$ git clone https://github.com/aws-robotics/aws-robomaker-sample-application-navigation

将 aws-robomaker-sample-application-navigation/下的simulation_ws文件拷贝至catkin_ws/src 下

然后 catkin_make

接着

$ source devel/setup.bash 
$ export TURTLEBOT3_MODEL=waffle_pi
$ roslaunch navigation_simulation small_house_turtlebot_navigation.launch

这一步可能会报错

Resource not found: turtlebot3_description_reduced_mesh

报这个错的源于 ros-medolic与 ros-kinetic的差异,改动如下几个地方即可:

(1) 在aws-robomaker-small-house-world/launch中新建文档 spawn_turtlebot.launch,该文档中

turtlebot3_description_reduced_mesh 已改为 turtlebot3_description

内容如下:

<launch>
  <!-- Optional environment variable, default is "waffle_pi". Note that "burger" does not have a camera -->
  <arg name="model" default="$(optenv TURTLEBOT3_MODEL waffle_pi)" doc="model type [burger, waffle, waffle_pi]"/>
  <!-- You may override arg parmaters when including this launch file -->
  <arg name="x_pos" default="0.0"/>
  <arg name="y_pos" default="0.0"/>
  <arg name="z_pos" default="0.0"/>
  <arg name="roll" default="0.0"/>
  <arg name="pitch" default="0.0"/>
  <arg name="yaw" default="0.0"/>
  <!-- Spawn the robot into Gazebo with the turtlebot description -->
  <param name="robot_description" command="$(find xacro)/xacro --inorder 
   $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />
  <node pkg="gazebo_ros" type="spawn_model" name="spawn_urdf" 
    args="-urdf -param robot_description -model turtlebot3_$(arg model)
          -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) 
          -R $(arg roll) -P $(arg pitch) -Y $(arg yaw)"/>
  <!-- 
       Publish robot and joint states. This allows rviz to display robot data, and in 
       the robot's coordinate frame. These nodes could go into the robot application 
       .launch files instead.
    -->
  <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen"/>
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
</launch>

在aws-robomaker-small-house-world/launch/small_house_turtlebot_navigation.launch文档中

将line26 的 turtlebot3_description_reduced_mesh改为 aws_robomaker_small_house_world

如下

<include file="$(find aws_robomaker_small_house_world)/launch/spawn_turtlebot.launch">

同理在

simulation_ws/src/navigation_simulation/launch下也增加spawn_turtlebot.launch 文件(同上)

small_house_turtlebot_navigation.launch中的

turtlebot3_description_reduced_mesh 改为 aws_robomaker_small_house_world,

line 44 至line 49如下

改动前:

<!-- Spawn the robot into Gazebo with the turtlebot description -->
  <include file="$(find turtlebot3_description_reduced_mesh)/launch/spawn_turtlebot.launch">
    <arg name="x_pos" default="$(arg x_pos)"/>
    <arg name="y_pos" default="$(arg y_pos)"/>
    <arg name="yaw" default="$(arg yaw)"/>
  </include>

改动后:

<!-- Spawn the robot into Gazebo with the turtlebot description -->
  <include file="$(find aws_robomaker_small_house_world)/launch/spawn_turtlebot.launch">
    <arg name="x_pos" default="$(arg x_pos)"/>
    <arg name="y_pos" default="$(arg y_pos)"/>
    <arg name="yaw" default="$(arg yaw)"/>
  </include>

若需要看gazebo效果以及机器人动态路线导航则

$ roslaunch navigation_simulation small_house_turtlebot_navigation.launch
 follow_route:=false dynamic_route:=true gui:=true

运行rviz 或者rqt-image-view $ rviz 或 $ rosrun rqt_image_view rqt_image_view ,选择/camera/rgb/image_raw   topic

效果如下

cb271b0446b1491bb34e8db7f223dc0f.png

6b22c5150ad045c2b12df904a549518a.png

 若要在其他环境( aws-robomaker-bookstore-world )中仿真则,其中bookstore_world 参考project: small_house_world.

roslaunch navigation_simulation bookstore_turtlebot_navigation.launch
 follow_route:=false dynamic_route:=true gui:=true
相关实践学习
Docker镜像管理快速入门
本教程将介绍如何使用Docker构建镜像,并通过阿里云镜像服务分发到ECS服务器,运行该镜像。
阿里云资源编排ROS使用教程
资源编排(Resource Orchestration)是一种简单易用的云计算资源管理和自动化运维服务。用户通过模板描述多个云计算资源的依赖关系、配置等,并自动完成所有资源的创建和配置,以达到自动化部署、运维等目的。编排模板同时也是一种标准化的资源和应用交付方式,并且可以随时编辑修改,使基础设施即代码(Infrastructure as Code)成为可能。 产品详情:https://www.aliyun.com/product/ros/
目录
相关文章
|
19天前
|
Ubuntu
【报错】解决Ubuntu环境下VsCode无法输入中文
【报错】解决Ubuntu环境下VsCode无法输入中文
|
19天前
|
Kubernetes Ubuntu Shell
wsl Ubuntu环境 创建 k8s集群
wsl Ubuntu环境 创建 k8s集群
|
19天前
|
IDE Ubuntu Java
百度搜索:蓝易云【Ubuntu快速搭建单步调试openjdk环境】
现在,你已经成功在Ubuntu上搭建了OpenJDK的单步调试环境,可以使用Eclipse IDE方便地进行Java程序的调试。请注意,Eclipse IDE提供了丰富的调试功能,使得调试过程更加高效和准确。
30 0
|
19天前
|
Ubuntu 网络协议 Linux
如何在无公网IP环境使用Windows远程桌面Ubuntu
如何在无公网IP环境使用Windows远程桌面Ubuntu
78 0
|
19天前
|
Ubuntu 测试技术 Linux
dpdk测试环境搭建(vmware下ubuntu环境参考上文汇总流程)
dpdk测试环境搭建(vmware下ubuntu环境参考上文汇总流程)
145 0
|
19天前
|
并行计算 Ubuntu Docker
Docker环境Ubuntu20.04安装Python3.10版本
Docker环境Ubuntu20.04安装Python3.10版本
95 0
|
19天前
|
NoSQL Ubuntu 开发工具
【gdb调试】在ubuntu环境使用gdb调试一棵四层二叉树的数据结构详解
【gdb调试】在ubuntu环境使用gdb调试一棵四层二叉树的数据结构详解
12 1
|
19天前
|
Ubuntu 开发工具 git
ubuntu18.04下配置muduoC++11环境
以上步骤将在Ubuntu 18.04下配置C++11环境,并编译安装muduo库。请根据实际情况对配置步骤进行调整。 买CN2云服务器,免备案服务器,高防服务器,就选蓝易云。百度搜索:蓝易云
41 0
|
19天前
|
Ubuntu 关系型数据库 MySQL
ubuntu部署python环境,vscode编辑wsl项目遇到的问题汇总
ubuntu部署python环境,vscode编辑wsl项目遇到的问题汇总
|
19天前
|
Ubuntu
【ubuntu】ubuntu20.04安装ros noetic(亲测有效,附操作步骤)
【ubuntu】ubuntu20.04安装ros noetic(亲测有效,附操作步骤)