SIGVerse v3では、ROS(Robot Operating System)のプログラムを利用して仮想ロボットを制御することができます。
ここでは ROS を使用したサンプルプログラムについて説明します。 ROSを使用しないサンプルプログラムはこちらのページを参照してください。
ROSを使用する際にはUbuntu環境を用意して、そこにROSをインストールします。
そしてROSをインストールしたUbuntuと、UnityをインストールしたWindowsで通信を行います。
Windows側の要件はこちらのページを参照してください。
ROS側の要件は、OSが Ubuntu 18.04 、ROSのディストリビューションは Melodic Morenia とします。
こちらのページを参照して、Windows環境の構築を行ってください。
その後、以降の環境構築作業を行ってください。
以下のようにUbuntu環境を構築します。
Ubuntu PCを用意する代わりにWindows上にUbuntuの仮想マシンを構築して使用することもできます。
但しこの場合、GPUを使用するチュートリアルは難しいです。
またVMwareを使用すると多くの計算資源が必要になるので注意してください。
VMwareを使用してUbuntu環境を構築する方法は次のような流れです。
こちらのページを1.6節まで実行してROSをインストールします。
その後、ROSのチュートリアルの3章に従ってROSワークスペースの作成を行ってください。
また以降のコマンド簡略化のため、~/catkin_ws/devel/setup.bash の実行を.bashrcに追記します。複数のROSワークスペースを管理している方は注意してください。
$ echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc $ source ~/.bashrc
ターミナルを起動し、以下のコマンドを実行します。
$ sudo apt-get install ros-melodic-rosbridge-server
ターミナルで、以下のコマンドを実行します。
$ cd ~/Downloads (日本語設定の場合は cd ~/ダウンロード) $ wget https://github.com/mongodb/mongo-c-driver/releases/download/1.4.2/mongo-c-driver-1.4.2.tar.gz $ tar zxvf mongo-c-driver-1.4.2.tar.gz $ cd mongo-c-driver-1.4.2 $ ./configure $ make $ sudo make install
ターミナルで、以下のコマンドを実行します。
$ cd ~/Downloads (日本語設定の場合は cd ~/ダウンロード) $ wget https://github.com/mongodb/mongo-cxx-driver/archive/r3.0.3.tar.gz $ tar zxvf r3.0.3.tar.gz $ cd mongo-cxx-driver-r3.0.3/build $ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DLIBMONGOC_DIR=/usr/local -DLIBBSON_DIR=/usr/local .. $ sudo make EP_mnmlstc_core $ make $ sudo make install
ターミナルで、以下のコマンドを実行します。
$ cd ~/catkin_ws/src $ git clone https://github.com/SIGVerse/sigverse_ros_package.git $ cd .. $ catkin_make
TurtleBotを利用するには関連するROSパッケージをインストールします。
$ sudo apt install ros-melodic-rgbd-launch $ sudo apt install ros-melodic-gmapping $ sudo apt install ros-melodic-turtlebot* $ cd ~/catkin_ws/ $ curl -sLf https://raw.githubusercontent.com/gaunthan/Turtlebot2-On-Melodic/master/install_basic.sh | bash $ cp src/sigverse_ros_package/examples/turtlebot2/resources/asus_xtion_pro_sigverse.launch.xml src/turtlebot/turtlebot_bringup/launch/includes/3dsensor $ catkin_make $ cd ~/catkin_ws/src $ git clone https://github.com/ros-drivers/openni2_camera.git $ git clone -b legacy https://github.com/IntelRealSense/librealsense.git $ git clone -b indigo-devel https://github.com/IntelRealSense/realsense-ros.git $ cd ~/catkin_ws $ catkin_make --pkg librealsense $ catkin_make $ source ~/.bashrc
※本件に関してまして、産業技術総合研究所の原功 氏からファイルの提供と助言を頂きました。有難うございました。
PR2を利用するにはPR2関連パッケージをインストールします。
$ sudo apt-get install ros-melodic-pr2*
Unityのサンプルシーンを実行する前に、ROSのIPアドレスをUnity側に設定する必要があります。
$ hostname -I
Unityシーンの実行方法は次の通りです。