由于ROS2还在迭代开发中,同时借助ROS1中的资源,可以在Ubuntu18.04下安装ROS-Melodic及ROS2-dashing.
需要注意切换到国内的镜像源,进行安装
安装ROS-melodic
- 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
- sudo apt install ros-melodic-desktop-full
- sudo rosdep init
- rosdep update
- echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
- source ~/.bashrc
- sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
安装完成后进行测试
终端中输入命令roscore
安装ROS2 dashing
- sudo locale-gen en_US en_US.UTF-8
- sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
- export LANG=en_US.UTF-8
- sudo apt update && sudo apt install curl gnupg2 lsb-release
- curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
- sudo sh -c 'echo "deb [arch=amd64,arm64] http://packages.ros.org/ros2/ubuntu
lsb_release -cs
main" > /etc/apt/sources.list.d/ros2-latest.list' - sudo apt update
- sudo apt install ros-dashing-desktop
- sudo apt install python3-argcomplete
- source /opt/ros/dashing/setup.bash
- echo "source /opt/ros/dashing/setup.bash" >> ~/.bashrc
- source .bashrc
- sudo apt update
- sudo apt install ros-dashing-ros1-bridge
安装完成后进行测试
终端中输入命令ros2 -h
额外安装
sudo apt install ros-melodic-robot-upstart
sudo apt install ros-melodic-joy
sudo apt install ros-melodic-ps3joy
sudo apt install ros-melodic-joystick-drivers
sudo apt install ros-melodic-rosbridge-suite
sudo apt install ssh
sudo apt install proftpd-basic
sudo apt install libudev-dev
sudo apt install vim
sudo apt install net-tools