1 ubuntu设置下载源,很重要,选择正确的下载源,安装会很顺利。
2 设置安装源(增加ubuntu版的ros数据仓库,即下载源)(通用指令适合任何版本的ros)
ROS Kinetic只支持Wily(15.10)和Xenial(16.04)对应内核分别为4.2和4.4,使用下面命令:
ros@ubuntu:~/Desktop$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
3 设置keys实现安全从数据仓库下载未被修改版,故设置key增加可信度
ros@ubuntu:~/Desktop$ sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116
Executing: /tmp/tmp.hiSjhfjoZI/gpg.1.sh --keyserver
hkp://ha.pool.sks-keyservers.net:80
--recv-key
0xB01FA116
gpg: requesting key B01FA116 from hkp server ha.pool.sks-keyservers.net
gpg: key B01FA116: "ROS Builder <rosbuild@ros.org>" not changed
gpg: Total number processed: 1
gpg: unchanged: 1
4 安装ros(2d、3d、rviz等)
ros@ubuntu:~/Desktop$sudo apt-get update
ros@ubuntu:~/Desktop$ sudo apt-get install ros-kinetic-desktop-full
安装功能包:
ros@ubuntu:~/Desktop$ sudo apt-get install ros-kinetic-PACKAGE
例如:
ros@ubuntu:~/Desktop$ sudo apt-get install ros-kinetic-slam-gmapping
查找在kinetic中可以使用的功能包:
ros@ubuntu:~/Desktop$ apt-cache search ros-kinetic
5 初始化
ros@ubuntu:~/Desktop$ sudo rosdep init
Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run
rosdep update
ros@ubuntu:~/Desktop$ rosdep update
reading 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.yaml
Add distro "groovy"
Add distro "hydro"
Add distro "indigo"
Add distro "jade"
Add distro "kinetic"
updated cache in /home/ros/.ros/rosdep/sources.cache
6 环境配置
ros@ubuntu:~/Desktop$ echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
ros@ubuntu:~/Desktop$ source ~/.bashrc
注意当安装多个ROS发行版,使用kinetic需要用到下面命令:
ros@ubuntu:~/Desktop$ source /opt/ros/kinetic/setup.bash
7 安装rosinstall
ros@ubuntu:~/Desktop$ sudo apt-get install python-rosinstall
8 测试roscore
ros@ubuntu:~/Desktop$ roscore ... logging to /home/ros/.ros/log/318897ba-9918-11e6-9f21-000c29dd5e2f/roslaunch-ubuntu-32287.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. started roslaunch server http://ubuntu:33677/ ros_comm version 1.12.5 SUMMARY ======== PARAMETERS * /rosdistro: kinetic * /rosversion: 1.12.5 NODES auto-starting new master process[master]: started with pid [32300] ROS_MASTER_URI=http://ubuntu:11311/ setting /run_id to 318897ba-9918-11e6-9f21-000c29dd5e2f process[rosout-1]: started with pid [32313] 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@ubuntu:~/Desktop$