正常安装ros流程
# -------------- ros 安装 melodic -----------------------
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'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654or sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654sudo apt-get update
sudo apt-get install ros-melodic-desktop-full
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential ros-melodic-ros
sudo apt-get install ros-melodic-rqt*
sudo apt install rospack-tools
sudo rosdep init
rosdep update# sudo rosdep init 和 rosdep update出错时
sudo apt-get install python-pip
sudo pip install rosdepc
sudo rosdepc init
rosdepc update# 环境配置
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc# 测试
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key
rosdep init 和 rosdep update 失败问题解决
1.排除网络问题2.开手机热点3.增加TIMEOUT的时间:更改 /usr/lib/python2.7/dist-packages/rosdep2/下的三个文件sources_list.py、gbpdistro_support.py、rep3.py
中的DOWNLOAD_TIMEOUT = 15.0值,改大一点就可以了,1500左右。
以上三个文件也可能在/usr/lib/python3.6/dist-packages/目录下,用 locate rosdep 确定具体位置;4.修改hosts文件
通过设置hosts,原来rosdep访问失败的地址可以被预先指定为访问状况良好的IP
到https://www.ipaddress.com/查询http://raw.githubusercontent.com的IP地址,任选一个,例如185.199.108.133sudo gedit /etc/hosts
//空白处增加一行
185.199.108.133 raw.githubusercontent.com //中间有空格或者tab分隔5. 采用修改源,如rosdepc
参考:https://mp.weixin.qq.com/s/VGs8oWdhHH6XsHcx21lN4Q
sudo apt-get install python-pip
sudo pip install rosdepc
sudo rosdepc init
rosdepc update//出现以下报错是正常现象,fuerte已经多年没有更新,其中的包也是几乎用不到的
ERROR: Not all sources were able to be updated.
ERROR: unable to process source [https://gitee.com/ohhuo/rosdistro/raw/master/releases/fuerte.yaml]:Failed to download target platform data for gbpdistro:<urlopen error timed out>
如果开手机热点解决不了,建议直接采用方法5.
参考:
解决rosdep update失败问题 - 知乎
本文之后,世上再无rosdep更新失败问题!如果有....小鱼就...