1.设置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'
best:
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(公钥已更新)
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
3.更新package
sudo apt-get update
Err:7 http://packages.ros.org/ros/ubuntu xenial/main i386 Packages
Connection failed
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'
4.安装ROS kinetic完整版
sudo apt-get install ros-kinetic-desktop-full
5.初始化rosdep
在使用ROS之前需要初始化rosdep
sudo rosdep init
rosdep update
ERROR: cannot download default sources list from: https://raw.githubusercont
1)ca-certificates问题,证书不对,重新安装证书
sudo apt-get install ca-certificates
2)系统时间同步问题,需要同步系统时间
参照链接https://blog.csdn.net/A18373279153/article/details/81003937进行系统时间同步
sudo apt-get install ntpdate
sudo ntpdate cn.pool.ntp.org
sudo hwclock --systohc
3) 还是ssl certs问题,继续尝试解决
sudo c_rehash /etc/ssl/certs
sudo -E rosdep init
4)python-rosdep问题
sudo apt-get install python-rosdep
但以上方法全部无效,无奈之下直接在/etc目录下新建/ros/rosdep/sources.list.d/20-default.list文件(注意sudo rosdep init失败时,/etc下并没有/ros目录,需要依次逐级新建),然后将https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list内容粘贴进去,如下:
# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro 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
https://zhuanlan.zhihu.com/p/77483614
6.配置ROS环境
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
7.安装依赖项
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
8.测试ROS是否安装成功
(1)CTRL+ALT+T打开终端(Termial),输入以下命令,初始化ROS环境:
roscore
(2)再 打开一个新的终端(Termial),输入以下命令,弹出一个小乌龟窗口:
rosrun turtlesim turtlesim_node
(3)出现一个小乌龟的LOGO后,再 打开一个新的终端(Termial),输入以下命令:
rosrun turtlesim turtle_teleop_key
(4)打开新的Termial,输入以下命令,可以查看ROS节点信息
rosrun rqt_graph rqt_graph
参考:
https://blog.csdn.net/weixin_43159148/article/details/83375218