change log rate

Post here to get support
Post Reply
marco.tognon
Member
Posts: 38
Joined: Mon Sep 16, 2013 10:22 am

change log rate

Post 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?
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: change log rate

Post 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
marco.tognon
Member
Posts: 38
Joined: Mon Sep 16, 2013 10:22 am

Re: change log rate

Post 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?
Post Reply