Page 1 of 1

I/O stream

Posted: Wed Apr 29, 2015 12:35 pm
by Sahildeep
hi i am trying to read/write some of the values from stabilizer.c into a text file in my computer but it doesn't work. it's not showing an sort of error also but not working. can anyone tell me what could be possible problem. below is my code, i am writing this func() function directy in stabilizer.c. please help me please.

int func()
{
FILE *fl_ptr;
int x;

fl_ptr=fopen("/home/bitcraze/Desktop/my.txt","w" );
if (!fl_ptr)
return 1;

for (x=1; x<=10; x++)
{
fprintf(fl_ptr,"%d\n", x);

}
fclose(fl_ptr);

return 0;
}

Re: I/O stream

Posted: Thu Apr 30, 2015 12:09 am
by chad
Hi,

You wrote that you created a function in stabilizer.c to write a file to your computer? This certainly won't work because stabilizer.c is part of the firmware code that is run on the Crazyflie's STM32 processor. It doesn't have any direct access to your computer. In fact, it has no idea you even have a computer!

If you want to capture stabilizer data, you can simply use the Python client to log this info. Run the client, connect to the Crazyflie, create a "Log Blocks" tab (menu: View->Tabs-Log Blocks), click on the the tab, then check the boxes in the "Start" and "Write to file" columns in the "Stabilizer" row.

After flying, you can find the log in your crazyflie-clients-python folder in conf/logdata/<timestamp folder>/Stabilizer-*.csv

Hope this helps you out!

Re: I/O stream

Posted: Thu Apr 30, 2015 11:55 pm
by Sahildeep
Does that goes with reading the data from my computer as well ???????????????

Re: I/O stream

Posted: Fri May 01, 2015 12:51 am
by chad
Sahildeep wrote:Does that goes with reading the data from my computer as well ???????????????
If you want to read data from your computer you will need a program to take the values, translate them into something the Crazyflie can interpret, then send them over to the Crazyflie over the Crazyradio. A good place to start to understand this interaction would be through the examples in the crazyflie-clients-python GitHub repository. For instance, ramp.py will help you understand how to connect to a Crazyflie then ramp the motors up then down. This could be used as a basis for a script that reads values captured by logging and sends them back to the Crazyflie for "replay."