配置环境ubuntu 20.04 ,安装ros2系统。
一、安装ros系统时,请确保自己网络是畅通。会安装很多的依赖包。包括ssh、python编译器、C++编译器等等
1、打开官网 melodic/Installation/Ubuntu - ROS Wiki
1>Setup your 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'
2>Set up your keys
sudo apt install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
(可选)问题:
http://raw.githubusercontent.com是墙外地址,可能无法访问的问题;没遇到可忽略
解决方法;弄个梯子,或者从另一个网址获取密钥,如下
wget http://packages.ros.org/ros.key
sudo apt-key add ros.key
3>
sudo apt update 更新索引
sudo apt upgrade 更新软件包
Desktop-Full Install: (Recommended) : ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators and 2D/3D perception
4>sudo apt install ros-noetic-desktop-full
安装ros的版本,我这里选择的是安装ros完整的桌面版;安装的快慢完全取决于网速。
下面这个图很重要! noetic
二、设置开机启动
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
(可选)可以设置当前shell环境
source /opt/ros/noetic/setup.bash
三、roscore:用于启动ROS系统的核心节点
roscore
下图代表启动成功