Logging Data from CFClient

Firmware/software/electronics/mechanics
Freddy
Beginner
Posts: 9
Joined: Tue Nov 26, 2013 10:33 pm

Logging Data from CFClient

Post by Freddy »

Ok, next problem!!

I have constructed a test rig for obtaining the test data I need for my model. It works well, but I want to log some data from the GUI (or where ever I can get it from) obtained from the test.

I only need to log Yaw angle and Thrust which are displayed in the GUI with a time index of some sort that I.

HOW do/can you create a log of the flight data from the GUI?

Thanks in advance! Freddy
Freddy
Beginner
Posts: 9
Joined: Tue Nov 26, 2013 10:33 pm

Re: Logging Data from CFClient

Post by Freddy »

So, I have gone into FlightTab and written this little piece of code which I think will work which sits after def_imu_data_received:

def _imu_data_received(self, data, timestamp):
self.actualRoll.setText(("%.2f" % data["stabilizer.roll"]))
self.actualPitch.setText(("%.2f" % data["stabilizer.pitch"]))
self.actualYaw.setText(("%.2f" % data["stabilizer.yaw"]))
self.actualThrust.setText("%.2f%%" %
self.thrustToPercentage(
data["stabilizer.thrust"]))

self.ai.setRollPitch(-data["stabilizer.roll"],
data["stabilizer.pitch"])


unsigned int ms_delay; /* set the time delay between log creations */
unsigned int waitdelay; /* set the delay before starting the log, ensures initial conditions */
unsigned int lasttimestamp; /* when the timestamp is bigger than this, create a log */
unsigned int nexttimestamp; /* used for updating next timestamp */

ms_delay=100; /* set the delay between log points */
waitdelay=10; /* wait to make sure crazyfile initialised before logging commences */


if (timestamp > waitdelay){ /* wait a short period before commencing with logging */
lasttimestamp=timestamp;
nexttimestamp=lasttimestamp+ms_delay;
} else {
if (timestamp > nexttimestamp) { /* write data to crazylogger file when timestamp has increased by the delay */
f = open('crazylogger','w');
f.write('%.2f %.2f %.2f %.2f %.2f %.2f \n", % data["stabilizer.roll"], % data["stabilizer.pitch"], % data["stabilizer.yaw"] , % self.thrustToPercentage(data["stabilizer.thrust"], timerstamp);
f.close();
lasttimestamp = nexttimestamp;
nexttimestamp = nexttimestamp + ms_delay;
}
}

So the next question is, how do I get this into the ccfclient gui? do I add it to the downloaded binary and then reinstall the cfclient and that will work?

cheers Freddy
SuperRoach
Member
Posts: 96
Joined: Fri May 03, 2013 2:06 pm

Re: Logging Data from CFClient

Post by SuperRoach »

Sorry I fell asleep on irc :P

But yay that you found it in the flighttab as you mentioned on there! :)

This was the other link in the forums I pointed you to as well.
http://forum.bitcraze.se/viewtopic.php?f=9&t=619
rgalvez
Beginner
Posts: 8
Joined: Mon Jan 18, 2016 4:40 pm

Re: Logging Data from CFClient

Post by rgalvez »

Hi guys,any update regarding this topic?
chad
Expert
Posts: 555
Joined: Sun Sep 28, 2014 12:54 am
Location: New York, USA
Contact:

Re: Logging Data from CFClient

Post by chad »

rgalvez wrote:Hi guys,any update regarding this topic?
Hi rgalvez!

This thread is a couple years old already. I'm not sure if anyone will respond to you...

What are you trying to accomplish? There is already a logging facility in the GUI client and the data can be written out to files for further data crunching. It can be found in the Logging tab of the client application. You may have to enable the tab via the "View" menu, then "Tabs" sub-menu and finally the "Log blocks" menu item.
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.
rgalvez
Beginner
Posts: 8
Joined: Mon Jan 18, 2016 4:40 pm

Re: Logging Data from CFClient

Post by rgalvez »

chad wrote:
rgalvez wrote:Hi guys,any update regarding this topic?
Hi rgalvez!

This thread is a couple years old already. I'm not sure if anyone will respond to you...

What are you trying to accomplish? There is already a logging facility in the GUI client and the data can be written out to files for further data crunching. It can be found in the Logging tab of the client application. You may have to enable the tab via the "View" menu, then "Tabs" sub-menu and finally the "Log blocks" menu item.
Hi chad!Thanks for the response. I just want to retrieve sensor data like pitch,roll,and yaw through ZMQ and pass it to other programs. Do you have any idea about this?
chad
Expert
Posts: 555
Joined: Sun Sep 28, 2014 12:54 am
Location: New York, USA
Contact:

Re: Logging Data from CFClient

Post by chad »

rgalvez wrote:Hi chad!Thanks for the response. I just want to retrieve sensor data like pitch,roll,and yaw through ZMQ and pass it to other programs. Do you have any idea about this?
You're welcome!

Have you seen this wiki page about the ZMQ server? Specifically the sections about logging and the log socket?
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.
rgalvez
Beginner
Posts: 8
Joined: Mon Jan 18, 2016 4:40 pm

Re: Logging Data from CFClient

Post by rgalvez »

chad wrote: Have you seen this wiki page about the ZMQ server? Specifically the sections about logging and the log socket?
Hi chad,

Thanks! I've read that already but still confused how it works.
chad
Expert
Posts: 555
Joined: Sun Sep 28, 2014 12:54 am
Location: New York, USA
Contact:

Re: Logging Data from CFClient

Post by chad »

rgalvez wrote:
chad wrote: Have you seen this wiki page about the ZMQ server? Specifically the sections about logging and the log socket?
Hi chad,

Thanks! I've read that already but still confused how it works.
ZMQ can either run as a stand-alone server or as an input device in the GUI client. Once either of these are running, you simply make connections to the sockets and issue commands. There are bindings for whatever language you want to use. Check the ZMQ examples in the crazyflie-clients-python repository for usage. The zmqservertest.py example is probably a good place to start since it shows you how to do logging.
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.
rgalvez
Beginner
Posts: 8
Joined: Mon Jan 18, 2016 4:40 pm

Re: Logging Data from CFClient

Post by rgalvez »

chad wrote:
rgalvez wrote:
chad wrote: Have you seen this wiki page about the ZMQ server? Specifically the sections about logging and the log socket?
Hi chad,

Thanks! I've read that already but still confused how it works.
ZMQ can either run as a stand-alone server or as an input device in the GUI client. Once either of these are running, you simply make connections to the sockets and issue commands. There are bindings for whatever language you want to use. Check the ZMQ examples in the crazyflie-clients-python repository for usage. The zmqservertest.py example is probably a good place to start since it shows you how to do logging.
Thanks chad. What software should I use to send commands to the crazyflie?Pycharm?
Post Reply