Sphero - masaru-takano/DeviceConnect-Spec GitHub Wiki

概要

Spheroに搭載されているセンサーの値を通知するプロファイル。

目次

API 概要
GET /gotapi/sphero/collision/onCollision Spheroの衝突イベントを取得する。
PUT /gotapi/sphero/collision/onCollision Spheroの衝突イベントの受信を開始する。
DELETE /gotapi/sphero/collision/onCollision 当該イベントの通知を停止する。
GET /gotapi/sphero/locator/onLocator Spheroの位置と速度を通知するイベントを取得する。
PUT /gotapi/sphero/locator/onLocator Spheroの位置と速度を通知するイベントの受信を開始する。
DELETE /gotapi/sphero/locator/onLocator 当該イベントの通知を停止する。
GET /gotapi/sphero/quaternion/onQuaternion Spheroの四元数を通知するイベントを取得する。
PUT /gotapi/sphero/quaternion/onQuaternion Spheroの四元数を通知するイベントの受信を開始する。
DELETE /gotapi/sphero/quaternion/onQuaternion 当該イベントの通知を停止する。

種別

one-shot

概要

Spheroの衝突イベントを取得する。

プラグイン側でキャッシュしている最新のイベントメッセージを1つ取得する。

リクエスト

物理名 データ型 必須 説明
serviceId string Yes サービスID。

レスポンス

物理名 データ型 必須 説明
result integer Yes 0:正常応答
0以外:異常応答
collision object Yes 衝突イベントオブジェクト。
impactAcceleration object No 衝突加速度。
x float Yes x軸方向への加速度(cm/s2)
y float Yes y軸方向への加速度(cm/s2)
z float Yes z軸方向への加速度(cm/s2)
impactAxis object No 衝突軸。
x boolean Yes x軸成分。
y boolean Yes y軸成分。
impactPower object No 衝突力。
x float Yes x軸成分。
y float Yes y軸成分。
impactSpeed float No 衝突速度(単位: cm/s)
impactTimestamp long No 衝突した時間のタイムスタンプ(単位: ミリ秒)
product string Yes DeviceConnectシステムの名前。
version string Yes DeviceConnectシステムのバージョン名。
hmac string No レスポンスに対する署名。アプリケーション側から事前にHMACキーを共有されていた場合は必須。

レスポンスサンプル

{
  "result" : 0,
  "product" : "Example System",
  "version" : "1.0.0",
  "collision" : {
    "impactAxis" : {
      "x" : true,
      "y" : false
    },
    "impactPower" : {
      "x" : 152,
      "y" : 75
    },
    "impactSpeed" : 0,
    "impactTimestamp" : 1483241696789,
    "impactAcceleration" : {
      "x" : -1.57421875,
      "y" : -1.53076171875,
      "z" : 0
    }
  }
}

種別

event

概要

Spheroの衝突イベントの受信を開始する。

リクエスト

物理名 データ型 必須 説明
serviceId string Yes サービスID。
interval long No イベント受信間隔。単位:mSec

レスポンス

物理名 データ型 必須 説明
result integer Yes 0:正常応答
0以外:異常応答
product string Yes DeviceConnectシステムの名前。
version string Yes DeviceConnectシステムのバージョン名。
hmac string No レスポンスに対する署名。アプリケーション側から事前にHMACキーを共有されていた場合は必須。

レスポンスサンプル

{
  "result" : 0,
  "product" : "Example System",
  "version" : "1.0.0"
}

イベント

物理名 データ型 必須 説明
collision object Yes 衝突イベントオブジェクト。
impactAcceleration object No 衝突加速度。
x float Yes x軸方向への加速度(cm/s2)
y float Yes y軸方向への加速度(cm/s2)
z float Yes z軸方向への加速度(cm/s2)
impactAxis object No 衝突軸。
x boolean Yes x軸成分。
y boolean Yes y軸成分。
impactPower object No 衝突力。
x float Yes x軸成分。
y float Yes y軸成分。
impactSpeed float No 衝突速度(単位: cm/s)
impactTimestamp long No 衝突した時間のタイムスタンプ(単位: ミリ秒)
attribute string Yes アトリビュート名。
serviceId string Yes 0:正常応答
0以外:異常応答
interface string Yes インターフェース名。
profile string Yes プロファイル名。

イベントサンプル

{
  "serviceId" : "Host.dummyId.localhost.deviceconnect.org",
  "profile" : "sphero",
  "interface" : "collision",
  "attribute" : "oncollision",
  "collision" : {
    "impactAxis" : {
      "x" : true,
      "y" : false
    },
    "impactPower" : {
      "x" : 152,
      "y" : 75
    },
    "impactSpeed" : 0,
    "impactTimestamp" : 1483241696789,
    "impactAcceleration" : {
      "x" : -1.57421875,
      "y" : -1.53076171875,
      "z" : 0
    }
  }
}

種別

event

概要

当該イベントの通知を停止する。

リクエスト

物理名 データ型 必須 説明
serviceId string Yes サービスID。

レスポンス

物理名 データ型 必須 説明
result integer Yes 0:正常応答
0以外:異常応答
product string Yes DeviceConnectシステムの名前。
version string Yes DeviceConnectシステムのバージョン名。
hmac string No レスポンスに対する署名。アプリケーション側から事前にHMACキーを共有されていた場合は必須。

レスポンスサンプル

{
  "result" : 0,
  "product" : "Example System",
  "version" : "1.0.0"
}

種別

one-shot

概要

Spheroの位置と速度を通知するイベントを取得する。

プラグイン側でキャッシュしている最新のイベントメッセージを1つ取得する。

リクエスト

物理名 データ型 必須 説明
serviceId string Yes サービスID。

レスポンス

物理名 データ型 必須 説明
result integer Yes 0:正常応答
0以外:異常応答
product string Yes DeviceConnectシステムの名前。
version string Yes DeviceConnectシステムのバージョン名。
locator object Yes Spheroの位置座標オブジェクト。
positionX float Yes 位置のx座標 (単位: cm)
positionY float Yes 位置のy座標 (単位: cm)
velocityX float Yes 速度のx成分 (単位:cm/s)
velocityY float Yes 速度のy成分 (単位:cm/s)
hmac string No レスポンスに対する署名。アプリケーション側から事前にHMACキーを共有されていた場合は必須。

レスポンスサンプル

{
  "result" : 0,
  "product" : "Example System",
  "version" : "1.0.0",
  "locator" : {
    "positionX" : -3,
    "positionY" : 5,
    "velocityX" : -10,
    "velocityY" : -1.5
  }
}

種別

event

概要

Spheroの位置と速度を通知するイベントの受信を開始する。

リクエスト

物理名 データ型 必須 説明
serviceId string Yes サービスID。
interval long No イベント受信間隔。単位:mSec

レスポンス

物理名 データ型 必須 説明
result integer Yes 0:正常応答
0以外:異常応答
product string Yes DeviceConnectシステムの名前。
version string Yes DeviceConnectシステムのバージョン名。
hmac string No レスポンスに対する署名。アプリケーション側から事前にHMACキーを共有されていた場合は必須。

レスポンスサンプル

{
  "result" : 0,
  "product" : "Example System",
  "version" : "1.0.0"
}

イベント

物理名 データ型 必須 説明
attribute string Yes アトリビュート名。
serviceId string Yes 0:正常応答
0以外:異常応答
interface string Yes インターフェース名。
locator object Yes Spheroの位置座標オブジェクト。
positionX float Yes 位置のx座標 (単位: cm)
positionY float Yes 位置のy座標 (単位: cm)
velocityX float Yes 速度のx成分 (単位:cm/s)
velocityY float Yes 速度のy成分 (単位:cm/s)
profile string Yes プロファイル名。

イベントサンプル

{
  "serviceId" : "Host.dummyId.localhost.deviceconnect.org",
  "profile" : "sphero",
  "interface" : "locator",
  "attribute" : "onlocator",
  "locator" : {
    "positionX" : -3,
    "positionY" : 5,
    "velocityX" : -10,
    "velocityY" : -1.5
  }
}

種別

event

概要

当該イベントの通知を停止する。

リクエスト

物理名 データ型 必須 説明
serviceId string Yes サービスID。

レスポンス

物理名 データ型 必須 説明
result integer Yes 0:正常応答
0以外:異常応答
product string Yes DeviceConnectシステムの名前。
version string Yes DeviceConnectシステムのバージョン名。
hmac string No レスポンスに対する署名。アプリケーション側から事前にHMACキーを共有されていた場合は必須。

レスポンスサンプル

{
  "result" : 0,
  "product" : "Example System",
  "version" : "1.0.0"
}

種別

one-shot

概要

Spheroの四元数を通知するイベントを取得する。

プラグイン側でキャッシュしている最新のイベントメッセージを1つ取得する。

リクエスト

物理名 データ型 必須 説明
serviceId string Yes サービスID。

レスポンス

物理名 データ型 必須 説明
result integer Yes 0:正常応答
0以外:異常応答
product string Yes DeviceConnectシステムの名前。
quaternion object Yes 四元数オブジェクト。
q0 float Yes i軸
q1 float Yes j軸
q2 float Yes k軸
q3 float Yes s軸
interval long Yes 計測のインターバル。(単位: ミリ秒)
version string Yes DeviceConnectシステムのバージョン名。
hmac string No レスポンスに対する署名。アプリケーション側から事前にHMACキーを共有されていた場合は必須。

レスポンスサンプル

{
  "result" : 0,
  "product" : "Example System",
  "version" : "1.0.0",
  "quaternion" : {
    "q0" : 0.9998000264167786,
    "q1" : -0.0027000000700354576,
    "q2" : -0.010099999606609344,
    "q3" : 0.010900000110268593,
    "interval" : 220
  }
}

種別

event

概要

Spheroの四元数を通知するイベントの受信を開始する。

リクエスト

物理名 データ型 必須 説明
serviceId string Yes サービスID。
interval long No イベント受信間隔。単位:mSec

レスポンス

物理名 データ型 必須 説明
result integer Yes 0:正常応答
0以外:異常応答
product string Yes DeviceConnectシステムの名前。
version string Yes DeviceConnectシステムのバージョン名。
hmac string No レスポンスに対する署名。アプリケーション側から事前にHMACキーを共有されていた場合は必須。

レスポンスサンプル

{
  "result" : 0,
  "product" : "Example System",
  "version" : "1.0.0"
}

イベント

物理名 データ型 必須 説明
attribute string Yes アトリビュート名。
serviceId string Yes 0:正常応答
0以外:異常応答
interface string Yes インターフェース名。
quaternion object Yes 四元数オブジェクト。
q0 float Yes i軸
q1 float Yes j軸
q2 float Yes k軸
q3 float Yes s軸
interval long Yes 計測のインターバル。(単位: ミリ秒)
profile string Yes プロファイル名。

イベントサンプル

{
  "serviceId" : "Host.dummyId.localhost.deviceconnect.org",
  "profile" : "sphero",
  "interface" : "quaternion",
  "attribute" : "onquaternion",
  "quaternion" : {
    "q0" : 0.9998000264167786,
    "q1" : -0.0027000000700354576,
    "q2" : -0.010099999606609344,
    "q3" : 0.010900000110268593,
    "interval" : 220
  }
}

種別

event

概要

当該イベントの通知を停止する。

リクエスト

物理名 データ型 必須 説明
serviceId string Yes サービスID。

レスポンス

物理名 データ型 必須 説明
result integer Yes 0:正常応答
0以外:異常応答
product string Yes DeviceConnectシステムの名前。
version string Yes DeviceConnectシステムのバージョン名。
hmac string No レスポンスに対する署名。アプリケーション側から事前にHMACキーを共有されていた場合は必須。

レスポンスサンプル

{
  "result" : 0,
  "product" : "Example System",
  "version" : "1.0.0"
}
⚠️ **GitHub.com Fallback** ⚠️