本文主要介绍ROS的安装过程,总结安装过程中的问题点。
Software & Update
restricted
,universe
和 multiverse
.打开terminal终端,输入下方代码
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
如果使用代理服务器,可以使用curl
替代apt-key
命令,具体内容如下:
curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | sudo apt-key add -
成功后返回
gpg: key F42ED6FBABXXXXXX: public key "Open Robotics " imported
gpg: Total number processed: 1
gpg: imported: 1
安装前,确保Debian包索引到最新
sudo apt-get update
下面就是选择安装多大的ROS包
sudo apt install ros-noetic-desktop-full
sudo apt install ros-noetic-desktop
sudo apt install ros-noetic-ros-base
如果需要安装其他包文件,可以选择相应的包直接安装
sudo apt install ros-noetic-PACKAGE
其中,PACKAGE
对应你所要安装的包,详细可参考安装包列表。
如果需要使用ROS,在每个bash终端中需更新ros的配置脚本,具体命令如下:
source /opt/ros/noetic/setup.bash
也可以设置每次打开终端时,自动更新ROS的配置脚本
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
如果未安装rosdep工具,输入下述命令:
$ sudo apt install python-rosdep
如果系统(ubuntu2020)默认只包含python3
,相应命令修改如下:
$ sudo apt install python3-rosdep
$ sudo rosdep init
返回下述结果说明初始化成功
Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run
rosdep update
$ rosdep update
返回下述结果说明更新成功
eading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit 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"
Add distro "dashing"
Add distro "eloquent"
Add distro "foxy"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Add distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/zgh/.ros/rosdep/sources.cache
输入下述命令,验证ROS是否安装成功。
roscore
命令行返回如下结果,就表明ROS已安装成功。
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://zgh-VirtualBox:36577/
ros_comm version 1.15.7
SUMMARY
========
PARAMETERS
* /rosdistro: noetic
* /rosversion: 1.15.7
NODES
auto-starting new master
process[master]: started with pid [29713]
ROS_MASTER_URI=http://zgh-VirtualBox:11311/
setting /run_id to 70500dfa-cbc5-11ea-8c25-9b0cacf5f716
process[rosout-1]: started with pid [29723]
started core service [/rosout]
^C[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
ROS官网教程