Replies: 1 comment 2 replies
-
Hi Junaid, I wrote you a little script for simultaneous logging and console for a single Crazyflie to get you started. from cflib.crazyflie import Crazyflie
from cflib.crazyflie.log import LogConfig
from cflib.crtp import init_drivers
from cflib.utils import uri_helper
def log_callback(timestamp, data, logconf):
print(f"Log: {data}")
def console_callback(text):
print(f"DEBUG: {text}")
def setup_console_and_log(cf: Crazyflie):
cf.console.receivedChar.add_callback(console_callback)
cf.log.add_config(log_conf)
log_conf.data_received_cb.add_callback(log_callback)
log_conf.start()
if __name__ == "__main__":
log_conf = LogConfig(name="Position", period_in_ms=100)
log_conf.add_variable("stateEstimate.x", "float")
log_conf.add_variable("stateEstimate.y", "float")
log_conf.add_variable("stateEstimate.z", "float")
uri = uri_helper.uri_from_env(default="radio://0/90/2M/E7E7E7E7E7")
init_drivers()
cf = Crazyflie()
cf.open_link(uri)
cf.fully_connected.add_callback(lambda _: setup_console_and_log(cf)) There's currently no way to get synchronized universal time on-board. Of course we welcome (and are very interested in) an implementation! I'm not sure with the set-up you are suggesting you really need this though. The companion computer involved doing the logging could help coordinate things. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone,
I am working on swarm of crazy-flies to test some algorithms. I am looking for sample code or tutorial which help me understand following:
A. How to receive DEBUG print data coming from firmware using python-api. I can see the data in cfclient in console tab for each drone. But I want to write python code to see data from all drones.
B. How to receive data from logs of each crazyflie? My understanding is logs data (like position,velocity etc.) is routed differently then console data. I don't know how to record both separately.
C. How do I keep track of universal time on each crazyflie?
There are lots of examples out there- thus I am getting confused if I am doing right thing. I have tried writing some code for one crazyflie using callback which does print DEBUG prints. But I am unable to handle multiple URIs.
I would appreciate if you have any examples on these topics. Thank you
Beta Was this translation helpful? Give feedback.
All reactions