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:log [2012-10-07 13:56] arnaud |
projects:crazyflie:firmware:log [2012-11-11 18:19] arnaud [Table of content access] |
||
---|---|---|---|
Line 5: | Line 5: | ||
This mechanism is used both for regular log operation (ie. user requested log to inspect and debug flight data) but also to update indication in the GUI application. | This mechanism is used both for regular log operation (ie. user requested log to inspect and debug flight data) but also to update indication in the GUI application. | ||
- | Each variable to log is contained in a | + | Each variable to log is contained in a group group and has a name. The system is designed to make it easy to add a log variable in the Firmware and have it available in the ground station GUI: |
+ | |||
+ | {{: | ||
===== Communication protocol ===== | ===== Communication protocol ===== | ||
Line 12: | Line 14: | ||
^ **Port** | ^ **Port** | ||
- | | 5 | 0 | + | | 1 | 0 | Table of content access | |
- | | 5 | 1 | + | | 1 | 1 | Log control |
- | | 5 | 2 | + | | 1 | 2 | Log data | |
==== Table of content access ==== | ==== Table of content access ==== | ||
Line 22: | Line 24: | ||
The first byte of each messages correspond a command. All communication on this port are initated by the client and all answer from the copter will contain the same command byte. | The first byte of each messages correspond a command. All communication on this port are initated by the client and all answer from the copter will contain the same command byte. | ||
- | ^ TOC command byte ^ Meaning | + | ^ TOC command byte ^ Command |
- | | 0 | Get TOC Element | + | | 0 | GET_ITEM |
- | | 1 | Get TOC information | | + | | 1 | GET_INFO |
- | === Get TOC element | + | === Get TOC item === |
+ | |||
+ | The GET_ITEM TOC command permits to retrieved the log variables name, group and types from the copter. This command is intended to be requested from all the ID from 0 to LOG_LEN (see GET_INFO). | ||
< | < | ||
Request (PC to Copter): | Request (PC to Copter): | ||
- | +-------------+------------+ | + | +--------------+----+ |
- | | Command | + | | GET_ITEM |
- | +-------------+------------+ | + | +--------------+----+ |
- | Length | + | Length |
Answer (Copter to PC): | Answer (Copter to PC): | ||
- | +-------------+------------+------+------------+--------------+ | + | +--------------+----+ |
- | | Command | + | | GET_ITEM (0) | ID | If index out of range |
- | +-------------+------------+------+------------+--------------+ | + | +--------------+----+------+------------+--------------+ |
- | Length | + | | GET_ITEM |
+ | +--------------+----+------+------------+--------------+ | ||
+ | Length | ||
</ | </ | ||
- | ^ Request fields ^ Content | + | ^ Byte ^ Request fields ^ Content |
- | | Command | + | | |
- | | Element | + | | |
+ | |||
+ | ^ Byte ^ Answer fields | ||
+ | | 0 | GET_ITEM | ||
+ | | 1 | ID | ID of the item returned | ||
+ | | 2 | Type | Variable type of the element. See variable types list | | ||
+ | | 3.. | Group | Null-terminated string containing variable group | | ||
+ | | .. | Name | Null-terminated string containing the variable name | | ||
+ | |||
+ | Type, group and name are not sent if the required ID is higher than TOC_LEN-1. | ||
+ | |||
+ | === Get Info === | ||
+ | |||
+ | The get info command is intended to be requested first when connecting to the copter. This permits to know the number of variable, the limitations of the log implementation and the fingerprint of the log variables. | ||
+ | |||
+ | < | ||
+ | Request (PC to Copter): | ||
+ | +--------------+ | ||
+ | | GET_INFO (1) | | ||
+ | +--------------+ | ||
+ | Length | ||
+ | |||
+ | Answer (Copter to PC): | ||
+ | +--------------+---------+---------+-----------------+-------------+ | ||
+ | | GET_INFO (1) | LOG_LEN | LOG_CRC | LOG_MAX_PACKET | LOG_MAX_OPS | | ||
+ | +--------------+---------+---------+-----------------+-------------+ | ||
+ | Length | ||
+ | </ | ||
+ | |||
+ | ^ Byte ^ Request fields ^ Content | ||
+ | | 0 | GET_INFO | ||
+ | |||
+ | ^ Byte ^ Answer fields | ||
+ | | 0 | GET_INFO | ||
+ | | 1 | LOG_LEN | ||
+ | | 2 | LOG_CRC | ||
+ | | 6 | LOG_MAX_PACKET | Maximum number of log packets that can be programmed in the copter | | ||
+ | | 7 | LOG_MAX_OPS | ||
+ | |||
+ | ==== Log control ==== | ||
+ | |||
+ | The log control channel permits to setup, activate, deactivate and remove log packets. Like the TOC access channel the first data byte represents a command. | ||
+ | |||
+ | ^ Control command byte ^ Command | ||
+ | | 0 | CREATE_BLOCK | ||
+ | | 1 | APPEND_BLOCK | ||
+ | | 2 | DELETE_BLOCK | ||
+ | | 3 | START_BLOCK | ||
+ | | 4 | STOP_BLOCK | ||
- | ^ Answer fields | ||
- | | Command | ||
- | | Element ID | ID of the element returned | ||
- | | Type | Variable type of the element. See variable types list | | ||
- | | Group | Null-terminated string containing variable group | | ||
- | | Name | Null-terminated string containing the variable name | | ||