sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
3.安装ROS
sudo apt-get update
sudo apt-get install ros-melodic-desktop-full
4.以防初始化找不到文件,再次打开文件更新,然后会有提醒更新。之后
apt-cache search rosdep
sudo apt install python-rosdep
添加一个内容,避免初始化ros时出错
#打开hosts文件
sudo gedit /etc/hosts
#末尾添加
151.101.84.133 raw.githubusercontent.com
#保存后退出再尝试
5.初始化rosde
sudo rosdep init
rosdep update
6.设置环境变量
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
7.安装rosinstall
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential