Products
-
-
- Accessories
- Breakout boards
This is an old revision of the document!
The purpose of the logging is to be able to log variables that are available in the copter during runtime. The Crazyflie log system is design in such a way that the copter firmware is mostly independant from the client and all information required to get the log system to work are communicated at connection time. The copter contains a table of content of all the variable possible to log. The client retrieve the list at connection time. The client then program in the copter log packets (ie. list of variable to log at the same time) to be sent back at regular interval.
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
The log port is separated in 3 channels:
Port | Channel | Function |
---|---|---|
5 | 0 | Table of content access |
5 | 1 | Log settings access |
5 | 2 | Log data access |
This channel is used to access the loggable variables table of content.
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 | Command | Operation |
---|---|---|
0 | GET_ITEM | Get an item from the TOC |
1 | GET_INFO | Get information about the TOC and the LOG subsystem implementation |
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): +--------------+----+ | GET_ITEM (0) | ID | +--------------+----+ Length 1 1 Answer (Copter to PC): +--------------+----+ | GET_ITEM (0) | ID | If index out of range +--------------+----+------+------------+--------------+ | GET_ITEM (0) | ID | Type | Group | Name | If returning Item +--------------+----+------+------------+--------------+ Length 1 1 1 < Null terminated strings >
Request fields | Content |
---|---|
GET_ITEM | At 0 for GET_ITEM operation |
ID | ID of the item to be retrieved. The variables are numbered from 0 to LOG_LEN (see GET_INFO command) |
Answer fields | Content |
---|---|
GET_ITEM | 0 for GET_ITEM operation |
ID | ID of the item 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 |
Type, group and name are not sent if the required ID is higher than TOC_LEN-1.
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 1 Answer (Copter to PC): +--------------+---------+---------+-----------------+-------------+ | GET_INFO (1) | LOG_LEN | LOG_CRC | LOG_MAX_PACKET | LOG_MAX_OPS | +--------------+---------+---------+-----------------+-------------+ Length 1 1 4 1 1
Request fields | Content |
---|---|
GET_INFO | At 1 for GET_INFO operation |
Answer fields | Content |
---|---|
GET_INFO | 1 for GET_INFO operation |
LOG_LEN | Number of log items contained in the log table of content |
LOG_CRC | CRC values of the log TOC memory content. This is a fingerprint of the copter build that can be used to cache the TOC |
LOG_MAX_PACKET | Maximum number of log packets that can be programmed in the copter |
LOG_MAX_OPS | Maximum number of operation programmable in the copter. An operation is one log variable retrieval programming |