I/O stream

Discussions and questions about the Crazyflie Nano Quadcopter
Post Reply
Sahildeep
Beginner
Posts: 7
Joined: Tue Mar 24, 2015 4:43 am

I/O stream

Post 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;
}
chad
Expert
Posts: 555
Joined: Sun Sep 28, 2014 12:54 am
Location: New York, USA
Contact:

Re: I/O stream

Post 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!
Crazyflier - my CF journal...
4x Crazyflie Nano (1.0) 10-DOF + NeoPixel Ring mod.
3x Crazyflie 2.0 + Qi Charger and LED Decks.
Raspberry Pi Ground Control.
Mac OS X Dev Environment.
Walkera Devo7e, ESky ET6I, PS3 and iOS Controllers.
Sahildeep
Beginner
Posts: 7
Joined: Tue Mar 24, 2015 4:43 am

Re: I/O stream

Post by Sahildeep »

Does that goes with reading the data from my computer as well ???????????????
chad
Expert
Posts: 555
Joined: Sun Sep 28, 2014 12:54 am
Location: New York, USA
Contact:

Re: I/O stream

Post 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."
Crazyflier - my CF journal...
4x Crazyflie Nano (1.0) 10-DOF + NeoPixel Ring mod.
3x Crazyflie 2.0 + Qi Charger and LED Decks.
Raspberry Pi Ground Control.
Mac OS X Dev Environment.
Walkera Devo7e, ESky ET6I, PS3 and iOS Controllers.
Post Reply