ROS course 002: Install
1. Summary
In newest meledic version, ROS can run on Ubuntu, Debian and Windows 10. For convinient, i’ll use Ubuntu version. In this tutorial we’ll install ROS on Ubuntu.
2. Version
ROS version list :
Ubuntu version | ROS version | Support period |
---|---|---|
14.04 | Indigo Igloo | 2019年5月 |
16.04 | Kinetic Kame | 2021年5月 |
18.04 | Melodic Morenia | 2023年5月 |
i use Ubuntu-18.04 and Melodic vesion of ROS (May of 2019)
3. ROS install
Run the following commands to install ROS and other third-party software
# get the repo list
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://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
sudo apt update
# Install newest ros version: melodic
# install all packages
sudo apt install ros-melodic-desktop-full build-essential
sudo rosdep init
rosdep update
# Load ros environment whenever new terminal is opened
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
# Install required python package
# Customed anaconda environment is not usable
# So we need to use root anaconda environment directly
pip install rosinstall rosinstall-generator wstool rosdep
# rqt tools kit
sudo apt install ros-melodic-rqt ros-melodic-rqt-common-plugins
# add pyside2 to anaconda environment
pip install pyside2 pydot
Please read the command for detail of each command blocks.
4. Create workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
cd ~/catkin_ws
catkin_make
source ~/catkin_ws/devel/setup.bash
ROS use catkin as build tool. Because of this reason, the workspace is called catkin workspace. For detail of catkin workspace see the wiki
5. Check installation
# Open new terminal
roscore
The output should be as follow
6. Create a bare package
cd ~/catkin_ws/src
# catkin_create_pkg [package_name] [dependency_1] [dependency_2] ..
catkin_create_pkg beginner_tutorials std_msgs rospy roscpp
ROSのプログラムはROSパッケージという単位で管理されます。パッケージの作成はインストールとは関係ありませんがここで説明します。パッケージは必ずcatkinワークスペースの中のsrcディレクトリの内部に置きます。
パッケージを製作するコマンドがcatkin_create_pkg
です。1つ目の引数はパッケージ名(名前は自由、上のスクリプトではbeginner_tutorials)2つ目以降は依存するパッケージです。とりあえず上の3つを入れておけばよく、後から追加できます。
7. Install useful package
sudo apt-get install -y ros-melodic-joystick-drivers
sudo apt-get install -y ros-melodic-jsk-visualization
sudo apt-get install -y ros-melodic-image-proc
The name of ros’s package is often as ros-[ros_distribution]-[package]. For example when we want to install joystick_drivers for melodic distribution, we’ll install the package named ros-melodic-joystick-drivers
Leave a comment