This repository is based on the branch tune-lee
from Crazyswarm2. It contains all the data that was accumulated during the tuning experiments of the Lee controller with the standard and upgraded Crazyflie hardware. The data is stored in the folder /logs
. The information (and controller gains) for each experiment is stored in the folder /info
. In here, you will also find the script plot.py
for yaml-based automatic report generation to process the logs and info files. The script data_helper.py
focuses on manipulating and adding data to the automatically generated reports. In the following, you will find a guide on how to use the scripts and data. Also, there is the script model_payload.py
which is used for calculating the residual forces and torques with the UAV payload model from this paper. To find some information on UAV dynamics, please refer to this paper.
All flight experiments conducted for the current log and info files used the motion capture system OptiTrack.
- The data of each experiment is stored in the folder
logs
Note: A log file may have the name
log14
, or if it is a repetitionlog14_2
. This is called the logging number. Please format your logs accordingly.
- The parameters and information of each experiment is stored in the folder
info
Note: The correponding info file would have the name
info14.yaml
. Please note that there is no suffix because one configuration of parameters describes all duplicates of an experiment. It is called the experiment number. You have to enter the experiment number in the filecrazyflie/config/crazyflies.yaml
later on so that it will be saved. See the next sections for more information.
- The finished reports combine the data and experiment information and are stored in the folder
reports
Note: The reports are not uploaded to this repository because they are too large. You can create them automatically in one run by yourself, see the next section for more information.
- Crazyswarm2 Tools
- General Information
- FAQ
- Where to look for information on the tuning experiments? Where to find the files to repeat the flight experiments?
- Which experiments where conducted with which type of hardware?
- Which gains for the Lee Controller work well with the upgraded hardware?
- Which gains for the Lee Controller work well with the standard hardware?
- I want to see the reports of previous flight experiments. Where can I find them?
- I would like to plot the data of an experiment. How do I generate a report?
- How to conduct a flight experiment using on the workstation?
- How to change the settings for a report?
- Where can I find the controller gains for the Crazyflie with standard hardware when using the Lighthouse motion capture system?
Where to look for information on the tuning experiments? Where to find the files to repeat the flight experiments?
As this repository is based on the branch tune-lee
from Crazyswarm2, it contains all logs and info files required for generating reports. The controller gains of each experiments as well as the used hardware can be found in the respective info files. To repeat the flight experiments you may use the branch tune-lee
from Crazyswarm2 because it offers the following scripts.
-
crazyflie/config/crazyflies.yaml
: This script contains the configuration for each flight experiment. The last flight experiment conducted was the one with the payload uav and the motion capture system. The payload had a weight of 5 grams. -
crazyflie_examples/crazyflie_examples/lee.py
: This script contains the automatic loading process of the trajectory from the configuration filecrazyflies.yaml
. It starts logging before starting the trajectory, and ends it right after the end of the flown trajectory. Please connect the Crazyradio to the URIradio://0/80/2M/E7E7E7E70B
which corresponds to Crazyflie 11.
More information on conducting the experiments can be found below.
The logs and reports up until number 145
were done with the upgraded CF motors and QProp propellers. The logs and reports from number 146
and onwards were done with the standard motors and propellers. For more information on the used hardware, flown trajectory, and controller gains please refer to the info files.
The controller gains from the info file 145
work well with the upgraded hardware.
The controller gains from the info files 178
and 182
work well with the standard hardware.
Most of the reports can be found on the workstation in the flightspace. Please log in as Dennis Schmidt
. The password could be provided by either Khaled or Wolfgang as it is located in our group chat. The path to look for the reports is ~/projects/ros2_ws/src/crazyswarm2/_experiments/reports
.
-
Create a virtual environment and install the requirements.
-
Check if you have the folder
/reports
. If not, create it. -
Execute the script
plot.py
. Currently, the script is in the modemanual single
which is why it will ask you which log you want to plot. The newest log and info files are201
up to206
. These logs were created to calculate the residual forces and torques of UAV with a payload of 5 grams. Type the number of the desired log you want to process into the terminal when prompted. Note that there are different modes available. You can change the mode in the scriptplot.py
.cd crazyswarm2-tools python plot.py
It should output something similar to this:
...creating figures start_time: 143230.548 output path: reports/log29.pdf processing event: fixedFrequency (0) >>> created figure 1: Positions >>> created figure 2: Translation Velocities >>> created figure 3: Angles >>> created figure 4: Angular Velocities >>> created figure 5: Thrust >>> created figure 6: Torques (xyz) >>> created figure 7: Trajectories ...done creating figures
-
Check the folder
/reports
for the report. It should have the namelog206.pdf
. -
If you wonder how to add additional data that is not included in the logs but computed on the basis of it, for example by fitting a cubic spline, check out the function
add_data()
inplot.py
as well as the scriptdata_helper.py
. The filesettings.yaml
defines the requirements for the computation of additional data. There, multiple methods are defined to generate and add new data to the report from the logs. For example, to add the residual forces to the report206
the stringsresidual.fx
,residual.fy
, andresidual.fz
were added to the sectionadditional_data
of the filesettings.yaml
. The calculation of the residual forces and the payload uav model can be found in the filemodel_payload.py
. There, you can also find code to fit data using cubic splines (with smoothing) and calculate the residual torques, as well as the state errors of the payload uav model.
Note that to this date, the log folder contains logs up to the number
206
. This repository developed gradually and new field names were introduced to thesettings.yaml
over time. Therefore, it is not possible to plot old logs, e.g.log47
, with the newest version of thesettings.yaml
out of the box. In order to plot these logs you would need to change thesettings.yaml
accordingly. An easy way to grab the compatible settings for report generation is to check the date of the respective log in the commit history and go back in time with agit checkout
to that commit on the branchmain
. I can recommend the VS Code extensionGit Graph
for browsing the commit history.
-
If not already there, create the three folders mentioned above in the main directory of this repository:
logs
,info
,reports
-
Decide which experiment you want to do
- Decide which timescale, trajectory, motors, propellers and parameters of the lee controller, and experiment number you want to use:
crazyflie/config/crazyflies.yaml
(fieldctrlLeeInfo
andctrlLee
) - There are 3 different motors in the lab at the current moment:
- Standard motors (CF)
- Upgraded motors (CF)
- Upgraded motors (BETAFPV)
- There are 2 different propellers in the lab at the current moment:
- Standard propellers (CF)
- Upgraded propellers (QProp)
- Decide which timescale, trajectory, motors, propellers and parameters of the lee controller, and experiment number you want to use:
-
Check that the sd card includes this config file which is specific to the plotting script later on:
config.txt
. You may have to adjust the file depending on your needs.
Note that you can not use the
config.txt
directly on the sd card. Please create a new file with the same name and copy either the content for the tuning or modeling experiments.
- Save your tuning parameters and experiment information in the folder
/info
by executing the following command in the terminal
cd _experiments
python save.py
This script generates the info file for the experiment, i.e. writes the current parameters of the file
crazyflie.yaml
into a new info file. The info file can be used with the corresponding log file to generate a report. Please adjust the filepath of the filecrazyflie.yaml
in the scriptsave.py
to your needs. It is recommended to save the parameters before doing an experiment so that you can easily reproduce the experiment later on.
-
Run the experiment, the script
crazyflie_examples/crazyflie_examples/lee.py
will automatically read the parameters from the filecrazyflie/config/crazyflies.yaml
-
Rename and transfer the logs from the sd card to the workstation into the folder
/logs
. Be sure to name the logs correctly, i.e.log213
.
In the following you will find some (older) information on changing the parameters in the settings.yaml
. You can also find more information in the file itself, epsecially in the section additional_data
.
- Be sure to have the folders
/reports
and/logs
in this repository - Adjust the following general settings
event_name
output_dir
- ...
- Figures can be defined in the figure settings
- Copy and change the following parameters
title
type
(only 2d and 3d for now)x_label
- ...
- Each structure within a figure dictionary defines a subplot
- The x-axis data of the subplot is defined by the key, i.e.
timestamp
which is the name of the time data wihtin the log file - Each subplot can have multiple signals which can be defined by another dictionary with the key
y_info
- It has the keys
data
andlabel
data
defines the name of the signalss within the log file by its keys, the legend names of the signals can be defined with the respective values
- It has the keys
- The x-axis data of the subplot is defined by the key, i.e.
- Copy and change the following parameters
- Title settings can also be adjusted
title_settings
: change the names of the settings which should be displayed in the titletitle_params
: define the parameters which should be displayed in the title
- Change the unit settings
convert_units
: define the units which should be converted and how, the value represents the conversion factorunits
: define the string which should be displayed as the unit (not in use yet)
Where can I find the controller gains for the Crazyflie with standard hardware when using the Lighthouse motion capture system?
The current controller gains can be found in the file /home/denni/projects/crazyswarm2-tools/cflibsetparams.py
. This file was used to load the Lee controller and its gains onto the Crazyflie. The GUI of the cfclient
can be used for flying witht the Crazyflie afterward. The controller gains deviate from the controller gains used for the motion capture system because the Crazyflie used to make a backflip on landing. Older variations of the controller gains can be found in the commit history of the branch residual-forces
.
Please connect the Cherry keyboard to the workstation for now because the other keyboard will be interpreted as a game controller by the
cfclient
.