欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 美食 > 从零开始基于Ubuntu18搭建Gazebo地图仿真环境

从零开始基于Ubuntu18搭建Gazebo地图仿真环境

2025/6/8 23:35:43 来源:https://blog.csdn.net/suoxd123/article/details/148474113  浏览:    关键词:从零开始基于Ubuntu18搭建Gazebo地图仿真环境

1. 配置ROS环境

1.1 创建虚拟环境

# 创建虚拟环境
conda create -y -n autoNav
# 激活虚拟环境
conda activate autoNav

在这里插入图片描述

1.2 安装ROS环境

# 查看系统版本
lsb_release -a
# 安装基础库
sudo apt update && sudo apt upgrade -y
sudo apt install curl gnupg2 -y# 安装ROS Melodic(https://wiki.ros.org/cn/melodic/Installation/Ubuntu)
# 设置软件源地址
sudo nano /etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main universe restricted multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main universe restricted multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main universe restricted multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main universe restricted multiverse
#设置sources.list
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
# 设置密钥
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# 更新 Debian 包索引
sudo apt update & sudo apt upgrade -y
# 桌面完整版 : 包含 ROS、rqt、rviz、机器人通用库、2D/3D 模拟器、导航以及 2D/3D 感知包
sudo apt install ros-melodic-desktop-fullls /etc/apt/sources.list.d/ -l
总用量 0
(autoNav) abner@Abner:~$ sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
(autoNav) abner@Abner:~$ sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
Executing: /tmp/apt-key-gpghome.AZBojWhEr4/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
gpg: 密钥 F42ED6FBAB17C654:“Open Robotics <info@osrfoundation.org>”2 个签名被清除
gpg: 合计被处理的数量:1
gpg:     清除的签名:2
(autoNav) abner@Abner:~$ sudo apt update & sudo apt upgrade -y
[1] 19914
命中:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic InRelease
命中:2 http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu bionic InRelease                              
命中:3 http://security.ubuntu.com/ubuntu xenial-security InRelease                                  
正在读取软件包列表... 完成  
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
正在计算更新... 完成. 40%Enable UA Infra: ESM to receive additional future security updates.
See https://ubuntu.com/18-04 or run: sudo ua statusUbuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
所有软件包均为最新。[1]+  已完成               sudo apt update
(autoNav) abner@Abner:~$ sudo apt install ros-melodic-desktop-full
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
有一些软件包无法被安装。如果您用的是 unstable 发行版,这也许是
因为系统无法达到您要求的状态造成的。该版本中可能会有一些您需要的软件
包尚未被创建或是它们已被从新到(Incoming)目录移出。
下列信息可能会对解决问题有所帮助:下列软件包有未满足的依赖关系:ros-melodic-desktop-full : 依赖: ros-melodic-perception 但是它将不会被安装依赖: ros-melodic-simulators 但是它将不会被安装依赖: ros-melodic-urdf-sim-tutorial 但是它将不会被安装
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。# 初始化 rosdep
sudo rosdep init
rosdep update
# 设置环境
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

2. 配置Gazebo环境

3. 创建自定义地图

4. 默认启动仿真环境

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词