ROS Installation (ROS安装与运行)

Share:

Synoposis


本文将介绍:

  • 如何安装ROS?
  • 如何在Docker中安装ROS?

Preparation

  • Check system version using uname -a
  • Ubuntu 18.04: Melodic
  • Ubuntu 16.04: Kinetic

Installation

Melodic

Method 1

$ sudo apt update
$ sudo apt upgrade
$ wget https://raw.githubusercontent.com/ROBOTIS-GIT/robotis_tools/master/install_ros_melodic.sh
$ chmod 755 ./install_ros_melodic.sh 
$ bash ./install_ros_melodic.sh

Method 2

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

Setup Environment

bash:

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc

zsh:

echo "source /opt/ros/melodic/setup.zsh" >> ~/.zshrc
source ~/.zshrc
  • Install Dependencies for building packages
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
  • Initialize rosdep
sudo apt install python-rosdep
sudo rosdep init
rosdep update

To find available packages, use:

apt search ros-melodic

Docker

# Install packages to add ROS repository
RUN apt-get install -y dirmngr gnupg2
# Add ROS repository
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu bionic main" > /etc/apt/sources.list.d/ros-latest.list'
# Keys for ROS repository
RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
## Install ROS-Base packages
RUN apt-get update && apt-get install -y ros-melodic-desktop-full
# Install ROS bootstrap tools
RUN apt-get update && apt-get install --no-install-recommends -y \
    python-rosdep \
    python-rosinstall \
    python-vcstools
# Set up rosdep
RUN rosdep init
RUN rosdep update       

Possible Errors

ros-melodic-desktop-full

The following packages have unmet dependencies:
 ros-melodic-desktop-full : Depends: ros-melodic-desktop but it is not going to be installed
                            Depends: ros-melodic-perception but it is not going to be installed
                            Depends: ros-melodic-simulators but it is not going to be installed
                            Depends: ros-melodic-urdf-sim-tutorial but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Solution

sudo apt-get remove gazebo9* catkin python-rospkg python-rospkg-modules

Refer: https://answers.ros.org/question/299260/unmet-dependencies-when-installing-melodic-on-ubuntu-1804/

yubao_blog_cover

Post a Comment