1.设置Ubuntu的sources.list (软件库)
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
2.添加key
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
3.更新package
sudo apt-get update
sudo apt-get upgrade
建议在安装所有软件前都要执行这两个命令
4.安装ROS kinetic完整版
sudo apt-get install ros-kinetic-desktop-full
5.初始化rosdep
在使用ros之前一定要进行初始化
sudo rosdep init
rosdep update
如果出现网络问题,参考本链接ROS安装(国内源)
6.配置环境
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
注意:在安装zsh的ubuntu上,需要改成
echo "source /opt/ros/kinetic/setup.zsh" >> ~/.zshrc
source ~/.zshrc
7. 安装building package的依赖
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
8. 测试ROS安装成功(共开3个窗口)
roscore
等待程序不动后,再打开一个窗口,输入:
rosrun turtlesim turtlesim_node
出现一只小乌龟,再打开一个窗口,输入:
rosrun turtlesim turtle_teleop_key
此时,可以在终端窗口,键入方向键控制小乌龟的移动。