安装ros
1、设置软件源
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'
2、设置密钥
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
如果出现E: 仓库“http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu lsb_release Release,可以更换这一条指令:curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | sudo apt-key add -
3、安装
sudo apt update
sudo apt install ros-melodic-desktop-full
4、初始化 rosdep
sudo rosdep init
rosdep update
不过一般连接失败。这里参考:https://www.guyuehome.com/35408
sudo apt-get install python3-pip
sudo pip3 install rosdepc
sudo rosdepc init
rosdepc update
5、设置环境rosdepc update
将 ROS 环境变量自动添加到新 bash 会话会很方便:
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
6、构建工厂依赖
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
ros使用过程问题汇总:
-
IOError: [Errno 13] Permission denied: '/home/xdh/.ros/roscore-11311.pid'
解决:只要把~/.ros/ 整个文件夹权限设置一下就可以了sudo chmod 777 -R ~/.ros