测试平台:Ubuntu 18.04
测试时间:2022年11月8日
official link(官方链接): Click
如需快速安装,可参考步骤总览,其中罗列了后续使用的安装命令,如果对每一步比较感兴趣,可参考步骤剖析
跟着如下步骤,无需切换终端
# 添加源
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
# 添加密钥
sudo apt install curl
git clone https://github.com/ros/rosdistro
cd rosdistro
sudo apt-key add ros.key
# 更新源
sudo apt update
# 安装 ROS
sudo apt install ros-melodic-desktop-full
# 添加环境变量
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
# 依赖安装
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
# rosdep 初始化
cd ..
wget http://fishros.com/install -O fishros && . fishros # 选择序号 3
rosdepc update
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
选择其它镜像源可访问:Click
sudo apt install curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
其中,第二步可能会失败,终端反馈
gdp: 找不到有效的 openpgp 数据
解决方案:
git clone https://github.com/ros/rosdistro
cd rosdistro
sudo apt-key add ros.key
sudo apt update
sudo apt install ros-melodic-desktop-full
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo apt install python-rosdep
sudo rosdep init
rosdep update
上述命令执行到第二步会发生错误,解决方案为使用鱼香ros的一键安装中的 rosdepc 功能
wget http://fishros.com/install -O fishros && . fishros
选择序号 3 ,一键配置:rosdep
最后输入如下命令,即可完成 rosdep 的初始化
rosdepc update
至此,安装完成,打开新的终端,分别输入如下命令:
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key
如果出现经典小海龟仿真,则安装成功;