题外话:对ROS操作系统正式支持的只有ubuntu,所以在安装ROS之前,你先得把ubuntu系统给装好。
所以在在开始进行正式的安装之前我们先来进行如下的准备工作:
1)ubuntu的安装
详细的安装教程:https://blog.csdn.net/DeepWolf/article/details/84261736
2)设置软件源为国内的镜像
(1)先将系统默认的软件源给备份好
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
(2)打开清华开源软件源镜像网站,选择适合你的ubuntu,这里我们选择16.04
清华大学开源软件镜像站地址:https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/
(3)打开sources
.list(软件源文件)
sudo gedit /etc/apt/sources.list
(4) 将(3)打开的软件源内容替换为(2)里面的内容
(5)更新软件源
sudo apt-get update
(6)更新系统所有软件
sudo apt-get dist-upgrade
1)前期工作准备好以后接下来我们就开始进行ROS的正式安装
(1)在ros-latest.list添加ROS版本库
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
(2) 设置key,便于从ROS存储库下载功能包
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
(3) 将软件包列表索引进行更新并升级安装的软件包
sudo apt-get update && sudo apt-get upgrade -y
(4)安装完整的包
sudo apt-get install ros-kinetic-desktop-full
(5)初始化 rosdep
sudo rosdep init
rosdep update
附加:如果初始化错误,请参考博客:https://blog.csdn.net/gddxz_zhouhao/article/details/72861266
(6)安装rosinstall,用于安装ROS各种功能包
sudo apt-get install python-rosinstall
2)以上安装完成后我们开始进行环境的搭建
(1)加载环境文件设置
source /opt/ros/kinetic/setup.bash
(2)创建并初始化工作目录
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
cd ~/catkin_ws/
catkin_make
source ~/catkin_ws/devel/setup.bash
(3)进行ROS的配置
gedit ~/.bashrc
在打开的文件的最低端添加如下的文本内容,等号两端不能有空格
# Set ROS Kinetic
source /opt/ros/kinetic/setup.bash
source ~/catkin_ws/devel/setup.bash
# Set ROS Network
export ROS_HOSTNAME=localhost
export ROS_MASTER_URI=http://localhost:11311
# Set ROS alias command
alias cw='cd ~/catkin_ws'
alias cs='cd ~/catkin_ws/src'
alias cm='cd ~/catkin_ws && catkin_make'
(4)使得更改生效
source ~/.bashrc
至此,所有的安装,配置工作就已经完成,在这个过程中参考了很多前辈,大神的博文,再次一并表示感谢。
参考文献:
[1] http://wiki.ros.org/kinetic/Installation/Ubuntu
[2] https://blog.csdn.net/OKasy/article/details/79448623
[3] https://blog.csdn.net/gddxz_zhouhao/article/details/72861266
[4] https://blog.csdn.net/inslow/article/details/54378350
[5] https://blog.csdn.net/gddxz_zhouhao/article/details/72861266
[6] https://blog.csdn.net/DeepWolf/article/details/84261736