This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
projects:crazyflie:firmware:comm_protocol [2013-09-16 19:32] ledvinap [Logging] |
projects:crazyflie:firmware:comm_protocol [2014-05-09 04:21] fred [Logging] fixed tiny but significant typo in hex string that cost me an hour of debugging |
||
---|---|---|---|
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 238: | Line 239: | ||
| | | | ||
- | TOC variable request (Storage type is ignored): | + | TOC variable request (Storage type is ignored, it is taken from Crazyflie internal TOC): |
< | < | ||
7 | 7 | ||
Line 267: | Line 268: | ||
- | == List of return codes ( errno.h codes are used ) == | + | == List of return codes ( errno.h codes are used, returned values are positive |
- | ^ **Error** | + | ^ **Error** |
- | | 0 | No error | | + | | 0 | No error | |
- | | ENOENT (2) | Block or variable not found | | + | | ENOENT (2) |
- | | E2BIG (7) | Log block is too long | | + | | E2BIG (7) | Log block is too long | |
- | | ENOEXEC (8) | unknown | + | | ENOEXEC (8) | Unknown |
| ENOMEM (12) | No memory to allocate Log Block or Log Item | | | ENOMEM (12) | No memory to allocate Log Block or Log Item | | ||
Line 302: | 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 0xbb at 100ms interval logging variable ID 0x55 of type uint16: | Adding a log block 0xbb at 100ms interval logging variable ID 0x55 of type uint16: | ||
Computer -> CF : 0x[5,1] 0x00 0xbb 0x02 0x55 // create logging block | 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, | + | Computer -> CF : 0x[5, |
+ | CF -> Computer : 0x[5,1] 0x03 0x55 0x00 // OK | ||
- | Receiving a log block 0xbb 1300ms | + | Receiving a log block 0xbb with timestamp 130.532s (0x1FDE4 ms), logging |
- | CF -> Computer : 0x[5,2] 0xBB 0xA3 0xA2 0xA1 0xBA 0xBE | + | CF -> Computer : 0x[5,2] 0xBB 0xE4 0xFD 0x01 0xBE 0xBA |
</ | </ | ||
==== Parameters ==== | ==== Parameters ==== |