LoginSignup
9
9

More than 5 years have passed since last update.

Pepper実機かバーチャルロボットかの判定方法

Last updated at Posted at 2015-01-18

はじめに

  • みなさん、Pepper実機かバーチャルロボットかの判定ってどうしているのしょうか?
  • とりあえず、以下のようにバーチャルロボットでは失敗する処理で判定できそうな気がするのですが、もっとそれ用の何かないのでしょうか。
  • その2 「Get Name」が良さそうな感じでしょうか。
  • Pepper実機では未確認です。

その1 判定用ボックスの作成

Python ボックスを作成して、バーチャルロボットでは失敗する処理を例外で拾います。

2015011901.png

    def onInput_onStart(self):
        try:
            ALProxy("ALMemory").getData("Device/DeviceList/ChestBoard/BodyId")
            self.onResult("Yes")
        except Exception as e:
            self.onResult("No")

バーチャルロボットで実行した場合、ログビューアに "No" と表示されました。

[INFO ] behavior.box :onInput_message:27 _Behavior__lastUploadedChoregrapheBehaviorbehavior_1140606581456304__root__Log_1: Message text: No

その2 「Get Body ID」「Get Name」ボックスを使用

その1 を試してから気づいたのですが、advanced タブに「Get Body ID」「Get Name」ボックスというのがありました。

2015011902.png

Get Body ID はエラーになりますが、それぞれ「NoBodyID」「virtual-robot」と表示され、これで判定できそうですね。

[INFO ] behavior.box :onInput_message:27 _Behavior__lastUploadedChoregrapheBehaviorbehavior_1140606578425744__root__Log_1: Message text: NoBodyID
[INFO ] behavior.box :onInput_message:27 _Behavior__lastUploadedChoregrapheBehaviorbehavior_1140606578425744__root__Log_1: Message text: virtual-robot

感想

  • 何でもっとはやく「Get ...」ボックスに気づかなかったのか。
9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9