ROS的安装与卸载
本文最后更新于 2024年3月7日 晚上
本文主要分享了在Linux下ROS的安装与版本管理。
安装
不同的ubuntu版本对应不同版本的ros,具体可查询ros官网
http://wiki.ros.org/ROS/Installation
ubuntu16.04以及更老的版本对应ROS Kinetic Kame
ubuntu18.04对应ROS Melodic Morenia
ubuntu20.04对应ROS Noetic Ninjemys
下面开始安装ROS Melodic,详细安装教程可以参考下面的官网连接:
http://wiki.ros.org/melodic/Installation/Ubuntu
1. 安装
1 |
|
2. 环境设置
1 |
|
3. 安装依赖项
1 |
|
rosdep update
报错:The read operation timed out'
原因:网站被墙
解决方法:
https://blog.csdn.net/weixin_44028876/article/details/120201324
-
打开终端执行:
1
sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list
-
替换
20-default.list
文件内容如下:1
2
3
4
5
6
7
8
9
10# os-specific listings first
yaml https://mirror.ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
# generic
yaml https://mirror.ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://mirror.ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://mirror.ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://mirror.ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead -
终端重新执行:
1
rosdep update
-
成功运行的输出结果为:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://mirror.ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://mirror.ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://mirror.ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://mirror.ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://mirror.ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Skip end-of-life distro "dashing"
Skip end-of-life distro "eloquent"
Skip end-of-life distro "foxy"
Skip end-of-life distro "galactic"
Skip end-of-life distro "groovy"
Add distro "humble"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Add distro "iron"
Skip end-of-life distro "jade"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Skip end-of-life distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/lll25655/.ros/rosdep/sources.cache
4. 安装ros与opencv的桥接工具包
1 |
|
5. 其他
1 |
|
6. 验证ros是否安装成功
1 |
|
使用
卸载
1 |
|
提示
如果你的主要工作是在ROS上进行的,那么ROS有自带的库就使用ROS自带的库,尽量减少自己另外装库,增加兼容性,减少报错。
比如,自己源码安装的PCL最好不要安装到系统根目录下,也就是默认的/usr/local/
下。因为如果安装到了/usr/local/
下,最后链接PCL的库的时候会默认链接到这个路径下的库。但是绝大部分搭建在ROS平台的工程都是使用ROS自带的pcl-1.8的,这个时候虽然编译可以通过,但是运行的时候会出错。血泪教训。