Synchronize Multiple Log Blocks

Discussions and questions about the Crazyflie Nano Quadcopter
Post Reply
Tornado_Lover
Beginner
Posts: 1
Joined: Mon Jan 29, 2018 9:50 pm

Synchronize Multiple Log Blocks

Post by Tornado_Lover » Fri Feb 02, 2018 10:17 pm

Hi,

I noticed the size of single log block is limited to 28 bytes, which can only contain about 4-6 float variables.

Well, in my application, I have to log about 20 variables at the same time.

I tried to split them into 5-6 groups and build corresponding log blocks.

I used the interface to write them into files, but I realized they were not starting at the same time stamp because I have to click the check boxes for them one by one on the interface. Furthermore, all these log blocks are logging every 100ms, which means they can never log the data at same time stamp after.

For example, I want to log both accelerator and stabilizer data, but stabilizer starts at 360484 and acc starts at 362117.
Screen Shot 2018-02-02 at 17.11.06.png
How can I synchronize them? Or How can I start and write multiple log blocks into files at the same time?

Any suggestions will be helpful. Thank you!



arnaud
Bitcraze
Posts: 2202
Joined: Tue Feb 06, 2007 12:36 pm

Re: Synchronize Multiple Log Blocks

Post by arnaud » Mon Feb 05, 2018 12:39 pm

What you are hitting is a fundamental limitation of the log subsystem current implementation, it has not been designed to acquire a large group of variables in a synchronized manner.

The log subsystem, if used from the lib, is capable of converting floats into 16bit floats. It helps a bit (if the extra precision is not needed), but not enough for your case.

Is your problem that they do not start around the same time or that the sample are not taken at the same 'instant'?

If it is the former, it would be fairly simple to write a script that crops the logs to make them start around the same time.

If it is the later, you could log quicker which means that the absolute 'jitter' between blocks will be reduced (ie. if you log every 20ms, there will be less than 20ms difference between measurements of different log blocks). Otherwise you will need to modify the firmware to either add custom logging code or make sure the logs are taken at the same instant.

One idea I have that might work, is to modify the log subsystem to batch log-block with the same period at the same time. For example all log blocks schedule at 100ms period could be scheduled on timestamp multiple of 100. I think it would work fine but it would require quite some refactoring to the log subsystem implementation in the Crazyflie. If you are interested in looking at that I would gladly help-out.

keffi
Beginner
Posts: 2
Joined: Mon Feb 25, 2019 10:35 pm

Re: Synchronize Multiple Log Blocks

Post by keffi » Mon Feb 25, 2019 10:45 pm

Hi,

I am currently working on an own ground station implementation employing the cflib. I am able to receive log data from 6 variables but I want to be able to receive a much larger number in an synchronized fasion.

I have two questions:

With multiple log blocks you are referring to adding several callbacks each for a different set of variables right? I tried something like this but I haven't been able to receive any additional data here - maybe due to the fact that one has to choose another sampling period when configuring the log data?

Secondly I would be interested in the solution arnaud mentioned in the last few lines of his entry. So additional information is highly appreciated

whoenig
Expert
Posts: 316
Joined: Mon Oct 27, 2014 2:55 am

Re: Synchronize Multiple Log Blocks

Post by whoenig » Tue Feb 26, 2019 5:58 am

If you are fine with analyzing the data offline, I suggest using the uSD card deck. It is possible to log a larger number of variables at the same time, at a higher frequency. I also implemented a "synchronous" mode, which essentially allows you to log data synchronously with the stabilizer loop (the official firmware logs asynchronously). Let me know if that is of interest.

For log blocks you can try to group the variables in a meaningful way together, and also add "compressed" versions of variables (e.g., you can compress the orientation in a 32-bit quaternion rather than logging roll/pitch/yaw as floats.)

ranjeetkumar
Beginner
Posts: 10
Joined: Fri Oct 12, 2018 11:05 am

Re: Synchronize Multiple Log Blocks

Post by ranjeetkumar » Wed Mar 20, 2019 12:06 pm

Tornado_Lover wrote:
Fri Feb 02, 2018 10:17 pm
Hi,

I noticed the size of single log block is limited to 28 bytes, which can only contain about 4-6 float variables.

Well, in my application, I have to log about 20 variables at the same time.

I tried to split them into 5-6 groups and build corresponding log blocks.

I used the interface to write them into files, but I realized they were not starting at the same time stamp because I have to click the check boxes for them one by one on the interface. Furthermore, all these log blocks are logging every 100ms, which means they can never log the data at same time stamp after.

For example, I want to log both accelerator and stabilizer data, but stabilizer starts at 360484 and acc starts at 362117.
Screen Shot 2018-02-02 at 17.11.06.png

How can I synchronize them? Or How can I start and write multiple log blocks into files at the same time?

Any suggestions will be helpful. Thank you!
Can you tell me how did you get access to the log toc, and how did you create new log blocks, i am using ROS and trying to do the same, but my problem is that I am unable to find the log toc so that I can make some change or add something to it. Did you use some crazyflie client applicaiton?

arnaud
Bitcraze
Posts: 2202
Joined: Tue Feb 06, 2007 12:36 pm

Re: Synchronize Multiple Log Blocks

Post by arnaud » Wed Mar 20, 2019 1:30 pm

@ranjeetkumar see my answer in the other thread viewtopic.php?f=2&t=3406&p=16330#p16356 and please avoid double-posting questions :).

Post Reply