🤖
Open-RMFのデモをDevContainer上で動かす
Open-RMFを触ってみたくて、DevContainer上でOpen-RMFのデモを動作させてみました。
Open-RMFは、複数のロボットシステムを統合・協調させるためのオープンソースのロボットフリートマネジメントシステムです。
- open-rmf/rmf_demos: Demonstrations of the Open-RMF
- open-rmf/rmf: Root repository for the RMF software
設定内容
ROS 2 Jazzy を対象にしています。
動作確認は、Windows 11 の WSL2 で行っています。
プロジェクトは下記になっています。
なお、この後rmf-webなども動かしてみる予定なので、ここに書いていある内容から変わっていくかもしれません。
セットアップは全てDockerfile上で行っています。
FROM ubuntu:24.04
# ROS 2 Jazzy
# https://docs.ros.org/en/jazzy/Installation/Ubuntu-Install-Debs.html
#
# Open RMF
# https://github.com/open-rmf/rmf?tab=readme-ov-file#setup
SHELL ["/bin/bash", "-c"]
# aptが安定するように、ミラーサイトを変更
RUN apt-get update && apt-get install -y ca-certificates
RUN sed -i.bak -r 's@http://(jp\.)?archive\.ubuntu\.com/ubuntu/?@https://ftp.udx.icscoe.jp/Linux/ubuntu/@g' /etc/apt/sources.list.d/ubuntu.sources
# System setup - Set locale
RUN apt-get update && apt-get install -y locales && \
locale-gen en_US en_US.UTF-8 && \
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8
# Enable required repositories
RUN apt-get update && apt-get install -y \
software-properties-common \
curl && \
add-apt-repository universe
# Add ROS 2 GPG key
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
# Add repository to sources list
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
# Install development tools
RUN apt-get update && apt-get install -y ros-dev-tools
# Update repository caches and upgrade system
RUN apt-get update && apt-get upgrade -y
# Install ROS 2 (Desktop Install - Recommended)
RUN apt-get install -y ros-jazzy-desktop
# Initialize rosdep
# https://docs.ros.org/en/jazzy/Installation/Alternatives/Ubuntu-Install-Binary.html#linux-install-binary-install-missing-dependencies
RUN rosdep init
# Install Open RMF
RUN apt-get update && apt-get install -y ros-jazzy-rmf-dev
# rmf_demosの準備
WORKDIR /opt/rmf_demos
# rmf_demosのjazzyブランチをzipでダウンロードしてビルド
RUN wget https://github.com/open-rmf/rmf_demos/archive/refs/heads/jazzy.zip -O rmf_demos.zip && \
unzip rmf_demos.zip && \
mkdir src && \
mv rmf_demos-jazzy src/rmf_demos && \
rm -rf rmf_demos.zip
RUN colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml && colcon mixin update default
RUN source /opt/ros/jazzy/setup.bash && \
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash && \
rosdep update && \
rosdep install --from-paths src --ignore-src -r -y && \
colcon build
# ビルド時に ~/.gazebo/models にダウンロードされたモデルを ubuntu ユーザーのホームディレクトリにコピー
RUN cp -r /root/.gazebo /home/ubuntu/ && \
chown -R ubuntu:ubuntu /home/ubuntu/.gazebo
RUN apt-get update && apt-get install -y ros-jazzy-ros-gz
# ロボットのModelのパスが正しく設定されていないため、シンボリックリンクを作成
RUN cd /opt/rmf_demos/install/rmf_demos_assets/share/rmf_demos_assets/models/ && \
mkdir Open-RMF && \
cd Open-RMF && \
ln -s ../Caddy ./Caddy && \
ln -s ../CleanerBotA ./CleanerBotA && \
ln -s ../CleanerBotE ./CleanerBotE && \
ln -s ../DeliveryRobot ./DeliveryRobot && \
ln -s ../HospitalRobot ./HospitalRobot && \
ln -s ../RobotPlaceholder ./RobotPlaceholder && \
ln -s ../TeleportDispenser ./TeleportDispenser && \
ln -s ../TeleportIngestor ./TeleportIngestor && \
ln -s ../TinyRobot ./TinyRobot
# その他の必要なパッケージをインストール
RUN apt-get install -y \
vim \
# GUI関連 (X11フォワーディング用)
x11-apps
# sudoでのパスワードなしでの実行を許可するための設定
RUN echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# ユーザー切り替え
USER ubuntu
# Setup environment
RUN echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc && \
echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> ~/.bashrc && \
echo "source /opt/rmf_demos/install/setup.bash" >> ~/.bashrc
# system pluginのパスを設定
RUN echo "export GZ_SIM_SYSTEM_PLUGIN_PATH=/opt/ros/jazzy/lib/rmf_robot_sim_gz_plugins:\$GZ_SIM_SYSTEM_PLUGIN_PATH" >> ~/.bashrc && \
echo "export GZ_SIM_SYSTEM_PLUGIN_PATH=/opt/ros/jazzy/lib/rmf_building_sim_gz_plugins:\$GZ_SIM_SYSTEM_PLUGIN_PATH" >> ~/.bashrc
# gui pluginのパスを設定
RUN echo "export GZ_GUI_PLUGIN_PATH=/opt/ros/jazzy/lib/rmf_building_sim_gz_plugins:\$GZ_GUI_PLUGIN_PATH" >> ~/.bashrc
Demo Worlds の、Hotel World と Office World が動作することを確認しています。
ros2 launch rmf_demos_gz office.launch.xml
ros2 run rmf_demos_tasks dispatch_delivery -p pantry -ph coke_dispenser -d hardware_2 -dh coke_ingestor --use_sim_time
ros2 run rmf_demos_tasks dispatch_patrol -p coe lounge -n 3 --use_sim_time
なお、GPU無しでも動きましたが、CPU 100%に張り付く感じでした。(GazeboのUIが重たそう)
そのままだと動かなかった部分
GitHubのREADMEなどの情報だけでは動かなかった部分について記載しておきます。
(1) Unable to find uri[model://Open-RMF/CleanerBotA]
[gz-20] [Err] [Server.cc:86] Error Code 14: [/sdf/world[@name="sim_world"]/include[61]/uri:/opt/rmf_demos/install/rmf_demos_maps/share/rmf_demos_maps/maps/hotel/hotel.world:L815]: Msg: Unable to find uri[model://Open-RMF/CleanerBotA]
[gz-20] [Err] [Server.cc:86] Error Code 14: [/sdf/world[@name="sim_world"]/include[62]/uri:/opt/rmf_demos/install/rmf_demos_maps/share/rmf_demos_maps/maps/hotel/hotel.world:L820]: Msg: Unable to find uri[model://Open-RMF/CleanerBotA]
[gz-20] [Err] [Server.cc:86] Error Code 14: [/sdf/world[@name="sim_world"]/include[63]/uri:/opt/rmf_demos/install/rmf_demos_maps/share/rmf_demos_maps/maps/hotel/hotel.world:L825]: Msg: Unable to find uri[model://Open-RMF/TinyRobot]
[gz-20] [Err] [Server.cc:86] Error Code 14: [/sdf/world[@name="sim_world"]/include[64]/uri:/opt/rmf_demos/install/rmf_demos_maps/share/rmf_demos_maps/maps/hotel/hotel.world:L830]: Msg: Unable to find uri[model://Open-RMF/DeliveryRobot]
実際はrmf_demos_assets/share/rmf_demos_assets/models
配下に存在する(Open-RMF
を挟まない)ので、Open-RMF
フォルダを作ってそこにリンクを張ることで回避しました。
cd /opt/rmf_demos/install/rmf_demos_assets/share/rmf_demos_assets/models/
mkdir Open-RMF
cd Open-RMF
ln -s ../Caddy ./Caddy
ln -s ../CleanerBotA ./CleanerBotA
ln -s ../CleanerBotE ./CleanerBotE
ln -s ../DeliveryRobot ./DeliveryRobot
ln -s ../HospitalRobot ./HospitalRobot
ln -s ../RobotPlaceholder ./RobotPlaceholder
ln -s ../TeleportDispenser ./TeleportDispenser
ln -s ../TeleportIngestor ./TeleportIngestor
ln -s ../TinyRobot ./TinyRobot
(2) Failed to load system plugin
[gz-20] [Err] [SystemLoader.cc:92] Failed to load system plugin [libdoor.so] : Could not find shared library.
[gz-20] [Err] [SystemLoader.cc:92] Failed to load system plugin [liblift.so] : Could not find shared library.
[gz-20] [Err] [SystemLoader.cc:92] Failed to load system plugin [libslotcar.so] : Could not find shared library.
[gz-20] [Err] [SystemLoader.cc:92] Failed to load system plugin [libslotcar.so] : Could not find shared library.
[gz-20] [Err] [SystemLoader.cc:92] Failed to load system plugin [libslotcar.so] : Could not find shared library.
[gz-20] [Err] [SystemLoader.cc:92] Failed to load system plugin [libslotcar.so] : Could not find shared library.
[gz-20] [Err] [SystemLoader.cc:92] Failed to load system plugin [libregister_component.so] : Could not find shared library.
[gz-20] [Err] [SystemLoader.cc:92] Failed to load system plugin [libregister_component.so] : Could not find shared library.
[gz-20] [Err] [SystemLoader.cc:92] Failed to load system plugin [libregister_component.so] : Could not find shared library.
[gz-20] [Err] [SystemLoader.cc:92] Failed to load system plugin [libregister_component.so] : Could not find shared library.
[gz-20] [Err] [SystemLoader.cc:92] Failed to load system plugin [libregister_component.so] : Could not find shared library.
Systemプラグインが読み込めていませんでした。
GZ_SIM_SYSTEM_PLUGIN_PATH
でSystemプラグインのパスを設定して回避しました。
export GZ_SIM_SYSTEM_PLUGIN_PATH=/opt/ros/jazzy/lib/rmf_robot_sim_gz_plugins:$GZ_SIM_SYSTEM_PLUGIN_PATH
export GZ_SIM_SYSTEM_PLUGIN_PATH=/opt/ros/jazzy/lib/rmf_building_sim_gz_plugins:$GZ_SIM_SYSTEM_PLUGIN_PATH
(3) Failed to load plugin
[gz-16] [GUI] [Err] [Application.cc:545] Failed to load plugin [toggle_charging] : couldn't find shared library.
[gz-16] [GUI] [Err] [Application.cc:545] Failed to load plugin [toggle_floors] : couldn't find shared library.
GUIプラグインが読み込めていませんでした。
GZ_GUI_PLUGIN_PATH
でGUIプラグインのパスを設定して回避しました。
export GZ_GUI_PLUGIN_PATH=/opt/ros/jazzy/lib/rmf_building_sim_gz_plugins:$GZ_GUI_PLUGIN_PATH
Discussion