This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
projects:crazyflie:firmware:comm_protocol [2013-09-16 16:20] ledvinap |
projects:crazyflie:firmware:comm_protocol [2015-07-15 16:31] 127.0.0.1 external edit |
||
---|---|---|---|
Line 124: | Line 124: | ||
| | | | ||
- | === Table of content access === | + | === Table of content access |
This channel is used to access the loggable variables table of content. | This channel is used to access the loggable variables table of content. | ||
Line 136: | Line 136: | ||
The following messages are sent from the Client to the Crazyflie: | The following messages are sent from the Client to the Crazyflie: | ||
^ **Request for** ^ **Byte** | ^ **Request for** ^ **Byte** | ||
- | | TOC item | | + | | TOC item | |
| ::: | | ::: | ||
- | | TOC CRC and count | 0 | 0x01 Request the TOC CRC and item count | | + | | TOC CRC and count | 0 | 0x01 (CMD_GET_INFO) |
The following messages are sent from the Crazyflie to the Client: | The following messages are sent from the Crazyflie to the Client: | ||
^ **Reply for** ^ **Byte** | ^ **Reply for** ^ **Byte** | ||
- | | TOC item | + | | TOC item |
| ::: | | ::: | ||
| ::: | | ::: | ||
| ::: | | ::: | ||
| ::: | | ::: | ||
- | | TOC CRC and count | | + | | TOC CRC and count | |
| ::: | | ::: | ||
| ::: | | ::: | ||
Line 183: | Line 183: | ||
[Fetch complete] | [Fetch complete] | ||
</ | </ | ||
- | === Log settings access === | + | |
+ | === Log settings access | ||
This channel is used to access the log settings to add/ | This channel is used to access the log settings to add/ | ||
Line 189: | Line 190: | ||
The following messages are sent from the Client to the Crazyflie: | The following messages are sent from the Client to the Crazyflie: | ||
^ **Request for** ^ **Byte** | ^ **Request for** ^ **Byte** | ||
- | | | + | | |
- | | ::: | + | | ::: | |
- | | ::: | + | | ::: | 2-31 | [[comm_protocol# |
- | | Append to log | + | | Append to existing |
- | | ::: | + | | ::: | |
- | | ::: | + | | ::: | 2-31 | [[comm_protocol# |
- | | Delete a log | | + | | Delete a log block | |
- | | ::: | + | | ::: | |
- | | Start a log block | | + | | Start a log block |
- | | ::: | + | | ::: | |
- | | ::: | + | | ::: | |
- | | Stop a log block | | + | | Stop a log block |
- | | ::: | + | | ::: | |
- | | Reset log | | + | | Reset log |
Line 209: | Line 210: | ||
^ **Byte** | ^ **Byte** | ||
| | | | ||
- | | | + | | |
| | | | ||
Line 216: | Line 217: | ||
The following format is used to identify a variable that is to be logged from the Crazyflie | The following format is used to identify a variable that is to be logged from the Crazyflie | ||
+ | Log Type represents type of value sent in packet. Logged value is converted to this type before storing into log packet. Upper bytes will be discarded if Log Type is integer and value does not fit. | ||
^ **Log Type** | ^ **Log Type** | ||
Line 227: | Line 229: | ||
| | | | ||
- | ^ **Storage Type** | + | ^ **Storage Type** |
- | | | + | | |
| | | | ||
| | | | ||
Line 237: | Line 239: | ||
| | | | ||
+ | TOC variable request (Storage type is ignored, it is taken from Crazyflie internal TOC): | ||
< | < | ||
7 | 7 | ||
+---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ | ||
- | | Log type | Storage type | + | | Storage type |
+---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ | ||
| Variable ID | | | Variable ID | | ||
Line 246: | Line 249: | ||
</ | </ | ||
+ | Arbitrary memory address request: | ||
< | < | ||
7 | 7 | ||
+---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ | ||
- | | Log type | + | | Storage type | Log type | |
+ | +---+---+---+---+---+---+---+---+ | ||
+ | | 0xff | | ||
+---+---+---+---+---+---+---+---+ | +---+---+---+---+---+---+---+---+ | ||
| Mem Address 0 | | | Mem Address 0 | | ||
Line 262: | Line 268: | ||
- | == List of return codes == | + | == List of return codes ( errno.h codes are used, returned values are positive ) == |
- | ^ **Error** | + | ^ **Error** |
- | | 0x00 | + | | |
- | | 0x01 | + | | |
- | | 0x02 | + | | E2BIG (7) |
- | | 0xFF | + | | |
+ | | ENOMEM (12) | No memory to allocate Log Block or Log Item | ||
== Usage == | == Usage == | ||
- | Adding a new log block to the settings: | + | Adding a new log block with id 0x0a with variable 0x55 type uint32_t and variable 0x66 type float32 |
< | < | ||
| | ||
| | ||
- | Add log packet | + | Add log block |
- | < | + | < |
[DONE] | [DONE] | ||
Packet structure: | Packet structure: | ||
- | Computer -> CF : 0x[5,1] 0x00 0x01 0x0A 0x02 0x55 | + | Computer -> CF : 0x[5,1] 0x00 0x0a 0x03 0x55 0x07 0x66 |
- | CF -> Computer : 0x[5,1] 0x00 0x55 0x00 | + | CF -> Computer : 0x[5,1] 0x00 0x0a 0x00 |
</ | </ | ||
- | Deleting an existing log block from the settings: | + | Deleting an existing log block 0x55 from the settings: |
< | < | ||
| | ||
Line 296: | Line 303: | ||
</ | </ | ||
- | === Log data access === | + | === Log data access |
- | Logging data is sent back to the copter as raw data with only the block id. This means that the lookup of what data is for what variable has to be done on the computer side. | + | Logging data is sent back to the copter as raw data with only the block id. This means that the lookup of what data is for what variable has to be done on the computer side. Log |
+ | block header contains 3 byte timestamp, its value is number of microseconds from Crazyflie system start (it will wrap around in about 16 seconds. Is is also currently based on xTaskGetTickCount, | ||
+ | |||
+ | ^ **Byte** | ||
+ | | | ||
+ | | 1-3 | Block send time timestamp in us, LSB first | | ||
+ | | 4-31 | Logged variable values, LSB first | | ||
< | < | ||
- | Adding a log block logging variable ID 0x55 at 100ms interval and of type uint16: | + | Adding a log block 0xbb at 100ms interval |
- | Computer -> CF : 0x[5,1] 0x00 0x01 0x0A 0x02 0x55 | + | Computer -> CF : 0x[5,1] 0x00 0xbb 0x02 0x55 // create logging block |
- | CF -> Computer : 0x[5,1] 0x00 0x55 0x00 | + | CF -> Computer : 0x[5,1] 0x00 0x55 0x00 // OK |
+ | Computer -> CF : 0x[5,1] 0x03 0xbb 0x0A // start sending block with 100ms interval | ||
+ | CF -> Computer : 0x[5,1] 0x03 0x55 0x00 // OK | ||
- | Receiving a log block logging variable | + | Receiving a log block 0xbb with timestamp 130.532s (0x1FDE4 ms), logging |
- | CF -> Computer : 0x[5, | + | CF -> Computer : 0x[5, |
</ | </ | ||
==== Parameters ==== | ==== Parameters ==== | ||
- | The parameters system | + | The parameters system |
- | | **Port** | **Function** | | + | ^ Port ^ Channel |
- | | | + | | |
- | | | + | | |
- | | | + | | 2 | 2 | Parameter write | |
- | === TOC access === | + | === TOC access |
- | This ports permits | + | These messages permit |
- | | **Message ID** | **Meaning in upstream packets** | **Meaning in downstream packets** | | + | ^ |
- | | 0 | Reset TOC pointer | + | | 0 | Reset TOC pointer |
- | | 1 | Get next TOC element | + | | 1 | Get next TOC element |
- | | 3 | Get TOC CRC32 | TOC CRC32 | + | | 3 | Get TOC CRC32 |
- | The upstream ID are commands and are sent alone. The downstream | + | The upstream ID are commands and are sent alone. The downstream |
< | < | ||
Line 337: | Line 352: | ||
</ | </ | ||
- | The parameters are sequentially requested by the PC until the end. When the last parameter is reached it has the ID 0 'Last TOC element' | + | The parameters are sequentially requested by the PC until the end. When the last parameter is reached it has the ID 0 'Last TOC element' |
+ | |||
+ | 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 CRC32 is a hash of the copter TOC. This is aim at implementing caching | + | The following messages are sent from the client to the Crazyflie: |
+ | ^ **Request for** | ||
+ | | Parameter read | | ||
+ | | Parameter write | ||
+ | | ::: | ||
- | === Parameter read === | + | The following messages are sent from the Crazyflie to the client: |
- | **TODO** | + | ^ |
- | === Parameter write === | + | | Parameter read & write |
- | **TODO** | + | | ::: |
=== Fight control ==== | === Fight control ==== |