Logging custom variables using sdcard

Discussions and questions about the Crazyflie Nano Quadcopter
Post Reply
tungnx94
Beginner
Posts: 11
Joined: Wed Dec 27, 2017 11:49 am

Logging custom variables using sdcard

Post by tungnx94 » Fri Apr 06, 2018 11:29 am

I'm trying logging data with micro sd-card deck. Currently I came across these questions (all related to logging on sd card of course)
1/ Is it possible to log custom variables without modifying the firmware ? If so, how to proceed. I looked at the scripts https://github.com/bitcraze/crazyflie-f ... nctions.py and https://github.com/bitcraze/crazyflie-f ... example.py. Are these modifiable for this purpose ?

2/ Should the firmware need to be editted, where should I start ?

3/ I need to log the position (x,y,z coordinates), orientation (roll/pitch/yaw), velocity/acceleration (linear as well as angular). Are these already available in LogTOC (under which names in this case) ?

4/ What data do the barometer, accelerator and magnetometer return ? All are in x,y,z coordinates but how can I make sense of them ?

I understand those are not few questions and would appreciate every little help there is :).

tobias
Bitcraze
Posts: 1735
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Logging custom variables using sdcard

Post by tobias » Mon Apr 09, 2018 10:36 am

There is some ongoing work with the micro sd card logging by a community member. I'm not sure about the status yet though but I think the idea is to do what you request. Because of this:

1. Unfortunately not yet.

2. Easiest would be to hack the usddeck.c file and add variables you would like to log.

3 and 4. Basically add the variables the same way as the acc, gyro is added. Variables you need:
Position in meters:
kalman.stateX
kalman.stateY
kalman.stateZ
Attitude in degrees:
stabilizer.roll
stabilizer.pitch
stabilizer.yaw
Angular velocity in deg/s:
gyro.x
gyro.y
gyro.z
Accelerometer in m/s2:
acc.x
acc.y
acc.z

One problem though is that logging to micro-SD together with LPS, the SPI buss gets overloaded. Se this bug, and it is not solved yet :oops:

tungnx94
Beginner
Posts: 11
Joined: Wed Dec 27, 2017 11:49 am

Re: Logging custom variables using sdcard

Post by tungnx94 » Thu Apr 19, 2018 10:27 am

So there is not yet the variables to measure linear velocity, but it can be approximated by integrating the linear acceleration right ?

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

Re: Logging custom variables using sdcard

Post by arnaud » Mon Apr 30, 2018 7:11 am

The kalman filter has variable that tracks the linear velocity as well: https://github.com/bitcraze/crazyflie-f ... #L229-L232, all the states are available as log: https://github.com/bitcraze/crazyflie-f ... 1452-L1460

Post Reply