Help us understand the problem. What is going on with this article?

Dockerで ROS Kinetic 環境を扱う

目的

Dockerで ROS Kinetic 環境を扱う際の備忘録です

Docker ROS Kinetic 環境のイメージファイルを取得する

$ docker run -it --rm -p 6080:80 ct2034/vnc-ros-kinetic-full

ブラウザから、http://127.0.0.1:6080 へアクセスできればOK

スクリーンショット 2020-05-17 12.27.25.png

turtlesimも動きました

roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key

スクリーンショット 2020-05-17 12.29.09.png

Dockerfileから起動

$ mkdir -p test
$ cd test
$ git clone git https://github.com/ct2034/docker-ubuntu-vnc-desktop
$ cd docker-ubuntu-vnc-desktop

Dockerfileはこのようになっている

FROM ubuntu:16.04

ENV DEBIAN_FRONTEND noninteractive

# built-in packages
RUN apt-get update \
    && apt-get install -y --no-install-recommends software-properties-common curl \
    && sh -c "echo 'deb http://download.opensuse.org/repositories/home:/Horst3180/xUbuntu_16.04/ /' >> /etc/apt/sources.list.d/arc-theme.list" \
    && curl -SL http://download.opensuse.org/repositories/home:Horst3180/xUbuntu_16.04/Release.key | apt-key add - \
    && add-apt-repository ppa:fcwu-tw/ppa \
    && apt-get update \
    && apt-get install -y --no-install-recommends --allow-unauthenticated \
        supervisor \
        openssh-server pwgen sudo vim-tiny \
        net-tools \
        lxde x11vnc xvfb \
        gtk2-engines-murrine ttf-ubuntu-font-family \
        firefox \
        nginx \
        python-pip python-dev build-essential \
        mesa-utils libgl1-mesa-dri \
        gnome-themes-standard gtk2-engines-pixbuf gtk2-engines-murrine pinta arc-theme \
        dbus-x11 x11-utils \
        terminator \
    && apt-get autoclean \
    && apt-get autoremove \
    && rm -rf /var/lib/apt/lists/*

# =================================
# install ros (source: https://github.com/osrf/docker_images/blob/5399f380af0a7735405a4b6a07c6c40b867563bd/ros/kinetic/ubuntu/xenial/ros-core/Dockerfile)
# install packages
RUN apt-get update && apt-get install -y --no-install-recommends \
    dirmngr \
    gnupg2 \
    && rm -rf /var/lib/apt/lists/*

# setup keys
RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

# setup sources.list
RUN echo "deb http://packages.ros.org/ros/ubuntu xenial main" > /etc/apt/sources.list.d/ros-latest.list

# install bootstrap tools
RUN apt-get update && apt-get install --no-install-recommends -y \
    python-rosdep \
    python-rosinstall \
    python-vcstools \
    && rm -rf /var/lib/apt/lists/*

# setup environment
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

# bootstrap rosdep
RUN rosdep init \
    && rosdep update

# install ros packages
ENV ROS_DISTRO kinetic
RUN apt-get update && apt-get install -y \
#    ros-kinetic-ros-core=1.3.1-0* \
    ros-kinetic-desktop-full \
    #              A
    #              +--- full desktop \
    && rm -rf /var/lib/apt/lists/*

# setup entrypoint
# COPY ./ros_entrypoint.sh /


# =================================

# user tools
RUN apt-get update && apt-get install -y \
    terminator \
    gedit \
    okular \
    vim \
    && rm -rf /var/lib/apt/lists/*

# tini for subreap
ENV TINI_VERSION v0.9.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /bin/tini
RUN chmod +x /bin/tini

ADD image /
RUN pip install setuptools wheel && pip install -r /usr/lib/web/requirements.txt

RUN cp /usr/share/applications/terminator.desktop /root/Desktop
RUN echo "source /opt/ros/kinetic/setup.bash" >> /root/.bashrc


EXPOSE 80
WORKDIR /root
ENV HOME=/home/ubuntu \
    SHELL=/bin/bash
ENTRYPOINT ["/startup.sh"]

gnome-terminal をインストールする場合

apt-get update
apt-get install -y gnome-terminal

less をインストールする場合

apt-get install -y less

ros-kinetic-turtlebot3 関係のパッケージを入れる

一通り必要そうなものをインストール

apt-get install -y python-pip; \
pip install requests flask; \
apt-get install -y ros-kinetic-turtlebot3 ros-kinetic-turtlebot3-msgs ros-kinetic-turtlebot3-simulations; \
apt-get install -y ros-kinetic-aruco-ros; \
echo "export TURTLEBOT3_MODEL=burger" >> ~/.bashrc
source ~/.bashrc

必要に応じて、GAZEBOモデルのパスを追加する

echo "export GAZEBO_MODEL_PATH="GAZEBOモデルのパス" >> ~/.bashrc
source ~/.bashrc

catkin_wsの設定

http://wiki.ros.org/ja/catkin/Tutorials/create_a_workspace

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
cd ~/catkin_ws/
catkin_make
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

その他

何か不足点あれば教えて頂けますと幸いです。
(新しいエラーに直面した時に、あまり先人の資料がなく解決が難しいです。。)

参考

ROS Kinetic の Ubuntu へのインストール
ROSトピックの理解
Problem with “gnome-terminal” on Gnome 3.12.2
ct2034/vnc-ros-kinetic-full
ct2034/docker-ubuntu-vnc-desktop
fcwu/docker-ubuntu-vnc-desktop
gnome-terminal-3.36.2
最小インストールしたDebianの初期設定メモ

http://wiki.ros.org/ja/catkin/Tutorials/create_a_workspace
ROS kineticでmove base使用時にDWAPlannerROS planner周りのエラーが出た時の対策メモ

seigot
# 投稿内容は私個人の意見であり、所属企業・部門見解を代表するものではありません。 # 投稿内容は執筆時点の情報であり、必ずしも最新情報であるとはかぎりません。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした