User Tools

Site Tools


Sidebar

Translations of this page:

====== Menu ====== ===== Introductions ===== * [[concept]] * [[about]] * [[laws]] * [[license]] ===== Documents ===== * [[tutorials/index.html]] * [[specifications/index.html]] * [[api_guides/index.html]] * [[faq/index.html]] * [[https://github.com/plenprojectcompany|Resources on the GitHub]] ===== Social Accounts ===== * [[https://ja-jp.facebook.com/PlenProjectCommittee|Facebook Page]] * [[https://twitter.com/plen_project|Twitter]] * [[https://www.instagram.com/plenproject/|Instagram]] * [[https://www.youtube.com/channel/UCoKNQe4Vb5Fa0D00bYLEFJQ|Youtube Channel]] ===== Etc ===== * [[sitepolicy]] * [[editing]] * [[https://www.dokuwiki.org/wiki:syntax|Syntax]]

specifications:uri

This is an old revision of the document!


FIXME This page is not fully translated, yet. Please help completing the translation.
(remove this paragraph once the translation is finished)

URI Definition

基本仕様

コントロールサーバーのホストは通常"localhost (127.0.0.1)"であり、 ポートはconfig.json内のportプロパティに従って決定されます。(規定値は17264です。)

コントロールサーバーはREST APIを提供し、ユーザーは以下の書式により、 各種リソースやコマンドを使用することができます。

http://<HOST>:<PORT>/<VERSION>/<INSTANCE>/...(/<METHOD>)

<VERSION>はAPIのバージョンを表す文字列であり、アプリケーション自体のメジャーバージョンに追随します。 (例: ControlServer_Win_v2.0.1であれば、v2となります。)

リソース取得時に返却されるJSONのフォーマット

GETリクエストを実行した際、以下のようなJSONが返却されます。

{
    "resource": <RESOURCE_NAME:string>,
    "data": <DATA:json>
}

コマンド実行時に返却されるJSONのフォーマット

GET以外のHTTPリクエスト,および各種コマンドを実行した際、以下のようなJSONが返却されます。

{
    "resource": <RESOURCE_NAME:string>,
    "data": {
        "command": <COMMAND_NAME:string>,
        "result": <RESULT:boolean>
    }
}

リソース一覧

コマンドラインストリーム (cmdstream)

WebSocketを用いてPLENを操作するストリームリソースを提供します。

コマンド名と各引数を/ (スラッシュ)で区切って送信することで、 Pythonで実装されているコマンドを直接呼び出すことが可能です。 (参考)

var socket = new WebSocket('ws://localhost:17264/v2/cmdstream');

socket.send('<METHOD_NAME>/<PARAM_0>/<PARAM_1>/...');

戻り値は、Python上での各コマンドの戻り値を文字列化したものです。

モーション (motions)

PLENの動作を定義するモーションリソースを提供します。 <SLOT:integer>にはアクセスしたいモーションリソースのスロット番号を指定します。

http://localhost:17264/v2/motions/<SLOT:integer>
HTTPリクエスト 動作
GET モーションリソースを取得します。
DELETE モーションリソースを削除します。(空のモーションを書き込みます。)
PUT モーションリソースを上書きします。
http://localhost:17264/v2/motions/<SLOT:integer>/play
http://localhost:17264/v2/motions/stop
コマンド 動作
play モーションを再生します。
stop モーションを停止します。

バージョン情報 (version)

PLEN本体のバージョン情報に関するリソースを提供します。

http://localhost:17264/v2/version
HTTPリクエスト 動作
GET バージョン情報リソースを取得します。

サーバー構成情報 (metadata)

以下のようなサーバー構成情報に関するリソースを提供します。

  • APIのバージョン
  • 要求するPLENのファームウェアバージョン
http://localhost:17264/v2/metadata
HTTPリクエスト 動作
GET サーバー構成情報リソースを取得します。

単独実行可能コマンド一覧

PLENへの接続 (connect)

http://localhost:17264/v2/connect

PLENからの切断 (disconnect)

http://localhost:17264/v2/disconnect
specifications/uri.1469438500.txt.gz · Last modified: 2021/04/01 13:51 (external edit)