Log Crazyflie's data

Discussions about autonomous flight in general, regardless of positioning method
Post Reply
ciccio
Beginner
Posts: 9
Joined: Mon Dec 04, 2017 7:59 am

Log Crazyflie's data

Post by ciccio »

Hi,

we're using the script for autonomous fly with a single Crazyflie and using client only to verify if it can to see all anchors. We want to save Crazyflie's data beacause we must take them for a thesis project, but we can't do it. Can you help us? Is there something that we can do to save data? After that, we must do a graphic but we can't use client beacause it's only to connect Crazyflie to the radio.
We hope in your answer.

Thanks a lot for your help.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Log Crazyflie's data

Post by arnaud »

Hi,

The simplest to save data from the Crazyflie is to use the client. You can create a log-block with the log configuration toolbox and, in the logblock tab, you can start the log block and start writing data to file. The result will be in a CSV file in the config folder (you can open the config colder from the seetings menu).

The client is working both with radio and with USB, why can't you use it?

Another solution is to use the python API to get the data and write them to a file by yourself. Though if all you want is to log and save data, the client is a much easier solution.
ciccio
Beginner
Posts: 9
Joined: Mon Dec 04, 2017 7:59 am

Re: Log Crazyflie's data

Post by ciccio »

Hi arnaud,
thanks for your answer. We can't use the client because we are using the script named "autonomousSequence.py" from crazyflie-lib-python/examples and if we run the script we can't be connected to the client. We use the client only to connect Crazyflie to the radio, in fact after that we disconnect client and we run autonomousSequence.py from the shell. So data don't save in the client and in file.csv in the config folder. We can save file.csv only if the Crazyflie is connected to the client and we use joystick.
Regarding the other solution, we aren't able to use the python API and so we are enable to write a file python. Can you help us? Can you say us if a file for saving data exists already? And if yes, how we can change it? Can you send us an example of change?
Thanks a lot.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Log Crazyflie's data

Post by arnaud »

If you are using the autonomousSequence.py script, you are currently using the lib.

You are in luck because this example already contains log code for the Crazyflie position. If you un-coment this line, the position will be printed in the console in a CSV-like format: https://github.com/bitcraze/crazyflie-l ... ce.py#L151

The implementation of this function should give you enough info to log whatever data you need.
ciccio
Beginner
Posts: 9
Joined: Mon Dec 04, 2017 7:59 am

Re: Log Crazyflie's data

Post by ciccio »

Thanks arnaud,

it works and it prints the positions on the shell. But we have another problem because we are also using the script "swarmSequence.py" but here we don't find the line "start_position_printing(scf)". What can we do to print the position in this case?

Thanks a lot.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Log Crazyflie's data

Post by arnaud »

You should be able to copy-paste the function and get it to work in any example. What you need is the function that sets-up the log block and the callback function.
Post Reply