micro-SD deck log only zeros for PID controller commands

Discussions and questions about the Crazyflie Nano Quadcopter
Post Reply
dedecun
Beginner
Posts: 15
Joined: Tue Jul 02, 2019 1:43 pm

micro-SD deck log only zeros for PID controller commands

Post by dedecun »

Hello guys,

I have been trying to log some custom variables in the PID controller:

controller.cmd_thrust
controller.cmd_roll
controller.cmd_pitch
controller.cmd_yaw
controller. r_roll
controller.r_pitch
controller.r_yaw,
controller.accelz

You can see what they mean in the branch https://github.com/amreelab/crazyflie-f ... ller_pid.c

The problem is that the variables related to the control signals (controller.cmd_thrust, controller.cmd_roll, controller.cmd_pitch and controller.cmd_yaw) log only zeros, while the other variables log correct expected values.

My config.txt file in the SD card is as follows:

500 # frequency
100 # buffer size
log # file name
1 # enable on startup (0/1)
2 # mode (0: disabled, 1: synchronous stabilizer, 2: asynchronous)
controller.cmd_thrust
controller.cmd_roll
controller.cmd_pitch
controller.cmd_yaw
controller. r_roll
controller.r_pitch
controller.r_yaw,
controller.accelz

Another important point is that I am flying with both SD card deck and flow deck. I have seen that there might be some issues with this configuration, but not sure if they still exist in the latest firmware. Also, I do not understand why the sensor variables log OK and the control variable log only zeros. Any ideas? I can test without the Flow deck, but I would like to keep it in principle for assisted hovering.
dedecun
Beginner
Posts: 15
Joined: Tue Jul 02, 2019 1:43 pm

Re: micro-SD deck log only zeros for PID controller commands

Post by dedecun »

I have just tested the same configuration using this time only 50Hz and it worked.

So it seems to me that I can not log these control signals using 500Hz. Why is that? Is it because of the resources competing problem (could work without Flow deck) or is there another kind of conceptual problem in trying to log these control signals at 500Hz?
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: micro-SD deck log only zeros for PID controller commands

Post by tobias »

The Flow deck and the SD card is sharing the same SPI buss and that is probably why. Maybe it is possible to optimize the communication a bit to improve that. I've also seen hacking the SD card to use another SPI bus an then it should work better, please see this issue.
dedecun
Beginner
Posts: 15
Joined: Tue Jul 02, 2019 1:43 pm

Re: micro-SD deck log only zeros for PID controller commands

Post by dedecun »

I took the Flow Deck but I still have problems trying to log the PID controller signals at 500Hz :( . I figured out by trial and error that it is not possible to have buffers bigger than 100 or so. The problem is that I fly for about 2 or 3 minutes, trying to log at 500Hz, but when I decode the files I get only the last few seconds of actual values, all the rest are zeros. As I was actually flying, it is obvious that those initial values are not zero.

Any ideas of what may be happening? Any details I could provide to help you help me?
dedecun
Beginner
Posts: 15
Joined: Tue Jul 02, 2019 1:43 pm

Re: micro-SD deck log only zeros for PID controller commands

Post by dedecun »

The strange thing is that the sensors signals are being gathered at 500Hz just fine, but the signals sent to the controller most are lost... I am attaching a .csv that contains all the results for you to take a look. Consider the signals and the config.txt as in the first post in this thread.

Notice that the controller signals are logged only in the last part of the flight exercise.
Attachments
logData3.csv
(961.59 KiB) Downloaded 158 times
dedecun
Beginner
Posts: 15
Joined: Tue Jul 02, 2019 1:43 pm

Re: micro-SD deck log only zeros for PID controller commands

Post by dedecun »

Another important evidence to this case is that when I log the data over the radio (using the python client) all these signals are logged well. Attached is an example over the radio at 50Hz that illustrates what I am saying. The limitations now are, as you may know, that it is impossible to log all the signals together in the same file at the same time (what makes it hard to have all the signals at the same synchronous times) and also it is impossible to get the data at a frequency higher than 100Hz.
Attachments
identification.csv
(369 KiB) Downloaded 144 times
Post Reply