Page 1 of 1

change log rate

Posted: Sat Oct 19, 2013 4:09 pm
by marco.tognon
Hello!
I configured and started a log package at one frequency f1. Then i would change its frequency. I'm trying using this code:

Code: Select all

log_config.setPeriod(1000/f2)
If then i do

Code: Select all

log_config.getPeriod()
i found the right value but the real log frequency seams to be unchanged!!

May be i have to stop the log, change its frequency, and then restart it?

Re: change log rate

Posted: Tue Oct 22, 2013 8:13 am
by marcus
Hi,

Changing the period after the logging has started is unfortunately not supported. To get around this problem you have to create a new log configuration with the correct frequency.

/Marcus

Re: change log rate

Posted: Tue Oct 22, 2013 10:01 am
by marco.tognon
So, let me to understand better. For example, if I have this code:

Code: Select all

gyroconf = LogConfig("Gyro", 10)
        gyroconf.addVariable(LogVariable("gyro.x", "float"))
        gyroconf.addVariable(LogVariable("gyro.y", "float"))
        gyroconf.addVariable(LogVariable("gyro.z", "float"))
 
        # crazyflie is an instance of the Crazyflie class that has been instantiated and connected
        gyrolog = crazyflie.log.newLogPacket(gyroconf)
 
        if (gyrolog != None):
            gyrolog.data_received.addCallback(gyroData)
            gyrolog.startLogging()
        else:
            print "gyro.x/y/z not found in log TOC"
if then i want to change the frequency have i to erase the hold log and to create a new with the same code?
Is not possible to stop the log, chenge frequency and restart the log?