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/06/28 17:55]
guvalif
specifications:protocol [2017/01/05 01:43]
Guvalif
Line 1: Line 1:
 <markdown> <markdown>
-プロトコル仕様書 +Protocol 
-================+===============================================================================
  
-## 基本仕様 +## Basic Specification 
-命令を送信するにあたり、3文字で定義された命令をまず送信し、 +In sending a command, firstly send header that defined as characters. 
-それに続いて各構成要素を定められたフォーマットのもと順次送信していきます。+Secondly formatting and send each argument.
  
-クライアント側では全ての表現を文字列にしてから送信する必要があります。 +Before sending a command, client must convert binary-expression to ascii-expression. 
-(バイナリをそのまま送信した場合、意図しない動作をすることがあります。)+(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**.
  
-## システム関連 
-**#IN** (モーションデータのインストール) 
  
-|タグ    |役割                  |最小値(dec)|最大値(dec)|フォーマット            | +## Group of Controller Command 
-|:-------|:---------------------|:---------:|:---------:|:-----------------------| +### $AN (Apply Native Value)
-|slotNum |書き込みスロットの指定|0          |99         |0埋め,16進数表現,2byte| +
-|name    |モーション名の指定    |---        |---        |空白埋め,20byte        | +
-|function|制御機能の指定        |0          |255        |0埋め,16進数表現,2byte| +
-|param0  |制御機能に渡す引数1   |0          |255        |0埋め,16進数表現,2byte| +
-|param1  |制御機能に渡す引数2   |0          |255        |0埋め,16進数表現,2byte| +
-|frameNum|フレーム総数の指定    |1          |20         |0埋め,16進数表現,2byte| +
-|frame   |フレーム構成要素の指定|-1800      |1800       |0埋め,16進数表現,4byte|+
  
-- - -+|Args     |Roles                     |Min (dec)|Max (dec)|Format                 | 
 +|:--------|:-------------------------|:-------:|:-------:|:----------------------| 
 +|DEVICE_ID|Set a device id.          |0        |23       |0 padding,hex,2 bytes| 
 +|VALUE    |Set to apply native value.|-2048    |2047     |0 padding,hex,3 bytes|
  
-**#MI** (関節可動域最小値の設定),   +*example*  
-**#MA** (関節可動域最大値の設定),   +If you want to apply **1000** to device **10**, send command below.
-**#HO** (関節初期位置の設定),   +
-**#SA** (関節可動命令)+
  
-|タグ    |役割                |最小値(dec)|最大値(dec)|フォーマット            | +``` 
-|:-------|:-------------------|:---------:|:---------:|:-----------------------| +$an0a3e8 
-|jointNum|関節番号の指定      |0          |23         |0埋め,16進数表現,2byte| +```
-|angle   |角度の指定          |0          |1800       |0埋め,16進数表現,3byte|+
  
-- - -+### $AD (Apply Diff Value)
  
-**###** (読み込みシリアルのトグル)+|Args     |Roles                   |Min (dec)|Max (dec)|Format                 | 
 +|:--------|:-----------------------|:-------:|:-------:|:----------------------| 
 +|DEVICE_ID|Set a device id.        |0        |23       |0 padding,hex,2 bytes| 
 +|VALUE    |Set to apply diff value.|-2048    |2047     |0 padding,hex,3 bytes|
  
-- -+*example*:   
 +If you want to apply **home value 100** to device **4**, send command below.
  
-**#DJ** (関節設定のダンプコマンド)+``` 
 +$ad04f9c 
 +```
  
-- - -+### $PM (Play a Motion)
  
-**#SJ** (関節設定の書き込みコマンド)+**Attention!**   
 +You could also use "$MP", but this is **deprecated**.
  
-- - -+|Args|Roles            |Min (dec)|Max (dec)|Format                 | 
 +|:---|:----------------|:-------:|:-------:|:----------------------| 
 +|SLOT|Set to read slot.|0        |89       |0 padding,hex,2 bytes|
  
-**#DM** (モーションのダンプコマンド)+*example*:   
 +If you want to play slot **4**, send command below.
  
-|タグ   |役割                |最小値(dec)|最大値(dec)|フォーマット            | +``` 
-|:------|:-------------------|:---------:|:---------:|:-----------------------| +$pm04 
-|slotNum|読出しスロットの指定|0          |99         |0埋め,16進数表現,2byte|+```
  
 +### $SM (Stop a Motion)
  
-## モーション関連 +**Attention!**   
-**$MP** (モーションデータの再生)+You could also use "$MS", but this is **deprecated**.
  
-|タグ   |役割              |最小値(dec)|最大値(dec)|フォーマット            | +*example*  
-|:------|:-----------------|:---------:|:---------:|:-----------------------| +If you want to stop a motion, send command below.
-|slotNum|再生スロットの指定|0          |99         |0埋め,16進数表現,2byte|+
  
-- - -+``` 
 +$sm 
 +```
  
-**$MS** (停止命令)+### $HP (Apply Home Position) 
 + 
 +*example*:   
 +If you want to apply home position, send command below. 
 + 
 +``` 
 +$hp 
 +``` 
 + 
 + 
 +## Group of Interpreter Command 
 +### #PU (Push a Function) 
 + 
 +|Args      |Roles              |Min (dec)|Max (dec)|Format                 | 
 +|:---------|:------------------|:-------:|:-------:|:----------------------| 
 +|SLOT      |Set to read slot.  |0        |89       |0 padding,hex,2 bytes| 
 +|LOOP_COUNT|Set number of play.|0        |255      |0 padding,hex,2 bytes| 
 + 
 +*example*:   
 +If you want to push function that plays slot **10** **three** times, send command below. 
 + 
 +``` 
 +#pu0a03 
 +``` 
 + 
 +### #PO (Pop a Function) 
 + 
 +*example*:   
 +If you want to pop a function, send command below. 
 + 
 +``` 
 +#po 
 +``` 
 + 
 +### #RI (Reset the Interpreter) 
 + 
 +*example*:   
 +If you want to reset the interpreter, send command below. 
 + 
 +``` 
 +#ri 
 +``` 
 + 
 + 
 +## Group of Setter Command 
 +### >MH (Set a Motion Header) 
 + 
 +|Args        |Roles                                     |Min (dec)|Max (dec)|Format                       | 
 +|:-----------|:-----------------------------------------|:-------:|:-------:|:----------------------------| 
 +|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        |1        |True (1) or false (0), 1 byte| 
 +|JUMP_SLOT   |Jump to the slot after stopped the motion.|0        |255      |0 padding,hex,2 bytes      | 
 +|USE_EXTRA   |Use extra function or not. (WIP)          |0        |1        |True (1) or false (0), 1 byte| 
 +|FRAME_LENGTH|Set a frame length.                       |1        |20       |0 padding,hex,2 bytes      | 
 + 
 +*example*:   
 +Please get more details at ">MF" section. 
 + 
 +### >MF (Set a Motion Frame) 
 + 
 +|Args              |Roles                        |Min (dec)|Max (dec)|Format                 | 
 +|:-----------------|:----------------------------|:-------:|:-------:|:----------------------| 
 +|SLOT              |Set to write slot.           |0        |89       |0 padding,hex,2 bytes| 
 +|FRAME_ID          |Set a frame id.              |1        |20       |0 padding,hex,2 bytes| 
 +|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,hex,4 bytes| 
 + 
 +**(*1) Sum of devices is 24 and the all are servo motors in current implementation.** 
 + 
 +*example*   
 +Introduce how to install a motion below. 
 + 
 +|Args              |Values| 
 +|:-----------------|:-----| 
 +|SLOT              |0     | 
 +|NAME              |Test  | 
 +|USE_LOOP          |True  | 
 +|LOOP_BEGIN        |0     | 
 +|LOOP_END          |1     | 
 +|LOOP_COUNT        |3     | 
 +|USE_JUMP          |True  | 
 +|JUMP_SLOT         |50    | 
 +|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.) 
 + 
 +``` 
 +>MH00 
 +Test                 
 +
 +00 
 +01 
 +03 
 +
 +32 
 +
 +02 
 + 
 +>MF 
 +00 
 +00 
 +0064 
 +0000ffff0000ffff0000ffff0000ffff 
 +0000ffff0000ffff0000ffff0000ffff 
 +0000ffff0000ffff0000ffff0000ffff 
 + 
 +>MF 
 +00 
 +01 
 +0064 
 +0000ffff0000ffff0000ffff0000ffff 
 +0000ffff0000ffff0000ffff0000ffff 
 +0000ffff0000ffff0000ffff0000ffff 
 +``` 
 + 
 +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). 
 + 
 +### >JS (Reset the Joint Settings) 
 + 
 +*example*:   
 +If you want to reset the joint settings, send command below. 
 + 
 +``` 
 +>js 
 +``` 
 + 
 +### >HO (Set a Home Value) 
 + 
 +|Args     |Roles                   |Min (dec)|Max (dec)|Format                 | 
 +|:--------|:-----------------------|:-------:|:-------:|:----------------------| 
 +|DEVICE_ID|Set a device id.        |0        |23       |0 padding,hex,2 bytes| 
 +|VALUE    |Set to apply home value.|-2048    |2047     |0 padding,hex,3 bytes| 
 + 
 +*example*:   
 +If you want to apply **100** as home value to device **0**, send command below. 
 + 
 +``` 
 +>ho00064 
 +``` 
 + 
 +### >MA (Set a Max Value) 
 + 
 +|Args     |Roles                  |Min (dec)|Max (dec)|Format                 | 
 +|:--------|:----------------------|:-------:|:-------:|:----------------------| 
 +|DEVICE_ID|Set a device id.       |0        |23       |0 padding,hex,2 bytes| 
 +|VALUE    |Set to apply max value.|-2048    |2047     |0 padding,hex,3 bytes| 
 + 
 +*example*:   
 +If you want to apply **100** as max value to device **0**, send command below. 
 + 
 +``` 
 +>ma00064 
 +``` 
 + 
 +### >MI (Set a Min Value) 
 + 
 +|Args     |Roles                  |Min (dec)|Max (dec)|Format                 | 
 +|:--------|:----------------------|:-------:|:-------:|:----------------------| 
 +|DEVICE_ID|Set a device id.       |0        |23       |0 padding,hex,2 bytes| 
 +|VALUE    |Set to apply min value.|-2048    |2047     |0 padding,hex,3 bytes| 
 + 
 +*example*:   
 +If you want to apply **-1** as min value to device **10**, send command below. 
 + 
 +``` 
 +>mi0afff 
 +``` 
 + 
 +## Group of Getter Command 
 +### <JS (Dump the Joint Settings) 
 + 
 +*example*:   
 +If you want to dump the joint settings, send command below. 
 + 
 +``` 
 +<js 
 +``` 
 + 
 +At that time, outputting result like json below. 
 + 
 +``` 
 +
 +    { 
 +        "@device": <integer>, 
 +        "max": <integer>, 
 +        "min": <integer>, 
 +        "home": <integer> 
 +    }, 
 +    ... 
 +
 +``` 
 + 
 +### <MO (Dump a Motion) 
 + 
 +|Args|Roles            |Min (dec)|Max (dec)|Format                 | 
 +|:---|:----------------|:-------:|:-------:|:----------------------| 
 +|SLOT|Set to read slot.|0        |89       |0 padding,hex,2 bytes| 
 + 
 +*example*:   
 +If you want to dump slot **0**, send command below. 
 + 
 +``` 
 +<mo00 
 +``` 
 + 
 +At that time, outputting result like "motion.json". ([See also...](https://github.com/plenprojectcompany/PLEN2/tree/master/motions)) 
 +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)"
 + 
 +### <VI (Dump the Version Information) 
 + 
 +*example*:   
 +If you want to dump the version information, send command below. 
 + 
 +``` 
 +<vi 
 +``` 
 + 
 +At that time, outputting result like json below. 
 + 
 +``` 
 +
 +    "device": <string>, 
 +    "codename": <string>, 
 +    "version": <string> 
 +
 +```
 </markdown> </markdown>
specifications/protocol.txt · Last modified: 2021/04/01 13:51 (external edit)