Page 1 of 2

Logging Data from CFClient

Posted: Thu Dec 26, 2013 10:05 pm
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

Re: Logging Data from CFClient

Posted: Fri Dec 27, 2013 4:02 pm
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

Re: Logging Data from CFClient

Posted: Fri Dec 27, 2013 11:00 pm
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

Re: Logging Data from CFClient

Posted: Wed Feb 10, 2016 11:44 am
by rgalvez
Hi guys,any update regarding this topic?

Re: Logging Data from CFClient

Posted: Thu Feb 11, 2016 1:11 am
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.

Re: Logging Data from CFClient

Posted: Sun Feb 14, 2016 12:29 am
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?

Re: Logging Data from CFClient

Posted: Sun Feb 14, 2016 12:56 am
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?

Re: Logging Data from CFClient

Posted: Mon Feb 15, 2016 1:51 pm
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.

Re: Logging Data from CFClient

Posted: Mon Feb 15, 2016 4:34 pm
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.

Re: Logging Data from CFClient

Posted: Wed Feb 17, 2016 8:19 am
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?