设置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'
设置密钥
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
更新软件源索引
sudo apt update
安装ROSmelodic(三选一)
//桌面完整版
sudo apt install ros-melodic-desktop-full
//桌面版
sudo apt install ros-melodic-desktop
//ROS-基础包
sudo apt install ros-melodic-ros-base
安装rosdep
sudo apt-get install python-rosdep
sudo rosdep init
rosdep update
这边需要碰运气,如果不成功,请参照以下链接解决
链接: rosdep坑解决方案.
备注: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
测试
打开三个终端,分别输入下列三个命令,看有没有龟龟
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key