Skip to the content.

The 7th “Group Work (1)” (June 5)

第7回 「グループワーク(1)」 (6月5日)

This time we will divide into groups and design the concept of the robot system to be developed using SysML. Use the following equipment to begin developing robot system.

グループに分かれて、SysMLにより開発するロボットシステムの概念設計を行います。 以下の機器を使って、ロボットシステムの開発してください。

1. English

1.1. Group Work

Build up the concept of the robot system you want to develop and model it with SysML.

1.2. Setting up JetBot

ユビキタスロボティクス特論 6/30 from NoriakiAndo

1.2.1. Jetson

Jetson is a general term for small board computers sold by graphic chip maker NVIDIA. Unlike common small CPU boards (such as Raspberry Pi), the board has a graphics processor chip (GPU). GPU is installed not for drawing but for high-speed calculation such as AI. In the class, we will use a small card-sized CPU board called Jetson NANO mounted on a mobile robot.

1.2.2. FaBo JetBot

JetBot is a general term for small mobile robots equipped with Jetson NANO, and is sold by various manufacturers. In class, you can use his JetBot (FaBo JetBot) developed by FaBo Co., Ltd.

The FaBo JetBot Kit provides all documentation and Jupyter Notebook content in Japanese, making JetBot easy for beginners and advanced users alike. It is not mandatory to use FaBo JetBot, but if you want to use it, try using JetBot according to the following FaBo JetBot document, and make it an RT-Component to link with other robots, devices, sensors, etc. to build a robot system.

1.2.3. Installing OpenRTM on JetBot

You can install OpenRTM-aist on JetBot according to the following webpage as same as installing it to other Linux machines.

-(Installation on Ubuntu / Debian) [https://openrtm.org/openrtm/ja/doc/installation/install_1_2/cpp_1_2/install_ubuntu_1_2]

$ wget https://raw.githubusercontent.com/OpenRTM/OpenRTM-aist/master/scripts/pkg_install_ubuntu.sh
$ sudo bash pkg_install_ubuntu.sh -l c++ -l python --yes
$ sudo apt install imageprocessing

1.2.4. Developing on JetBot

You cannot install OpenRTP (Eclipse) on JetBot. When using RTC Builder or RT System Editor, please use your own PC. The development flow is roughly as follows.

Please install “samba” to share between JetBot and your PC.

$ sudo apt install samba nano
$ sudo smbpasswd -a jetbot
New SMB password: jetbot
Retype new SMB password: jetbot
$ sudo nano /etc/samba/smb.conf

Here, please edit the samba’s configuration file “smb.conf”. You can find the following lines at the below of the file.

;[homes]
;   comment = Home Directories
;   browseable = no

Pleae comment-in (delete ‘;’) these lines, and set “browsable” parameter to “yes”.

[homes]
   comment = Home Directories
   browseable = yes

In addition, please restart smbd, nmbd daemons.

$ sudo /etc/init.d/smbd restart
$ sudo /etc/init.d/nmbd restart

Please input the following address in the address-bar in the explorer.

\\nano-2gb-jp441.local\jetbot
or
\\JetBot's IP address\jetbot

Now you can access the home directory of jetbot account in the JetBot machine.

On the Mac, please push “command ? + K” key and input the following address in the dialog.

smb://nano-2gb-jp441.local/jetbot
or
smb://JetBot's IP address/jetbot

then, now you can access the home directory of jetbot account in the JetBot machine.

1.2.5. How to connect Jetson nano

The following slides shows how to connect Jetson nano

$ ssh [user ID]@[ip address]

If you cannot find it, try the following

1.3. RaspberryPi Mouse (Real Robot)

1.4. myCobot

※For Python 3.10 or later, please modify the file {Python installation directory}\Lib\site-packages\math3d\utils.py as the error may occur. Please check the Python installation directory with the following command.

> where python

Fix the following two places in utils.py.

    #return isinstance(obj, collections.Iterable) #Before modification
    return isinstance(obj, collections.abc.Iterable) #After modification
    #return isinstance(obj, collections.Iterable) and len(obj) == 3 #Before modification
    return isinstance(obj, collections.abc.Iterable) and len(obj) == 3 #After modification

1.5. Kobuki

1.6. レゴ マインドストームEV3

1.7. TurtleBot3 Burger

1.8. micro:bit スターターキット

1.9. intel RealSense

1.10. myAGV

Connect a display, keyboard, and mouse to myAGV according to the following documentation.

The battery needs to be charged before turning on the power.

Once powered on, Ubuntu will boot on the Raspberry Pi4 with myAGV. First, enter Ctrl+Alt+F1 keys to start CUI as there will be nothing on the display. Next, enter the following user name and password

Follow the instructions in the documentation to connect to the wireless LAN.

Next, check the IP address of wlan0 with the following command.

> ip addr

Remotely login to Ubuntu on myAGV. Install the following TeraTerm, which is not necessary if you are logging in with other tools such as the ssh command.

Start TeraTerm and make an SSH connection by specifying the IP address you have just found out.

You can confirm the operation by the following procedure. First, since TeraTerm needs to open multiple widows, please type Alt+D key in TeraTerm while you are logged in.

In one window, type the following command.

> cd myagv_ros
> roslaunch myagv_odometry myagv_active.launch
> cd myagv_ros
> roslaunch myagv_teleop myagv_teleop.launch

myAGV can be operated by keystrokes in the window on the side where myagv_teleop is launched.

For wired LAN, the eth0 network interface is disabled at startup, so you must enable it with the following command: ```bash`` myagv_teleop.launch myagv_teleop.

> ifconfig eth0 up

In order for the RTC and myagv_odometry nodes to communicate, the following ROSTransport must be installed.

In OpenRTM-aist 2.0.1, the ROSTransportConfig.cmake is installed in the wrong location, please copy it with the following command.

> sudo mkdir /usr/local/lib/rostransport-2.0
> sudo cp /usr/lib/x86_64-linux-gnu/openrtm-2.0/cmake/ROSTransportConfig.cmake /usr/local/lib/rostransport-2.0/

The following command installs the TimedVelocity2D type and Twist type conversion serializer.

> cd ~
> git clone https://github.com/Nobu19800/testROSTransport
> cd testROSTransport/TimedVelocity2DTwistSerializer
> mkdir build
> cd build
> cmake ..
> make
> sudo make install

Let’s check the operation of TimedVelocity2DTwistSerializer in Turtlesim. Please build the RTC for testing with the following command.

> cd ~/testROSTransport/testVelocity2D
> mkdir build
> cd build
> cmake ..
> make

Next, start Turtlesim with the following command.

> rosrun turtlesim turtlesim_node

The following command launchs the testVelocity2D component.

> ~/testROSTransport/testVelocity2D/build/src/testVelocity2DComp -f ~/testROSTransport/testVelocity2D/rtc.conf

Start OpenRTP with the following command.

> openrtp2

*If you are checking on a Raspberry Pi with myAGV, please check on a different PC, as OpenRTP will not start on the Raspberry Pi. When checking with another PC, press the Name Server Connection button as shown below and enter the IP address of the Raspberry Pi from the screen displayed.

image

Edit the configuration parameters of the testVelocity2D component in the RT System Editor.



As you change the configuration parameters with the slider, you will see the TurtleSim turtle move.

Now check the rtc.conf that was used when the testVelocity2D component was started.

manager.modules.load_path: /usr/lib/x86_64-linux-gnu/openrtm-2.0/transport/, /usr/local/lib/openrtm-2.0/transport
manager.modules.preload: ROSTransport.so, TimedVelocity2DTwistSerializer.so
manager.components.preconnect: testVelocity2D0.out?interface_type=ros&marshaling_type=ros:geometry_msgs/Twist&ros.topic=turtle1/cmd_vel
manager.components.preactivation: testVelocity2D0

The manager.components.preconnect item is used to set up the DataPort connection. If you want to communicate with other Subscriber or Publisher, please change the topic name. myAGV should be able to connect if you set it to cmd_vel.

manager.components.preconnect: testVelocity2D0.out?interface_type=ros&marshaling_type=ros:geometry_msgs/Twist&ros.topic=turtle1/cmd_vel
#manager.components.preconnect: {Instance name of the component}.{port name}?interface_type={interface type}&marshaling_type={serializer name}&ros.topic={topic name}

When communicating between PCs, you need to set the ros.roscore.host property when connecting.

manager.components.preconnect: testVelocity2D0.out?interface_type=ros&marshaling_type=ros:geometry_msgs/Twist&ros.topic=turtle1/cmd_vel&ros.roscore.host=192.168.11.1
#manager.components.preconnect: {Instance name of the component}.{port name}?interface_type={interface type}&marshaling_type={serializer name}&ros.topic={topic name}&ros.roscore.host={IP address of the PC that started roscore}

1.11. CRANE

1.12. Leap Motion

1.13. ROS Master

2. 日本語

2.1. グループワーク(続き)

構築したいロボットシステムの構想を固めて、SysMLでモデル化します。

2.2. Jetbotセットアップ

ユビキタスロボティクス特論 6/30 from NoriakiAndo

2.2.1. Jetson

JetsonとはグラフィックチップメーカーのNVIDIAが販売する、小型のボードコンピュータの総称です。 一般的な(RaspberryPiなどの)小型CPUボードとは異なり、ボードにグラフィックアクセラレータチップ (GPU) を搭載しています。 GPUは描画ではなく、AIなどの計算を高速に行うために搭載されています。 授業では、Jetson NANOと呼ばれる、小型のカードサイズのCPUボードを移動ロボットに搭載したものを使用します。

2.2.2. FaBo JetBot

JetBotとは Jetson NANO を搭載した小型の移動ロボットの総称で、様々なメーカーから販売されています。 授業では株式会社 FaBo により開発された JetBot (FaBo JetBot) を使用することができます。

FaBo JetBot Kit は、ドキュメントや Jupyter Notebook のコンテンツはすべて日本語で提供され、初心者から上級者まで気軽に JetBot を試すことができます。 FaBo JetBotを用いるのは必須ではありませんが、使用する場合は、以下のFaBo JetBotのドキュメントに従い、JetBotを動かしてみるとともに、これをRTコンポーネント化して、他のロボット、デバイス、センサなどと連携させて、ロボットシステムを構築することを目指してください。

2.2.3. JetBotへのOpenRTMのインストール

JetBotへOpenRTM-aistをインストールする方法は、通常のLinuxへのインストール同様、以下の方法でできます。

$ wget https://raw.githubusercontent.com/OpenRTM/OpenRTM-aist/master/scripts/pkg_install_ubuntu.sh
$ sudo bash pkg_install_ubuntu.sh -l c++ -l python --yes
$ sudo apt install imageprocessing

2.2.4. サンプルを動かしてみる

では、OpenRTM-aistが正しくインストールされているかを確認するためサンプルコンポーネントを起動してみます。

2.2.4.1. IPアドレスの確認

まず、現在のJetBotのIPアドレスを確認します。

$ ifconfig -a

で表示されたインターフェースのうちIPアドレスが割あたっている物があれば、そのIPアドレスを覚えておきます。 127.0.0.1は自ホストを表す特別なIPアドレスなので除外します。

2.2.4.2. ネームサーバの起動

ネームサーバを起動します。

$ rtm-naming
パスワードの入力を求められたら入力。
y/n を求められたら y を入力
2.2.4.3. サンプルコンポーネントを起動

サンプルコンポーネントを起動します。サンプルは以下のディレクトリの下にあります。

/usr/share/openrtm-X.Y/components/c++/examples もしくは /usr/share/openrtm-X.Y/components/python/examples

にインストールされています。 ConsoleIn/ConsoleOutのサンプルを起動してみます。

$ /usr/share/openrtm-1.2/components/c++/examples/ConsoleOut&
$ /usr/share/openrtm-1.2/components/c++/examples/ConsoleIn
$

この例では、一つの窓(端末)で実行していますが、別々の窓(端末)で個別に起動しても構いません。

2.2.4.4. OpenRTPでシステム接続

PC側でOpenRTPまたはRTSystemEditorを起動し以下のようにRTC同士を接続・アクティブ化します。

以上で、ConsoleIn側に数値を入力するプロンプトが現れるので、そこに数字を入力すると、ConsoleOut側に同じ数字が表示されます。

2.2.5. JetBot上での開発

JetBotにOpenRTP (Eclipse) はインストールできません。 RTCBuilderやRTSystemEditorを使用する場合は、手持ちのPCで行ってください。 開発の流れはおおよそ以下のとおりです。

PCとJetBot間でファイル共有を行なうために、sambaをインストールします。

$ sudo apt install samba nano
$ sudo smbpasswd -a jetbot
New SMB password: jetbot
Retype new SMB password: jetbot
$ sudo nano /etc/samba/smb.conf

ここで、smb.conf というsambaの設定ファイルを少し編集します。 ファイルの下方に以下のような記載があると思いますので、

 下の方↓
;[homes]
;   comment = Home Directories
;   browseable = no

以下のようにコメント “;” を外し、browsable を yes に設定します。

[homes]
   comment = Home Directories
   browseable = yes

さらに、smbd, nmbd を再起動します。

$ sudo /etc/init.d/smbd restart
$ sudo /etc/init.d/nmbd restart

PC側でエクスプローラのアドレスバーに以下のように入力します。

\\nano-2gb-jp441.local\jetbot
または
\\JetBotのアドレス\jetbot

これで、JetBotのjetbotアカウントのホームディレクトリが見えます。

Macでは、”コマンドキー? + K” で出てくるダイアログのアドレスに

smb://nano-2gb-jp441.local/jetbot
または、
smb://JetBotのアドレス/jetbot

と入力すれば、JetBotのjetbotアカウントのホームディレクトリが見えます。

2.2.6. Jetson nanoへの接続方法

以下にJetson nanoへの接続方法TIPSを掲載します。

$ ssh [ユーザ名]@[ipアドレス]

見つからない場合、以下の手順をためすこと

2.3. RaspberryPi Mouse (実機)

RaspberryPi Mouseを扱う注意点などは以下を参考にしてください。

2.4. myCobot

簡単な動作確認であれば上記のページでできますが、新規開発したRTCで利用するためにはサービスポートを定義する必要があります。

ロボットアーム共通インターフェースで定義されている、MiddleインターフェースとCommonインターフェースを使用します。

まず、以下のように、Middleインターフェースに対応したサービスポート(middle)、Commonインターフェースに対応したサービスポート(common)の2つを作成します。

image

まず、middleのサービスポートにコンシューマ側(Required型)のサービスインターフェースを追加して、インターフェース型にJARA_ARM::ManipulatorCommonInterface_Middleを指定します。

image

次にcommonのサービスポートにコンシューマ側(Required型)のサービスインターフェースを追加して、インターフェース型にJARA_ARM::ManipulatorCommonInterface_Commonを指定します。

image

これでコード生成すれば、ロボットアームを操作するためのサービスポートがRTCに追加されます。

あとは以下のようなサンプルプログラムを参考にして作成してください。

※Python 3.10以降の場合について、エラーが発生する場合があるため、{Pythonのインストールディレクトリ}\Lib\site-packages\math3d\utils.pyを修正してください。 Pythonのインストールディレクトリは以下のコマンドで確認してください。

> where python

utils.pyの以下の2か所を修正してください。

    #return isinstance(obj, collections.Iterable) #修正前
    return isinstance(obj, collections.abc.Iterable) #修正後
    #return isinstance(obj, collections.Iterable) and len(obj) == 3 #修正前
    return isinstance(obj, collections.abc.Iterable) and len(obj) == 3 #修正後

2.5. Kobuki

まず、Raspberry PiをKobikiのUSBポートと電源に接続します。

手順としては、KobukiのRaspberry Piがアクセスポイントとなるため、そこに無線LANで接続します。SSID、パスワードはRaspberry Piのケース(9cm×6cm×3cm程度の白いケース)に貼ったシールに記載してあります。 この辺の手順はRaspberryPi Mouseと同様なため、リンク先を参考にしてください。

RTSystemEditorで192.168.11.1のネームサーバーに接続するとKobukiAISTのRTCが見えるようになります。

Kobukiを扱う注意点などは以下を参考にしてください。

2.6. レゴ マインドストームEV3

EV3を扱う注意点などは以下を参考にしてください。

2.7. TurtleBot3 Burger

2.8. micro:bit スターターキット

2.9. intel RealSense

2.10. myAGV

以下のドキュメントに従って、myAGVにディスプレイ、キーボード、マウスを接続してください。

電源をオンにする前に充電が必要です。

電源をオンにすると、myAGV搭載のRaspberry Pi4でUbuntuが起動します。 まず、ディスプレイに何も表示されていない状態になるため、Ctrl+Alt+F1キーを入力してCUIを起動します。 次に以下のユーザー名、パスワードを入力してください。

ドキュメントの手順に従って、無線LANに接続してください。

次に以下のコマンドでwlan0のIPアドレスを確認してください。

> ip addr

myAGVのUbuntuにリモートログインします。 以下のTeraTermをインストールしてください。sshコマンド等の他のツールでログインする場合は不要です。

TeraTermを起動して、先ほど調べたIPアドレスを指定してSSH接続してください。

以下の手順で動作確認できます。 まず、TeraTermは複数ウィドウを開く必要があるため、ログイン中のTeraTermでAlt+Dキーを入力してください。

片方のウィンドウで以下のコマンドを入力します。

> cd myagv_ros
> roslaunch myagv_odometry myagv_active.launch

もう片方のウィンドウで以下のコマンドを入力します。

> cd myagv_ros
> roslaunch myagv_teleop myagv_teleop.launch

myagv_teleopを起動した側のウィンドウのキー入力でmyAGVが操作できます。

有線LANを使う場合について、起動時にeth0のネットワークインターフェースは無効になっているため、以下のコマンドで有効にしてください。

> ifconfig eth0 up

RTCとmyagv_odometryノードが通信するためには、以下のROSTransportをインストールしてください。

OpenRTM-aist 2.0.1ではROSTransportConfig.cmakeのインストール先が間違っているため、以下のコマンドでコピーしてください。

> sudo mkdir /usr/local/lib/rostransport-2.0
> sudo cp /usr/lib/x86_64-linux-gnu/openrtm-2.0/cmake/ROSTransportConfig.cmake /usr/local/lib/rostransport-2.0/

以下のコマンドでTimedVelocity2D型とTwist型変換シリアライザをインストールします。

> cd ~
> git clone https://github.com/Nobu19800/testROSTransport
> cd testROSTransport/TimedVelocity2DTwistSerializer
> mkdir build
> cd build
> cmake ..
> make
> sudo make install

TurtlesimでTimedVelocity2DTwistSerializerの動作確認してみます。 以下のコマンドでテスト用のRTCをビルドしてください。

> cd ~/testROSTransport/testVelocity2D
> mkdir build
> cd build
> cmake ..
> make

次に以下のコマンドでTurtlesimを起動します。

> rosrun turtlesim turtlesim_node

以下のコマンドでtestVelocity2Dコンポーネントを起動します。

> ~/testROSTransport/testVelocity2D/build/src/testVelocity2DComp -f ~/testROSTransport/testVelocity2D/rtc.conf

以下のコマンドでOpenRTPを起動してください。

> openrtp2

※myAGV搭載のRaspberry Piで確認している場合、Raspberry PiではOpenRTPは起動しないため、別のPCで確認してください。 別のPCで確認する場合は、以下のようにネームサーバー接続ボタンを押して表示された画面からRaspberry PiのIPアドレスを入力してください。

image

RTシステムエディタでtestVelocity2Dコンポーネントのコンフィギュレーションパラメータを編集してください。



スライダーでコンフィギュレーションパラメータを変更すると、TurtleSimのタートルが移動することが確認できます。

ここで、testVelocity2Dコンポーネントを起動したときに使用したrtc.confを確認します。

manager.modules.load_path: /usr/lib/x86_64-linux-gnu/openrtm-2.0/transport/, /usr/local/lib/openrtm-2.0/transport
manager.modules.preload: ROSTransport.so, TimedVelocity2DTwistSerializer.so
manager.components.preconnect: testVelocity2D0.out?interface_type=ros&marshaling_type=ros:geometry_msgs/Twist&ros.topic=turtle1/cmd_vel
manager.components.preactivation: testVelocity2D0

manager.components.preconnectの項目でデータポートの接続の設定をしています。他のSubscriber、Publisherと通信する場合はトピック名を変更してください。myAGVの場合は、cmd_velにすれば接続できるはずです。

manager.components.preconnect: testVelocity2D0.out?interface_type=ros&marshaling_type=ros:geometry_msgs/Twist&ros.topic=turtle1/cmd_vel
#manager.components.preconnect: {コンポーネントのインスタンス名}.{ポート名}?interface_type={インターフェース型}&marshaling_type={シリアライザ名}&ros.topic={トピック名}

PC間で通信する場合は、接続時にros.roscore.hostのプロパティを設定する必要があります。

manager.components.preconnect: testVelocity2D0.out?interface_type=ros&marshaling_type=ros:geometry_msgs/Twist&ros.topic=turtle1/cmd_vel&ros.roscore.host=192.168.11.1
#manager.components.preconnect: {コンポーネントのインスタンス名}.{ポート名}?interface_type={インターフェース型}&marshaling_type={シリアライザ名}&ros.topic={トピック名}&ros.roscore.host={roscoreを起動したPCのIPアドレス}

2.11. CRANE

2.12. Leap Motion

2.13. ROS Master