Update Logging authored by Colton Glick's avatar Colton Glick
......@@ -37,7 +37,7 @@ LOG_ADD(LOG_UINT16, thrust, &actuatorThrust)
LOG_GROUP_STOP(stabilizer)
```
## Logging groups
### Logging groups
Each variable to log belongs to a logging group. A logging group is defined as a section between the logging group start macro and the logging group stop macro:
```c
LOG_GROUP_START(NAME)
......@@ -49,7 +49,7 @@ The name of the group is given as the only parameter to the group stop and group
**Nested groups are not supported by Crazyflie**
## Logging variables
### Logging variables
A variable is added to a logging group when it is within the scope of that group's definition.
```c
......@@ -72,12 +72,13 @@ The `TYPE` defines how the data is sent over the network and read by the client,
- `LOG_FP16` 16 bit floating point number
The `NAME` parameter defines the log variable name. The `ADDRESS` is the memory location which the data is stored (passed as a pointer). Note, this must be a global static memory location for the logging system to read the value.
# Ground Station Setup
The second half of the logging equation is the ground station. The Crazyflie streams a small amount of data (limited to 26 bytes) to the ground station.
First we will cover how to setup logging on the [official Crazyflie Python client](https://github.com/bitcraze/crazyflie-clients-python), then cover the underlying process that it uses.
## Crazyflie Python Client
### Crazyflie Python Client
After the variables that you want to log are setup in the firmware, we can begin setting up the ground station.
1. Open the Crazyflie client.
......@@ -86,6 +87,7 @@ After the variables that you want to log are setup in the firmware, we can begin
4. Scan for your quad.
5. Connect to the appropriate quad, pay attention to the channel you're connecting to.
6. If not already visible, under the `view > tabs` menu, enable the `Log Blocks`, `Log TOC`, and `Plotter` tabs.
![enable_tabs](uploads/b24a678f403abc765f4081cf03f222bb/enable_tabs.png)
1. The `Log TOC` tab shows all available logging variables provided by the Crazyflie firmware.
2. The `Log Blocks` tab shows the log blocks that have been configured on the client. A log block specifies what variables should be sent from the quad.
3. The `Plotter` tab helps visualize the data being sent from the quad.
......@@ -93,17 +95,23 @@ After the variables that you want to log are setup in the firmware, we can begin
1. Open `Settings > Logging configurations`
2. On the far left is the list of existing log blocks, sorted by category. In the middle is the logging table of contents (TOC), listing all available variables to log. The far right shows the new working log block.
3. Create a new config, name it whatever you like.
![new_config](uploads/101b95ad5c04324010d228a148f296f1/new_config.png)
4. Add variables to the new log block by selecting them in the TOC and pressing the left arrow button.
5. Notice the bar at the bottom shows the percent utilization of the log block, a maximum of 26 bytes can be transmitted.
![bandwidth](uploads/501725072172ea28b7261d6b08fdc21d/bandwidth.png)
6. Set the logging period, this is how often the data block will be transmitted
7. Click save
8. Go to the `Log Blocks` tab. This will display all log blocks that have been created for this quad.
9. Uncheck all boxes in the start column that may be enabled by default
![uncheck](uploads/47eca6a76b4348fa55863e9c7c9408b4/uncheck.png)
10. Start your new log block
11. Switch to the plotter tab
12. Under the top drop down, select the log block you just started
13. The plotter will start displaying the data received from the log block, in this example It is displaying the roll angle of the quad
## Low Level
12. Under the drop down at the top, select the log block you just started.
![start_plotter](uploads/dd2e928580dca83dd67a6c3e31cad9fc/start_plotter.png)
13. The plotter will start displaying the data received from the log block, in this example It is displaying the roll angle of the quad.
![plotter](uploads/68bd10fa17ace522e695efe57480889e/plotter.png)
### Low Level
The ground station can instruct the Crazyflie to report back specific logging data, known as a *log block*. First the ground station queries the Crazyflie for available log variables, known as the *[Table of Contents (TOC)](https://www.bitcraze.io/documentation/repository/crazyflie-firmware/master/functional-areas/crtp/crtp_log/)*
The ground station then [sends a command](https://www.bitcraze.io/documentation/repository/crazyflie-firmware/master/functional-areas/crtp/crtp_log/#:~:text=variable%20retrieval%20programming-,Log%20control,-The%20log%20control) on port 5 channel 1 to enable log block transmission.
......
......