安装
- 设置软件更新
![c73c66453d51272e7ccc9187d6717cf2.png](https://i-blog.csdnimg.cn/blog_migrate/dff28427357e8b98f7a897ab8850aa61.jpeg)
- 设置软件源,这里选择国内的源,速度相对较快
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.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 F42ED6FBAB17C654
- 安装
sudo apt-get update
sudo apt-get install ros-melodic-desktop-full
sudo apt-get install ros-melodic-rqt*
- 初始化rosdep
sudo rosdep init
rosdep update
- 问题:
- sudo rosdep init出现问题
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
原因:网络问题
方法:尝试各种方法,最终在_风起了_博客找到最终解决方法
#打开hosts文件
sudo gedit /etc/hosts
#在文件末尾添加
151.101.84.133 raw.githubusercontent.com
#保存后退出再尝试
2. rosdep update出现问题
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml]:
<urlopen error ('_ssl.c:711: The handshake operation timed out',)> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml)
原因:网络问题,无法一次性成功,也尝试了网络上各种办法
方法:先将需要的yaml文件下载下来,放在对应的文件,参考super_sean同学中的方法,但依然会出现如:
/etc/ros/rosdistro/master/kinetic/distribition.yaml文件不存在
同样依次在对应的目录下建立文件夹,然后在/etc/ros/rosdistro/master/kinetic/目录下
sudo wget https://raw.githubusercontent.com/ros/rosdistro/master/kinetic/distribution.yaml
缺什么,下载什么
- 设置环境变量
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
- 安装rosinstall
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
测试
roscore
- 再打开一个终端
rosrun turtlesim turtlesim_node
- 再打开一个终端
rosrun turtlesim turtle_teleop_key
此时可以通过方向键控制乌龟