ROS实战(一)|安装ROS Melodic
最近的小车需要用到ROS,学习的过程做个记录。
此次记录的主要是软件安装过程中遇到的问题。
ubuntu1804 换源
安装好Ubuntu 1804以后首先换源:
1 | sudo apt update && sudo apt install apt-transport-https ca-certificates -y |
其中,安装apt-transport-https并将安装协议更换到https以避免运营商缓存劫持。
安装ROS Melodic
参考 http://wiki.ros.org/cn/melodic/Installation/Ubuntu
设置sources.list
1 | sudo sh -c 'echo "deb https://mirrors.aliyun.com/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' |
【更新】
国科大ROS源:
1 | sudo sh -c 'echo "deb https://mirrors.ustc.edu.cn/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' |
北外ROS源:
1 | sudo sh -c 'echo "deb https://mirrors.bfsu.edu.cn/ros/ubuntu/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' |
设置密钥
1 | sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 |
另一种方式
1 | curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | sudo apt-key add - |
安装
桌面完整版:
1 | sudo apt update && sudo apt install ros-melodic-desktop-full -y |
初始化rosdep
初始化需要使用代理服务器,设置代理服务器后请修改sudo配置文件以传递环境变量。
1 | sudo rosdep init |
设置环境
1 | echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc |
构建工厂依赖
1 | sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential |