SOLVED: How to dynamically change the log interval of LogConfig?

Firmware/software/electronics/mechanics
Post Reply
salocinx
Beginner
Posts: 12
Joined: Wed Feb 06, 2019 7:58 pm

SOLVED: How to dynamically change the log interval of LogConfig?

Post by salocinx » Fri Mar 08, 2019 2:01 pm

Hi. I am currently working with Crazyflies 2.0 and Road-Runners. I am successfully gathering data from the devices, such as the stabilizer and loco position values using Python and the LogConfig class. Is it somehow possible to alter the "period_in_ms" value dynamically without disconnecting and connecting to the Crazyflies again?
Last edited by salocinx on Mon Mar 11, 2019 10:36 pm, edited 1 time in total.

arnaud
Bitcraze
Posts: 1994
Joined: Tue Feb 06, 2007 12:36 pm

Re: How to dynamically change the log interval of LogConfig?

Post by arnaud » Mon Mar 11, 2019 10:52 am

The log block period is set when you start the block, so it is possible to stop the block and restart it with a new period.

Unfortunatly, in the lib, it is not possible to set the period of the LogConfig object after it was created (this would be quite easy to fix, pull request welcome :). So you cannot just stop and restart the log block, you have to delete it with the delete method (https://github.com/bitcraze/crazyflie-l ... og.py#L282) and then create a new log config.

A more efficient way with the current lib would be to create two log config with two periods and to start/stop them when you need to change the period.

salocinx
Beginner
Posts: 12
Joined: Wed Feb 06, 2019 7:58 pm

Re: How to dynamically change the log interval of LogConfig?

Post by salocinx » Mon Mar 11, 2019 10:35 pm

Thanks for the quick and detailed answer! For now, the current implementation does meet my requirements. In case I need more responsive interval modifications, I will follow your suggestion and take a closer look on the LogConfig implementation.

ricardo.halfeld
Beginner
Posts: 20
Joined: Tue May 22, 2018 1:40 pm

Re: SOLVED: How to dynamically change the log interval of LogConfig?

Post by ricardo.halfeld » Tue Apr 16, 2019 1:15 pm

arnaud wrote:
Mon Mar 11, 2019 10:52 am
...you have to delete it with the delete method...
Is there an example for this?

Post Reply