1 打开软件更新
选择清华源代码,点击关闭后,选择弹出的提示更新软件源。
2。设置软件源
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'
3 设置密钥
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
3.安装
sudo apt-get update
sudo apt-get install ros-melodic-desktop-full
sudo rosdep init
4 错误1 ,运行sudo rosdep init 会提示,参考博客https://blog.csdn.net/nanianwochengshui/article/details/105702188#commentBox解决。
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
5接着输入:
sudo rosdep init
rosdep update
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
6安装完毕,测试
roscore
7 错误2,上面测试结果报错
Command ‘roscore’ not found, but can be installed with:
sudo apt install python-roslaunch
8运行下面指令解决7中报错
sudo apt-get install ros-melodic-desktop-full
9再次运行 rescore ,测试结果如下则安装成功!
... logging to /home/zsp/.ros/log/1629ce60-1f17-11eb-8b6a-00e067152f2b/roslaunch-zsp-Nano6F-7F-29582.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.started roslaunch server http://zsp-Nano6F-7F:37981/
ros_comm version 1.14.9SUMMARY
========PARAMETERS* /rosdistro: melodic* /rosversion: 1.14.9NODESauto-starting new master
process[master]: started with pid [29597]
ROS_MASTER_URI=http://zsp-Nano6F-7F:11311/setting /run_id to 1629ce60-1f17-11eb-8b6a-00e067152f2b
process[rosout-1]: started with pid [29608]
started core service [/rosout]
^C[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done