User Tools

Site Tools


specifications:protocol

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
specifications:protocol [2015/10/12 02:13]
Guvalif
specifications:protocol [2017/01/05 01:43]
Guvalif
Line 1: Line 1:
 <markdown> <markdown>
 Protocol Protocol
-========+===============================================================================
  
-Translate me.+## Basic Specification 
 +In sending a command, firstly send header that defined as 3 characters. 
 +Secondly formatting and send each argument.
  
-## 基本仕様 +Before sending a command, client must convert binary-expression to ascii-expression. 
-命令を送信するにあたり、3文字で定義されたヘッダをまず送信し、 +(If the client sending a command without conversion, PLEN's moving is different from you intended.)
-それに続いて各構成要素を定められたフォーマットのもと順次送信していきます。+
  
-クライアント側では全ての表現を文字列にしてから送信する必要があります。 +No differences the command line made of upper case or lower case. 
-(バイナリをそのまま送信した場合、意図しない動作をすることがあります。)+Required baud-rate is **2,000,000**.
  
-なお、コマンドラインが大文字か小文字かは区別されません。 
  
 +## Group of Controller Command
 +### $AN (Apply Native Value)
  
-## Controller関連のコマンド +|Args     |Roles                     |Min (dec)|Max (dec)|Format                 
-### $AN (指示値の適用) +|:--------|:-------------------------|:-------:|:-------:|:----------------------| 
- +|DEVICE_ID|Set a device id.          |0        |23       |0 paddinghex2 bytes
-|タグ     |役割                |最小値(dec)|最大値(dec)|フォーマット            +|VALUE    |Set to apply native value.|-2048    |2047     |0 paddinghex3 bytes|
-|:--------|:-------------------|:---------:|:---------:|:-----------------------| +
-|DEVICE_ID|デバイス番号の指定  |0          |23         |0埋め16進数表現2byte+
-|VALUE    |デバイス出力値の指定|-2048      |2047       |0埋め16進数表現3byte|+
  
 *example*:   *example*:  
-デバイス**10****1000**を出力したい場合、送信するコマンドラインは以下の通りです。+If you want to apply **1000** to device **10**, send command below.
  
 ``` ```
Line 30: Line 29:
 ``` ```
  
-### $AD (指示値差分の適用)+### $AD (Apply Diff Value)
  
-|タグ     |役割                |最小値(dec)|最大値(dec)|フォーマット            +|Args     |Roles                   |Min (dec)|Max (dec)|Format                 
-|:--------|:-------------------|:---------:|:---------:|:-----------------------| +|:--------|:-----------------------|:-------:|:-------:|:----------------------| 
-|DEVICE_ID|デバイス番号の指定  |0          |23         |0埋め16進数表現2byte+|DEVICE_ID|Set a device id.        |0        |23       |0 paddinghex2 bytes
-|VALUE    |デバイス出力値の指定|-2048      |2047       |0埋め16進数表現3byte|+|VALUE    |Set to apply diff value.|-2048    |2047     |0 paddinghex3 bytes|
  
 *example*:   *example*:  
-デバイス**4**の初期値に**-100**した値を出力したい場合、送信するコマンドラインは以下の通りです。+If you want to apply **home value - 100** to device **4**, send command below.
  
 ``` ```
Line 44: Line 43:
 ``` ```
  
-### $PM (モーションの再生)+### $PM (Play a Motion)
  
 **Attention!**   **Attention!**  
-後方互換性のために**$MP**も利用可能ですが、[[deprecated]]扱いです。+You could also use "$MP", but this is **deprecated**.
  
-|タグ|役割                  |最小値(dec)|最大値(dec)|フォーマット            +|Args|Roles            |Min (dec)|Max (dec)|Format                 
-|:---|:---------------------|:---------:|:---------:|:-----------------------| +|:---|:----------------|:-------:|:-------:|:----------------------| 
-|SLOT|読み出しスロットの指定|0          |89         |0埋め16進数表現2byte|+|SLOT|Set to read slot.|0        |89       |0 paddinghex2 bytes|
  
 *example*:   *example*:  
-スロット**4**のモーションを再生したい場合、送信するコマンドラインは以下の通りです。+If you want to play slot **4**, send command below.
  
 ``` ```
Line 60: Line 59:
 ``` ```
  
-### $SM (モーションの停止)+### $SM (Stop a Motion)
  
 **Attention!**   **Attention!**  
-後方互換性のために**$MS**も利用可能ですが、[[deprecated]]扱いです。+You could also use "$MS", but this is **deprecated**.
  
 *example*:   *example*:  
-モーションを停止したい場合、送信するコマンドラインは以下の通りです。+If you want to stop a motion, send command below.
  
 ``` ```
Line 72: Line 71:
 ``` ```
  
-### $HP (初期姿勢への移行)+### $HP (Apply Home Position)
  
 *example*:   *example*:  
-初期姿勢に移行したい場合、送信するコマンドラインは以下の通りです。+If you want to apply home position, send command below.
  
 ``` ```
Line 82: Line 81:
  
  
-## Interpreter関連のコマンド +## Group of Interpreter Command 
-### #PU (関数のプッシュ)+### #PU (Push a Function)
  
-|タグ      |役割                  |最小値(dec)|最大値(dec)|フォーマット            +|Args      |Roles              |Min (dec)|Max (dec)|Format                 
-|:---------|:---------------------|:---------:|:---------:|:-----------------------| +|:---------|:------------------|:-------:|:-------:|:----------------------| 
-|SLOT      |読出しスロットの指定  |0          |89         |0埋め16進数表現2byte+|SLOT      |Set to read slot.  |0        |89       |0 paddinghex2 bytes
-|LOOP_COUNT|ループ回数の指定      |0          |255        |0埋め16進数表現2byte|+|LOOP_COUNT|Set number of play.|0        |255      |0 paddinghex2 bytes|
  
 *example*:   *example*:  
-スロット**10**のモーションを**3**回再生する関数をプッシュしたい場合、送信するコマンドラインは以下の通りです。+If you want to push function that plays slot **10** **three** times, send command below.
  
 ``` ```
Line 97: Line 96:
 ``` ```
  
-### #PO (関数のポップ)+### #PO (Pop a Function)
  
 *example*:   *example*:  
-関数をポップしたい場合、送信するコマンドラインは以下の通りです。+If you want to pop a function, send command below.
  
 ``` ```
Line 106: Line 105:
 ``` ```
  
-### #RI (インタプリタの初期化)+### #RI (Reset the Interpreter)
  
 *example*:   *example*:  
-インタプリタを初期化したい場合、送信するコマンドラインは以下の通りです。+If you want to reset the interpreter, send command below.
  
 ``` ```
Line 116: Line 115:
  
  
-## Setter関連のコマンド +## Group of Setter Command 
-### >IN (モーションのインストール)+### >MH (Set a Motion Header)
  
-**Attention!**   +|Args        |Roles                                     |Min (dec)|Max (dec)|Format                       | 
-[[deprecated]]扱いです。ver.1.2.0では廃止予定なので、基本的に後述の**>MH****>MF**を使用してください。+|:-----------|:-----------------------------------------|:-------:|:-------:|:----------------------------| 
 +|SLOT        |Set to write slot.                        |0        |89       |0 padding,hex,2 bytes      | 
 +|NAME        |Set a motion name.                        |---      |---      |White space padding,20 bytes| 
 +|USE_LOOP    |Use loop function or not.                 |0        |1        |True (1) or false (0), 1 byte| 
 +|LOOP_BEGIN  |Set a loop beginning frame.               |0        |255      |0 padding,hex,2 bytes      | 
 +|LOOP_END    |Set a loop ending frame                 |0        |255      |0 padding,hex,2 bytes      | 
 +|LOOP_COUNT  |Set a loop count. (255 as infinity.)      |0        |255      |0 padding,hex,2 bytes      | 
 +|USE_JUMP    |Use jump function or not.                 |0        |       |True (1) or false (0), 1 byte| 
 +|JUMP_SLOT   |Jump to the slot after stopped the motion.|0        |255      |0 padding,hex,bytes      | 
 +|USE_EXTRA   |Use extra function or not(WIP)          |       |1        |True (1) or false (0), 1 byte| 
 +|FRAME_LENGTH|Set a frame length.                       |1        |20       |0 paddinghex,2 bytes      |
  
-|タグ              |役割                     |最小値(dec)|最大値(dec)|フォーマット            | +*example*:   
-|:-----------------|:------------------------|:---------:|:---------:|:-----------------------| +Please get more details at ">MF" section.
-|SLOT              |書き込みスロットの指定   |0          |89         |0埋め,16進数表現,2byte| +
-|NAME              |モーション名の指定       |---        |---        |空白埋め,20byte        | +
-|FUNC              |関数の指定 (*1)          |0          |255        |0埋め,16進数表現,2byte| +
-|ARG0              |制御機能に渡す引数0 (*1) |0          |255        |0埋め,16進数表現,2byte| +
-|ARG1              |制御機能に渡す引数1 (*1) |0          |255        |0埋め,16進数表現,2byte| +
-|FRAME_LENGTH      |フレーム総数の指定       |1          |20         |0埋め,16進数表現,2byte| +
-|TRANSITION_TIME_MS|遷移時間の指定           |32         |65535      |0埋め,16進数表現,4byte| +
-|VALUE[DEVICE_ID]  |デバイス出力値の指定 (*2)|-32768     |32767      |0埋め,16進数表現,4byte|+
  
-**(*1関数の種類と引数の意味は下表の通りです。**+### >MF (Set a Motion Frame)
  
-|"FUNC"の値|機能                                                          +|Args              |Roles                        |Min (dec)|Max (dec)|Format                 
-|:---------|:-------------------------------------------------------------| +|:-----------------|:----------------------------|:-------:|:-------:|:----------------------| 
-|0         |---                                                           +|SLOT              |Set to write slot.           |0        |89       |0 padding,hex,2 bytes
-|1         |loop"ARG0"から"ARG1"までのフレームを無限ループで再生します。+|FRAME_ID          |Set a frame id.              |1        |20       |0 paddinghex,2 bytes
-|2         |jump再生終了後、"ARG0"のモーションを再生します。            |+|TRANSITION_TIME_MS|Set a transition time (msec).|32       |65535    |0 padding,hex,4 bytes| 
 +|VALUE[DEVICE_ID]  |Set to apply value. (*1)     |-32768   |32767    |0 padding,hex4 bytes|
  
-**(*2デバイスの個数は現状24個で、全てサーボモータです。**+**(*1Sum of devices is 24 and the all are servo motors in current implementation.**
  
-*example*  +*example*   
-以下のようなモーションをインストールするとします。+Introduce how to install a motion below.
  
-|タグ              |値  +|Args              |Values
-|:-----------------|:---| +|:-----------------|:-----| 
-|SLOT              |0   +|SLOT              |0     
-|NAME              |Test| +|NAME              |Test  
-|FUNC              |0   +|USE_LOOP          |True  
-|ARG0              |0   +|LOOP_BEGIN        |0     
-|ARG1              |0   +|LOOP_END          |1     
-|FRAME_LENGTH      |2   +|LOOP_COUNT        |3     
-|TRANSITION_TIME_MS|100 +|USE_JUMP          |True  
-|OUTPUT[EVEN]      |0   +|JUMP_SLOT         |50    
-|OUTPUT[ODD]       |-1  |+|USE_EXTRA         |False | 
 +|FRAME_LENGTH      |2     |
  
-その際、送信するコマンドラインは以下の通りです。(改行は実際には必要ありません。)+|Args              |Values| 
 +|:-----------------|:-----| 
 +|TRANSITION_TIME_MS|100   | 
 +|VALUE[EVEN]       |0     | 
 +|VALUE[ODD]        |-1    | 
 + 
 +Please send command below. (Do not need to insert CR, LF, or CRLF actually.)
  
 ``` ```
->in +>MH00 
-00Test                00000002+Test                 
 +
 +00 
 +01 
 +03 
 +
 +32 
 +
 +02 
 + 
 +>MF 
 +00 
 +00
 0064 0064
 0000ffff0000ffff0000ffff0000ffff 0000ffff0000ffff0000ffff0000ffff
 0000ffff0000ffff0000ffff0000ffff 0000ffff0000ffff0000ffff0000ffff
 0000ffff0000ffff0000ffff0000ffff 0000ffff0000ffff0000ffff0000ffff
 +
 +>MF
 +00
 +01
 0064 0064
 0000ffff0000ffff0000ffff0000ffff 0000ffff0000ffff0000ffff0000ffff
Line 173: Line 198:
 ``` ```
  
-### >MH (モーションヘッダの設定)+If you are interested deeply, please see also 
 +[the implementation on the Control Server](https://github.com/plenprojectcompany/plen-ControlServer/blob/master/control_server/protocol/protocol.py).
  
-|タグ        |役割                  |最小値(dec)|最大値(dec)|フォーマット            | +### >JS (Reset the Joint Settings)
-|:-----------|:---------------------|:---------:|:---------:|:-----------------------| +
-|SLOT        |書き込みスロットの指定|0          |89         |0埋め,16進数表現,2byte| +
-|NAME        |モーション名の指定    |---        |---        |空白埋め,20byte        | +
-|FUNC        |関数の指定 (*1)       |0          |255        |0埋め,16進数表現,2byte| +
-|ARG0        |制御機能に渡す引数0   |0          |255        |0埋め,16進数表現,2byte| +
-|ARG1        |制御機能に渡す引数1   |0          |255        |0埋め,16進数表現,2byte| +
-|FRAME_LENGTH|フレーム総数の指定    |1          |20         |0埋め,16進数表現,2byte| +
- +
-細かい仕様については、">IN"と同様です。 +
- +
-### >MF (モーションフレームの設定) +
- +
-|タグ              |役割                     |最小値(dec)|最大値(dec)|フォーマット            | +
-|:-----------------|:------------------------|:---------:|:---------:|:-----------------------| +
-|SLOT              |書き込みスロットの指定   |0          |89         |0埋め,16進数表現,2byte| +
-|FRAME_ID          |書き込みフレームの指定   |0          |19         |0埋め,16進数表現,2byte| +
-|TRANSITION_TIME_MS|遷移時間の指定           |32         |65535      |0埋め,16進数表現,4byte| +
-|VALUE[DEVICE_ID]  |デバイス出力値の指定     |-32768     |32767      |0埋め,16進数表現,4byte| +
- +
-細かい仕様については、">IN"と同様です。 +
- +
-### >JS (関節設定の初期化)+
  
 *example*:   *example*:  
-関節設定を初期化したい場合に、送信するコマンドラインは以下の通りです。+If you want to reset the joint settings, send command below.
  
 ``` ```
Line 206: Line 210:
 ``` ```
  
-### >HO (初期値の設定)+### >HO (Set a Home Value)
  
-|タグ     |役割              |最小値(dec)|最大値(dec)|フォーマット            +|Args     |Roles                   |Min (dec)|Max (dec)|Format                 
-|:--------|:-----------------|:---------:|:---------:|:-----------------------| +|:--------|:-----------------------|:-------:|:-------:|:----------------------| 
-|DEVICE_ID|デバイス番号の指定|0          |23         |0埋め16進数表現2byte+|DEVICE_ID|Set a device id.        |0        |23       |0 paddinghex2 bytes
-|VALUE    |初期値の指定      |-2048      |2047       |0埋め16進数表現3byte|+|VALUE    |Set to apply home value.|-2048    |2047     |0 paddinghex3 bytes|
  
-*example*   +*example*  
-デバイス**0**の初期値を**100**に設定したい場合、送信するコマンドラインは以下の通りです。+If you want to apply **100** as home value to device **0**, send command below.
  
 ``` ```
Line 220: Line 224:
 ``` ```
  
-### >MA (最大値の設定)+### >MA (Set a Max Value)
  
-|タグ     |役割              |最小値(dec)|最大値(dec)|フォーマット            +|Args     |Roles                  |Min (dec)|Max (dec)|Format                 
-|:--------|:-----------------|:---------:|:---------:|:-----------------------| +|:--------|:----------------------|:-------:|:-------:|:----------------------| 
-|DEVICE_ID|デバイス番号の指定|0          |23         |0埋め16進数表現2byte+|DEVICE_ID|Set a device id.       |0        |23       |0 paddinghex2 bytes
-|VALUE    |最大値の指定      |-2048      |2047       |0埋め16進数表現3byte|+|VALUE    |Set to apply max value.|-2048    |2047     |0 paddinghex3 bytes|
  
-*example*   +*example*  
-デバイス**0**の最大値を**100**に設定したい場合、送信するコマンドラインは以下の通りです。+If you want to apply **100** as max value to device **0**, send command below.
  
 ``` ```
Line 234: Line 238:
 ``` ```
  
-### >MI (最小値の設定)+### >MI (Set a Min Value)
  
-|タグ     |役割              |最小値(dec)|最大値(dec)|フォーマット            +|Args     |Roles                  |Min (dec)|Max (dec)|Format                 
-|:--------|:-----------------|:---------:|:---------:|:-----------------------| +|:--------|:----------------------|:-------:|:-------:|:----------------------| 
-|DEVICE_ID|デバイス番号の指定|0          |23         |0埋め16進数表現2byte+|DEVICE_ID|Set a device id.       |0        |23       |0 paddinghex2 bytes
-|VALUE    |最小値の指定      |-2048      |2047       |0埋め16進数表現3byte|+|VALUE    |Set to apply min value.|-2048    |2047     |0 paddinghex3 bytes|
  
-*example*   +*example*  
-デバイス**10**の最小値を**-1**に設定したい場合、送信するコマンドラインは以下の通りです。+If you want to apply **-1** as min value to device **10**, send command below.
  
 ``` ```
Line 248: Line 252:
 ``` ```
  
-## Getter関連のコマンド +## Group of Getter Command 
-### <JS (関節設定のダンプ)+### <JS (Dump the Joint Settings)
  
 *example*:   *example*:  
-関節設定をダンプしたい場合、送信するコマンドラインは以下の通りです。+If you want to dump the joint settings, send command below.
  
 ``` ```
Line 258: Line 262:
 ``` ```
  
-その際、以下のような書式のJSONが出力されます。+At that time, outputting result like json below.
  
 ``` ```
-+
- "settings": +    
- +        "@device": <integer>, 
- "joint": <integer>, +        "max": <integer>, 
- "MAX": <integer>, +        "min": <integer>, 
- "MIN": <integer>, +        "home": <integer> 
- "HOME": <integer> +    }, 
- }, +    ... 
- ... +]
- ] +
-}+
 ``` ```
  
-### <MO (モーションのダンプ)+### <MO (Dump a Motion)
  
-|タグ|役割                |最小値(dec)|最大値(dec)|フォーマット            +|Args|Roles            |Min (dec)|Max (dec)|Format                 
-|:---|:-------------------|:---------:|:---------:|:-----------------------| +|:---|:----------------|:-------:|:-------:|:----------------------| 
-|SLOT|読出しスロットの指定|0          |89         |0埋め16進数表現2byte|+|SLOT|Set to read slot.|0        |89       |0 paddinghex2 bytes|
  
-*example*   +*example*  
-スロット**0**のモーションをダンプしたい場合、送信するコマンドラインは以下の通りです。+If you want to dump slot **0**, send command below.
  
 ``` ```
Line 287: Line 289:
 ``` ```
  
-その際、motion.jsonと同様な形式のJSONが出力されます。 +At that time, outputting result like "motion.json". ([See also...](https://github.com/plenprojectcompany/PLEN2/tree/master/motions)) 
-ただし、"device"に対応する値は**string**ではなく、 +However, property "device"'s type is not **string** but **integer** defined as device id in "[device_map.json](https://github.com/plenprojectcompany/plen-ControlServer/blob/master/control_server/device_map.json)".
-device_map.jsonで定義されているようなIDの**ineteger**です。+
  
-### <VI (バージョン情報のダンプ)+### <VI (Dump the Version Information)
  
 *example*:   *example*:  
-バージョン情報をダンプしたい場合、送信するコマンドラインは以下の通りです。+If you want to dump the version information, send command below.
  
 ``` ```
Line 300: Line 301:
 ``` ```
  
-その際、以下のような書式のJSONが出力されます。+At that time, outputting result like json below.
  
 ``` ```
 { {
- "device": <string>, +    "device": <string>, 
- "codename": <string>, +    "codename": <string>, 
- "version": <string>+    "version": <string>
 } }
 ``` ```
 </markdown> </markdown>
specifications/protocol.txt · Last modified: 2021/04/01 13:51 (external edit)