User Tools

Site Tools


doc:crazyflie:crtp:param

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
doc:crazyflie:crtp:param [2015-10-26 18:24]
arnaud
doc:crazyflie:crtp:param [2015-12-10 09:46]
arnaud [Set by name]
Line 2: Line 2:
 The parameters system makes all the gettable and settable parameters of the copter accessible. The copter holds a table of parameters which can be retrieved. In this table every parameter name is associated with an ID and a group name. Three IDs are used to acces the TOC and the parameters: The parameters system makes all the gettable and settable parameters of the copter accessible. The copter holds a table of parameters which can be retrieved. In this table every parameter name is associated with an ID and a group name. Three IDs are used to acces the TOC and the parameters:
  
-^ Port      ^ Channel     ^ Function          ^ + Port   Channel  ^ Function          ^ 
-|  2        | 0           | TOC access        | +|  2             | [[doc:crazyflie:crtp:param#toc_access|TOC access]]        | 
-|  2        | 1           | Parameter read    | +|  2             | [[doc:crazyflie:crtp:param#parameter_read|Parameter read]]    | 
-|  2        | 2           | Parameter write   |+|  2             | [[doc:crazyflie:crtp:param#parameter_write|Parameter write]]   
 +|  2      3        | [[doc:crazyflie:crtp:param#misc_command|Misc. commands]]    |
  
-===== TOC access (Port 2 channel 0) =====+===== TOC access =====
 These messages permit to access the parameters table of content. The first byte of the message is a message ID, three messages ID are defined: These messages permit to access the parameters table of content. The first byte of the message is a message ID, three messages ID are defined:
  
Line 33: Line 34:
 The CRC32 is a hash of the copter TOC. This is aimed at implementing caching of the TOC in the PC Utils to avoid fetching the full TOC each time the copter is connected. The CRC32 is a hash of the copter TOC. This is aimed at implementing caching of the TOC in the PC Utils to avoid fetching the full TOC each time the copter is connected.
  
-===== Parameter read (Port 2 channel 1) and parameter write (Port 2 channel 2) =====+The type is one byte describing the parameter type:
  
-The following messages are sent from the client to the Crazyflie: +Type code C type Python unpack | 
- **Request for**    **Byte**  ^  **Description**  +0x08      uint8_t | '<B'
- Parameter read        0      The id of the parameter to read   +| 0x09      uint16_t | '<H' 
- Parameter write       0      The id of the parameter to write   +0x0A      uint32_t | '<L'
-  :::                  1      The value to set |+| 0x0B      uint64_t | '<Q' 
 +0x00      int8_t | '<b'
 +| 0x01      int16_t | '<h'
 +| 0x02      | int32_t | '<i'
 +| 0x03      | int64_t | '<q'
 +| 0x05      | FP16 | ''
 +| 0x06      | float | '<f'
 +| 0x07      | double | '<d' |
  
-The following messages are sent from the Crazyflie to the client+===== Parameter read ===== 
-^  **Reply for**            ^  **Byte**  ^  **Description**  ^ + 
-|  Parameter read & write   |          | Parameter id      | +<WRAP group> 
-|   :::                         1-n    Parameter value   |+<WRAP half column> 
 +^ Byte ^ Request fields ^ Content 
 +|  0   | ID       | ID of the parameter to read (see TOC) | 
 +</WRAP> 
 + 
 +<WRAP half column> 
 +^ Byte ^ Answer fields  ^ Content 
 +|  0   | ID       | ID of the parameter | 
 +|  1-..  | value | Value of the parameter. Size and format is described in the TOC | 
 +</WRAP> 
 +</WRAP> 
 + 
 +The read request is a simple packet on channel 1. Crazyflie answers with the value. 
 + 
 +===== Parameter write ===== 
 + 
 +<WRAP group> 
 +<WRAP half column> 
 +^ Byte ^ Request fields ^ Content 
 +|  0   | ID       | ID of the parameter to write | 
 +|  1-...   | value | Value to write. Size and format is described in the TOC | 
 +</WRAP> 
 + 
 +<WRAP half column> 
 +^ Byte ^ Answer fields  ^ Content 
 +|  0   | ID       | ID of the parameter | 
 +|  1-...  | value | Value of the parameter. Size and format is described in the TOC | 
 +</WRAP> 
 +</WRAP> 
 + 
 +The write request is a simple packet on channel 2. Crazyflie sends back the parameter value as an acknowledgement. 
 + 
 +===== Misc. commands ===== 
 + 
 +The following misc commands are implemented: 
 + 
 +^  Code  Command ^ 
 + 0x00  | [[doc:crazyflie:crtp:param#set_by_name|Set by name]] | 
 + 
 +==== Set by name ==== 
 + 
 +<WRAP group> 
 +<WRAP half column> 
 +Byte ^ Request fields ^ Content  ^ 
 + 0   | SET_BY_NAME       | 0x00 | 
 + 1-n   | group | Name of the group | 
 +|  n-(n+1)  | NULL | 0 | 
 +|  (n+1)-(n+m+1)   | name | Name of the parameter | 
 +|  (n+m+1)-(n+m+2)  | NULL | 
 +|  (n+m+2)-(n+m+3)  | TYPE | Parameter type | 
 +|  (n+m+3)-...      | value | Value. Size and format is described by type | 
 +</WRAP> 
 + 
 +<WRAP half column> 
 +^ Byte ^ Answer fields  ^ Content  ^ 
 +   | SET_BY_NAME       | 0x00 | 
 +|  1-n   group | Name of the group | 
 +|  n-(n+1)  | NULL | 0 | 
 +|  (n+1)-(n+m+1)   | name | Name of the parameter | 
 +|  (n+m+2)  | NULL | 0 | 
 +|  (n+m+3)  | ERROR | 0 if the parameter has been successfully written. Other code are taken from[[http://www.virtsync.com/c-error-codes-include-errno|errno C codes]]. | 
 +</WRAP> 
 +</WRAP> 
 + 
 +//Group// and //name// are ascii strings of size respectively //n// and //m//. The type corresponds to the TOC type of the parameter. It is checked for consistency. 
 + 
 +This command is useful to set a parameter without having to fetch the full TOC. It is enough to know the group, name and type of the parameter to write it.
doc/crazyflie/crtp/param.txt · Last modified: 2020-05-12 14:22 by kimberly