User Tools

Site Tools


projects:crazyflie2:expansionboards:microsd

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
projects:crazyflie2:expansionboards:microsd [2017-05-22 16:16]
jan how to log data
projects:crazyflie2:expansionboards:microsd [2018-05-30 18:59] (current)
whoenig [Data Logging]
Line 24: Line 24:
 ===== Data Logging ====== ===== Data Logging ======
  
-Without any changes to //​usddeck.c//​ there'​s a data logging functionality implemented. It can be enabled and configured by placing a config file on the µSD-Card. The File is being created by using the related python module which can be found in [[https://​github.com/​bitcraze/​crazyflie-firmware/​blob/​master/​tools/​usdlog/​CF_functions.py|tools/​usdlog]]. Just start the module ​as main. Logging 10dof data with 1kHz works quite good with a buffer of 120 elements. But you may have to try around a bit to get feeling on what is possible. If the buffer was too small or the frequency was too high there will be gaps in the log as you can see in the following picture:+Without any changes to //​usddeck.c//​ there'​s a data logging functionality implemented. It can be enabled and configured by placing a config file on the µSD-Card. The file is a simple text file and an example is available ([[https://​github.com/​bitcraze/​crazyflie-firmware/​blob/​master/​tools/​usdlog/​config.txt|config.txt]])The file format is as follows: 
 +<​code>​ 
 +Frequency 
 +Number of buffers 
 +File name 
 +log entry 1 
 +log entry 2 
 +log entry 3 
 +... 
 +</​code>​ 
 +Frequency is an integer value in Hertz, for example 250 means that a data block is written every 4ms. The number of buffers is used to decouple the writing to the card and the data logging. Higher frequencies require more buffers, otherwise some data might be lost. Logging 10dof data with 1kHz works well with a buffer of 120 elements. But you may have to try around a bit to get feeling on what is possible. If the buffer was too small or the frequency was too high there will be gaps in the log as you can see in the following picture:
  
 {{:​projects:​crazyflie2:​expansionboards:​usd_log_gap.png?​nolink&​600|µSD-Log-Gap}} {{:​projects:​crazyflie2:​expansionboards:​usd_log_gap.png?​nolink&​600|µSD-Log-Gap}}
  
-Config ​will be read only once on startup, therefore make sure that the µSD-Card is inserted before power up. If everything seems to be fine a µSD-task will be created and buffer space will be allocated. If malloc fails crazyflie will stuck with LED M1 and M4 glowing, otherwise data logging starts automatically after sensor ​calbriation. The logfiles will be enumerated in ascending ​ order from 00-99 to allow multiple logs without the need of creating new config files. Just reset the crazyflie to start a new file. For performance reasons the logfile is a binary file, but the python module also contains a function which will return the data as dictionary. For decoding just call+The file name should be 10 characters or less and a running number is appended automatically (e.g., if the file name is log, there will be files log00, log01, log02 etc.). The log entries are the names of logging variables in the firmware. 
 + 
 +The config.txt file will be read only once on startup, therefore make sure that the µSD-Card is inserted before power up. If everything seems to be fine a µSD-task will be created and buffer space will be allocated. If malloc fails crazyflie will stuck with LED M1 and M4 glowing, otherwise data logging starts automatically after sensor ​calibration. The logfiles will be enumerated in ascending ​ order from 00-99 to allow multiple logs without the need of creating new config files. Just reset the crazyflie to start a new file. For performance reasons the logfile is a binary file, but the python module also contains a function which will return the data as dictionary. For decoding just call
 <code python> <code python>
 import CF_functions as cff import CF_functions as cff
projects/crazyflie2/expansionboards/microsd.txt · Last modified: 2018-05-30 18:59 by whoenig