ROS-Ubuntu20.04环境安装

1.系统和ROS版本

操作系统:Ubuntu20.04

ROS版本:ROS noetic

2.安装步骤

1.配置ROS软件源

python 复制代码
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

2.配置密钥

python 复制代码
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

3.更新系统软件源

python 复制代码
sudo apt update

4.安装ROS

python 复制代码
sudo apt install ros-noetic-desktop-full

5.初始化rosdep

先执行以下命令,不然初始化会报错:

python 复制代码
sudo apt install python3-rosdep

初始化:

python 复制代码
sudo rosdep init

6.rosdep更新

python 复制代码
rosdep update

出现以下报错:

python 复制代码
ERROR:error loading sources list:
	('The read operation timed out',)

尝试解决(没有成功):

访问网址不通造成的,添加https://ghproxy.com/资源代理网站加速rosdep对github raw的访问。但是出现以下报错:

python 复制代码
ERROR:unable to process source[https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml]

查找原因后,发现https://ghproxy.com/已经不管用

最终解决:

python 复制代码
sudo pip install rosdepc
sudo rosdepc init
rosdepc update

7.设置环境变量

python 复制代码
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

8.安装依赖包

python 复制代码
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential

出现以下报错:

python 复制代码
E:Package 'python-rosinstall' has no installation candidate
E:Package 'python-rosinstall-generator' has no installation candidate
E:Package 'python-wstool' has no installation candidate

**解决:**现在支持的是python3版本,所以把每个python改为python3

python 复制代码
sudo apt install python3-rosinstall python3-rosinstall-generator python3-wstool build-essential

3.检验安装

1.查看安装版本

python 复制代码
$ rosversion -d
noetic		//输出ROS的版本

2.运行demo

python 复制代码
$ roscore 	//启动ROS MASTER
$ rosrun turtlesim turtlesim_node 	//启动小海龟仿真器
$ rosrun turtlesim turtle_teleop_key	//启动小海龟控制节点

4.其他

修改文件权限:

python 复制代码
sudo chmod 777 xxx		//777:每个人可读可写可执行,xxx:需要修改权限的文件名
相关推荐
冬奇Lab26 分钟前
每日一个开源项目(第160篇):Destructive Command Guard - 在 AI Agent 运行 rm -rf 之前拦截它
人工智能·安全·开源
IvorySQL31 分钟前
PG 日报|SQL/PGQ 图查询基于联接重写机制实现
数据库·人工智能·sql·postgresql·区块链·ivorysql
博图光电40 分钟前
博图汽车零配件视觉检测与测量解决方案
人工智能·汽车·视觉检测
仿生狮子1 小时前
别再说“全栈”了,AI 时代团队只认这 5 种人
前端·人工智能·后端
乒乓狂魔2 小时前
SkyWalking 也能 AI 智能化了
人工智能·skywalking
满怀冰雪2 小时前
03-第一个 Paddle 程序:Tensor 创建、计算与设备管理
人工智能·python·paddle
Maynor9962 小时前
AI Coding 零基础实战教程|第七部分:Codex Desktop 安装和使用教程
人工智能·ai编程·codex·claude code·ai coding
CClaris2 小时前
大模型量化从0到1(九):用 llama.cpp 把模型转成 GGUF 并跑本地推理
人工智能·pytorch·python·深度学习·llama
学编程的小虎2 小时前
SenseVoice微调
人工智能·python·自然语言处理