User Tools

Site Tools


projects:crazyflie:firmware:log

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
projects:crazyflie:firmware:log [2012-10-07 13:56]
arnaud
projects:crazyflie:firmware:log [2012-10-08 07:05]
arnaud [Log control]
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: 
 + 
 +{{:projects:crazyflie:firmware:logmagic.png?800|}}
  
 ===== Communication protocol ===== ===== Communication protocol =====
Line 12: Line 14:
  
 ^ **Port**  ^ **Channel** ^ **Function**      ^ ^ **Port**  ^ **Channel** ^ **Function**      ^
-|            0        | [[comm_protocol#table_of_content_access|Table of content access]] +|            0        | Table of content access | 
-|            1        | [[comm_protocol#log_settings_access| Log settings access]] +|            1        | Log control 
-|            2        | [[comm_protocol#log_data_access|Log data access]] |+|            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   ^ Operation 
-|                0 | Get TOC Element     +|                0 | GET_ITEM  | Get an item from the TOC | 
-|                1 | Get TOC information |+|                1 | GET_INFO  | Get information about the TOC and the LOG subsystem implementation |
  
-=== 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).
  
 <code> <code>
 Request (PC to Copter): Request (PC to Copter):
-        +-------------+------------+ +        +--------------+----+ 
-        | Command (0) | Element ID | +        | GET_ITEM (0) | ID | 
-        +-------------+------------+ +        +--------------+----+ 
-Length                    1+Length                 1
  
 Answer (Copter to PC): Answer (Copter to PC):
-        +-------------+------------+------+------------+--------------+ +        +--------------+----+ 
-        | Command (0) | Element ID | Type |   Group    |     Name     | +        | GET_ITEM (0) | ID |                                        If index out of range 
-        +-------------+------------+------+------------+--------------+ +        +--------------+----+------+------------+--------------+ 
-Length        1                     1    < Null terminated strings >+        | GET_ITEM (0) | ID | Type |   Group    |     Name         If returning Item 
 +        +--------------+----+------+------------+--------------+ 
 +Length        1              1    < Null terminated strings >
 </code> </code>
 ^ Request fields ^ Content                             ^ ^ Request fields ^ Content                             ^
-Command        Must be 0 for GET_ELEMENT operation | +GET_ITEM       At 0 for GET_ITEM operation | 
-Element ID     | ID of the element to be retrieved. The variables are numbered from 0 to LOG_LEN (see GET_INFO command) |+| ID             | ID of the item to be retrieved. The variables are numbered from 0 to LOG_LEN (see GET_INFO command) |
  
 ^ Answer fields  ^ Content                             ^ ^ Answer fields  ^ Content                             ^
-Command        | 0 for GET_ELEMENT operation | +GET_ITEM       | 0 for GET_ITEM operation | 
-Element ID     | ID of the element returned  |+| ID             | ID of the item returned  |
 | Type           | Variable type of the element. See variable types list | | Type           | Variable type of the element. See variable types list |
 | Group          | Null-terminated string containing variable group | | Group          | Null-terminated string containing variable group |
 | Name           | Null-terminated string containing the variable name | | 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.
 +
 +<code>
 +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
 +</code>
 +
 +^ 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 |
 +
 +==== 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       ^ Operation ^
 +|                    0 | CREATE_BLOCK  | Create a new log block |
 +|                    1 | APPEND_BLOCK  | Append variables to an existing block |
 +|                    2 | DELETE_BLOCK  | Delete log block |
 +|                    3 | START_BLOCK   | Enable log block transmition |
 +|                    4 | STOP_BLOCK    | Disable log block transmition |
 +
  
projects/crazyflie/firmware/log.txt · Last modified: 2021-06-24 16:49 by kimberly