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/02 06:17]
Guvalif
specifications:protocol [2015/11/16 03:50]
Guvalif
Line 3: Line 3:
 ======== ========
  
-fix 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. 
 +(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. 
 + 
 + 
 +## Group of Controller Command 
 +### $AN (Apply Native Value) 
 + 
 +|Args     |Roles                     |Min (dec)|Max (dec)|Format               | 
 +|:--------|:-------------------------|:-------:|:-------:|:--------------------| 
 +|DEVICE_ID|Set a device id.          |0        |23       |0 padding,hex,2byte| 
 +|VALUE    |Set to apply native value.|-2048    |2047     |0 padding,hex,3byte| 
 + 
 +*example*:   
 +If you want to apply **1000** to device **10**, send command below. 
 + 
 +``` 
 +$an0a3e8 
 +``` 
 + 
 +### $AD (Apply Diff Value) 
 + 
 +|Args     |Roles                   |Min (dec)|Max (dec)|Format               | 
 +|:--------|:-----------------------|:-------:|:-------:|:--------------------| 
 +|DEVICE_ID|Set a device id.        |0        |23       |0 padding,hex,2byte| 
 +|VALUE    |Set to apply diff value.|-2048    |2047     |0 padding,hex,3byte| 
 + 
 +*example*:   
 +If you want to apply **home value - 100** to device **4**, send command below. 
 + 
 +``` 
 +$ad04f9c 
 +``` 
 + 
 +### $PM (Play a Motion) 
 + 
 +**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,2byte| 
 + 
 +*example*:   
 +If you want to play slot **4**, send command below. 
 + 
 +``` 
 +$pm04 
 +``` 
 + 
 +### $SM (Stop a Motion) 
 + 
 +**Attention!**   
 +You could also use "$MS", but this is **[[deprecated]]**. 
 + 
 +*example*:   
 +If you want to stop a motion, send command below. 
 + 
 +``` 
 +$sm 
 +``` 
 + 
 +### $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,2byte| 
 +|LOOP_COUNT|Set number of play.|0        |255      |0 padding,hex,2byte| 
 + 
 +*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 
 +### >IN (Install a Motion) 
 + 
 +**Attention!**   
 +This is **[[deprecated]]**. Obsolescent at firmware version 2.x. 
 +Please using **>MH** and **>MF** that are described after basically. 
 + 
 +|Args              |Roles                        |Min (dec)|Max (dec)|Format                     | 
 +|:-----------------|:----------------------------|:-------:|:-------:|:--------------------------| 
 +|SLOT              |Set to write slot.           |0        |89       |0 padding,hex,2byte      | 
 +|NAME              |Set a motion name.           |---      |---      |white space padding,20byte| 
 +|FUNC              |Set a function. (*1)         |0        |255      |0 padding,hex,2byte      | 
 +|ARG0              |Set a function's arg 0. (*1) |0        |255      |0 padding,hex,2byte      | 
 +|ARG1              |Set a function's arg 1. (*1) |0        |255      |0 padding,hex,2byte      | 
 +|FRAME_LENGTH      |Set a frame length.          |1        |20       |0 padding,hex,2byte      | 
 +|TRANSITION_TIME_MS|Set a transition time (msec).|32       |65535    |0 padding,hex,4byte      | 
 +|VALUE[DEVICE_ID]  |Set to apply value. (*2)     |-32768   |32767    |0 padding,hex,4byte      | 
 + 
 +**(*1) Type of function and role of args are described below.** 
 + 
 +|"FUNC"'s Values|Roles                                                    | 
 +|:--------------|:--------------------------------------------------------| 
 +|0              |---                                                      | 
 +|1              |Play a motion with infinite loop between arg 0 and arg 1.| 
 +|2              |Jump to arg 0 if then stopped the motion.                | 
 + 
 +**(*2) Sum of devices is 24 and all are servo motor.** 
 + 
 +*example*:   
 +Let install a motion below. 
 + 
 +|Args              |Values| 
 +|:-----------------|:-----| 
 +|SLOT              |0     | 
 +|NAME              |Test  | 
 +|FUNC              |0     | 
 +|ARG0              |0     | 
 +|ARG1              |0     | 
 +|FRAME_LENGTH      |2     | 
 +|TRANSITION_TIME_MS|100   | 
 +|OUTPUT[EVEN]      |0     | 
 +|OUTPUT[ODD]       |-1    | 
 + 
 +Please send command below. (There are no CR, LF, or CRLF actually.) 
 + 
 +``` 
 +>in 
 +00Test                00000002 
 +0064 
 +0000ffff0000ffff0000ffff0000ffff 
 +0000ffff0000ffff0000ffff0000ffff 
 +0000ffff0000ffff0000ffff0000ffff 
 +0064 
 +0000ffff0000ffff0000ffff0000ffff 
 +0000ffff0000ffff0000ffff0000ffff 
 +0000ffff0000ffff0000ffff0000ffff 
 +``` 
 + 
 +### >MH (Set a Motion Header) 
 + 
 +|Args        |Roles                       |Min (dec)|Max (dec)|Format                     | 
 +|:-----------|:---------------------------|:-------:|:-------:|:--------------------------| 
 +|SLOT        |Set to write slot.          |0        |89       |0 padding,hex,2byte      | 
 +|NAME        |Set a motion name.          |---      |---      |white space padding,20byte| 
 +|FUNC        |Set a function. (*1)        |0        |255      |0 padding,hex,2byte      | 
 +|ARG0        |Set a function's arg 0. (*1)|0        |255      |0 padding,hex,2byte      | 
 +|ARG1        |Set a function's arg 1. (*1)|0        |255      |0 padding,hex,2byte      | 
 +|FRAME_LENGTH|Set a frame length          |1        |20       |0 padding,hex,2byte      | 
 + 
 +Please get more detail at ">IN" section. 
 + 
 +### >MF (Set a Motion Frame) 
 + 
 +|Args              |Roles                        |Min (dec)|Max (dec)|Format               | 
 +|:-----------------|:----------------------------|:-------:|:-------:|:--------------------| 
 +|SLOT              |Set to write slot.           |0        |89       |0 padding,hex,2byte| 
 +|FRAME_ID          |Set a frame id.              |1        |20       |0 padding,hex,2byte| 
 +|TRANSITION_TIME_MS|Set a transition time (msec).|32       |65535    |0 padding,hex,4byte| 
 +|VALUE[DEVICE_ID]  |Set to apply value. (*2)     |-32768   |32767    |0 padding,hex,4byte| 
 + 
 +Please get more detail at ">IN" section. 
 + 
 +### >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,2byte| 
 +|VALUE    |Set to apply home value.|-2048    |2047     |0 padding,hex,3byte| 
 + 
 +*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,2byte| 
 +|VALUE    |Set to apply max value.|-2048    |2047     |0 padding,hex,3byte| 
 + 
 +*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,2byte| 
 +|VALUE    |Set to apply min value.|-2048    |2047     |0 padding,hex,3byte| 
 + 
 +*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. 
 + 
 +``` 
 +
 +
 + "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,2byte| 
 + 
 +*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/plenproject/PLEN2/tree/master/motion)) 
 +However, property "device"'s type is not **string** but **integer** defined as device id in "[device_map.json](https://github.com/plenproject/plen__control_server/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)