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
相关实践学习
使用ROS创建VPC和VSwitch
本场景主要介绍如何利用阿里云资源编排服务,定义资源编排模板,实现自动化创建阿里云专有网络和交换机。
ROS入门实践
本课程将基于基础设施即代码 IaC 的理念,介绍阿里云自动化编排服务ROS的概念、功能和使用方式,并通过实际应用场景介绍如何借助ROS实现云资源的自动化部署,使得云上资源部署和运维工作更为高效。
目录
相关文章
|
4月前
|
Ubuntu 编译器 开发工具
在Ubuntu系统上搭建RISC-V交叉编译环境
以上步骤涵盖了在Ubuntu系统上搭建RISC-V交叉编译环境的主要过程。这一过程涉及了安装依赖、克隆源码、编译安装工具链以及设置环境变量等关键步骤。遵循这些步骤,可以在Ubuntu系统上搭建一个用于RISC-V开发的强大工具集。
502 22
|
4月前
|
Ubuntu 编译器 计算机视觉
Ubuntu 20.04环境下无法找到#include<opencv/cv.h>文件 - 解决方案。
希望这些信息能帮助你解决遇到的问题。
309 10
|
5月前
|
存储 Ubuntu 自动驾驶
运行Udacity的MPC控制项目指南(project_10)在Ubuntu 18.04环境下
以上步骤应该能够帮助您成功设置并运行Udacity MPC控制项目,在此过程中您将学习如何应用模型预测控制理论去指导车辆沿着轨迹自主驾驶,在模拟环境下测试其效果。这个过程不但涵盖了理论知识也有实践操作,对于学习自动驾驶车辆控制系统非常有帮助。
199 15
|
6月前
|
缓存 Ubuntu Docker
Ubuntu环境下删除Docker镜像与容器、配置静态IP地址教程。
如果遇见问题或者想回滚改动, 可以重启系统.
450 16
|
5月前
|
消息中间件 人工智能 运维
Ubuntu环境下的 RabbitMQ 安装与配置详细教程
本文聚焦在Ubuntu下RabbitMQ安装与配置教程,旨在帮助读者快速构建稳定可用的消息队列服务。
1104 6
|
7月前
|
Ubuntu 关系型数据库 MySQL
在Ubuntu上配置phpMyAdmin和WordPress环境的步骤
执行以上步骤后,你将成功配置Ubuntu系统上的phpMyAdmin和WordPress环境。需要注意的是,应该根据自己实际的环境如具体的Ubuntu版本、WordPress版本和个人的安全需求做适当调整。此配置指南假定你拥有一个干净的Ubuntu服务器环境,某些步骤比如MySQL的root密码已经设置好了。
221 14
|
6月前
|
Ubuntu 安全 Linux
Ubuntu 24.10 发行版登场:Linux 6.11 内核、GNOME 47 桌面环境
Ubuntu 24.10 还带来了 GNOME 47,增强了性能和稳定性,并引入了新功能。此版本的 Ubuntu 还默认在采用 Nvidia 显卡的硬件上切换到 Wayland,并在支持的硬件上默认使用开源的 Nvidia 560 内核模块。 另外需要注意的是,Ubuntu 24.10 是稳定版本,但作为非 LTS 版本,仅支持 9 个月。
|
9月前
|
监控 Ubuntu Linux
在Ubuntu环境中制定脚本开机自动启动设置
以上就是在Ubuntu环境下制定脚本开机自动启动的设置方法。通过Systemd服务,你可以按需要轻松管理脚本的自动执行。全新的一天开始时,脚本已静静地运行,无需额外手动启动,机器恰如一位忠诚的仲夏夜的梦想者,在黎明的许诺中尽职尽责。于是心满意足地看着,任由它在自己选择的轨道上静静地飞翔。
1089 26
|
7月前
|
Ubuntu 编译器
在Ubuntu中设置QT Creator的交叉编译环境。
在进行交叉编译设置时,请确保遵循你的目标硬件平台和软件的具体指南。以上步骤给出的是一个概括的指南,具体步骤可能因你的特定需求而有所不同。务必参照相关硬件和软件的官方文档进行操作,以获得具体的、针对性的指导。
608 0
|
9月前
|
Ubuntu 开发工具
Ubuntu环境下以源码编译方式安装Vim的步骤介绍
以上就是在Ubuntu环境下以源码编译方式安装Vim的全部步骤。就像煮一杯咖啡,虽然过程中需要耐心和一些技巧,但等到你熟悉之后,你会发现,不仅可以定制自己喜欢的口味,过程中的乐趣也是不能忽视的。希望你在编译安装Vim的过程中,能体验到这份乐趣。
446 21