From 9acbea28077030a7fb71187201f6fabb97631725 Mon Sep 17 00:00:00 2001 From: Stefan Thorstenson Date: Mon, 19 Jan 2026 14:17:08 +0100 Subject: [PATCH 01/10] Changed to correct input variable. --- docs/user-guides/sbs_connect_log_param.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guides/sbs_connect_log_param.md b/docs/user-guides/sbs_connect_log_param.md index a708744bc..da997cf32 100644 --- a/docs/user-guides/sbs_connect_log_param.md +++ b/docs/user-guides/sbs_connect_log_param.md @@ -198,7 +198,7 @@ Here you will add the logs variables you would like to read out. If you are unsu Use the same connect_log_param.py script, and add the following function above `simple_connect()` and underneath URI: ```python -def simple_log(scf, logconf): +def simple_log(scf, lg_stab): ``` Notice that now you will need to include the SyncCrazyflie instance (`scf`) and the logging configuration. From 817ce90a6202adedc4f29c12acf15c603b1e8358 Mon Sep 17 00:00:00 2001 From: Stefan Thorstenson Date: Mon, 19 Jan 2026 14:59:38 +0100 Subject: [PATCH 02/10] Updated input variables --- docs/user-guides/sbs_connect_log_param.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user-guides/sbs_connect_log_param.md b/docs/user-guides/sbs_connect_log_param.md index da997cf32..a6b09e462 100644 --- a/docs/user-guides/sbs_connect_log_param.md +++ b/docs/user-guides/sbs_connect_log_param.md @@ -198,14 +198,14 @@ Here you will add the logs variables you would like to read out. If you are unsu Use the same connect_log_param.py script, and add the following function above `simple_connect()` and underneath URI: ```python -def simple_log(scf, lg_stab): +def simple_log(scf, logconf): ``` Notice that now you will need to include the SyncCrazyflie instance (`scf`) and the logging configuration. Now the logging instances will be inserted by adding the following after you configured the lg_stab: ```python - with SyncLogger(scf, lg_stab) as logger: + with SyncLogger(scf, logconf) as logger: for log_entry in logger: From 44f58ef2284ba54e2d3dac7493b99f25bd0712e5 Mon Sep 17 00:00:00 2001 From: Stefan Thorstenson Date: Mon, 19 Jan 2026 15:20:59 +0100 Subject: [PATCH 03/10] Fixed typo --- docs/user-guides/sbs_connect_log_param.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guides/sbs_connect_log_param.md b/docs/user-guides/sbs_connect_log_param.md index a6b09e462..a438f97c2 100644 --- a/docs/user-guides/sbs_connect_log_param.md +++ b/docs/user-guides/sbs_connect_log_param.md @@ -221,7 +221,7 @@ Now the logging instances will be inserted by adding the following after you con ### Test the script: -First change the `simple_connect()` in _main_ in `simple_log(scf, lg_stab)`. Now run the script (`python3 connect_log_param.py`) like before. +First change the `simple_connect()` in _main_ to `simple_log(scf, lg_stab)`. Now run the script (`python3 connect_log_param.py`) like before. If everything is fine it should continuously print the logging variables, like this: From d76171c298760d9bfe5e7b369f9d1cb88cea2ce7 Mon Sep 17 00:00:00 2001 From: Stefan Thorstenson Date: Mon, 19 Jan 2026 15:32:52 +0100 Subject: [PATCH 04/10] Fixed typo --- docs/user-guides/sbs_connect_log_param.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guides/sbs_connect_log_param.md b/docs/user-guides/sbs_connect_log_param.md index a438f97c2..940853b58 100644 --- a/docs/user-guides/sbs_connect_log_param.md +++ b/docs/user-guides/sbs_connect_log_param.md @@ -296,7 +296,7 @@ def simple_log_async(scf, logconf): cf.log.add_config(logconf) ``` -Here you add the logging configuration to to the logging framework of the Crazyflie. It will check if the log configuration is part of the TOC, which is a list of all the logging variables defined in the Crazyflie. You can test this out by changing one of the `lg_stab` variables to a completely bogus name like `'not.real'`. In this case you would receive the following message: +Here you add the logging configuration to the logging framework of the Crazyflie. It will check if the log configuration is part of the TOC, which is a list of all the logging variables defined in the Crazyflie. You can test this out by changing one of the `lg_stab` variables to a completely bogus name like `'not.real'`. In this case you would receive the following message: `KeyError: 'Variable not.real not in TOC'` From 6e364504ca1e4317e93fd4c7e9d7538beec74d71 Mon Sep 17 00:00:00 2001 From: Stefan Thorstenson Date: Mon, 19 Jan 2026 15:34:37 +0100 Subject: [PATCH 05/10] Fixed typo --- docs/user-guides/sbs_connect_log_param.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guides/sbs_connect_log_param.md b/docs/user-guides/sbs_connect_log_param.md index 940853b58..bd17f3657 100644 --- a/docs/user-guides/sbs_connect_log_param.md +++ b/docs/user-guides/sbs_connect_log_param.md @@ -308,7 +308,7 @@ def log_stab_callback(timestamp, data, logconf): print('[%d][%s]: %s' % (timestamp, logconf.name, data)) ``` -This callback will be called once the log variables have received it and prints the contents. The callback function added to the logging framework by adding it to the log config in `simple_log_async(..)`: +This callback will be called once the log variables have received it and prints the contents. The callback function is added to the logging framework by adding it to the log config in `simple_log_async(..)`: ```python logconf.data_received_cb.add_callback(log_stab_callback) From f2dd11301c9828d6c689a84ee2116daca3941489 Mon Sep 17 00:00:00 2001 From: Stefan Thorstenson Date: Mon, 19 Jan 2026 15:44:46 +0100 Subject: [PATCH 06/10] Updated asynchronous example to be more clear --- docs/user-guides/sbs_connect_log_param.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/user-guides/sbs_connect_log_param.md b/docs/user-guides/sbs_connect_log_param.md index bd17f3657..71869feb2 100644 --- a/docs/user-guides/sbs_connect_log_param.md +++ b/docs/user-guides/sbs_connect_log_param.md @@ -317,11 +317,13 @@ This callback will be called once the log variables have received it and prints Then the log configuration would need to be started manually, and then stopped after a few seconds: ```python - logconf.start() + lg_stab.start() time.sleep(5) - logconf.stop() + lg_stab.stop() ``` +Instead of ```time.sleep(5)```, you have the possibility to interact with the Crazyflie in other ways, meaning you now have an asynchronous logging setup. + ## Run the script Make sure to replace the `simple_log(...)` to `simple_log_async(...)` in the `__main__` function. Run the script with `python3 connect_log_param.py` in a terminal and you should see several messages of the following: @@ -354,9 +356,6 @@ def simple_log_async(scf, logconf): cf = scf.cf cf.log.add_config(logconf) logconf.data_received_cb.add_callback(log_stab_callback) - logconf.start() - time.sleep(5) - logconf.stop() (...) @@ -372,6 +371,10 @@ if __name__ == '__main__': with SyncCrazyflie(uri, cf=Crazyflie(rw_cache='./cache')) as scf: simple_log_async(scf, lg_stab) + + lg_stab.start() + time.sleep(5) # Your possibility to interact with the Crazyflie + lg_stab.stop() ``` ## Step 3. Parameters From f117ab50308d3b9a9aea524cf42d148c77026403 Mon Sep 17 00:00:00 2001 From: Stefan Thorstenson Date: Wed, 21 Jan 2026 10:41:50 +0100 Subject: [PATCH 07/10] Typos --- docs/user-guides/sbs_motion_commander.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user-guides/sbs_motion_commander.md b/docs/user-guides/sbs_motion_commander.md index 303f49536..3486854ad 100644 --- a/docs/user-guides/sbs_motion_commander.md +++ b/docs/user-guides/sbs_motion_commander.md @@ -15,7 +15,7 @@ We will assume that you already know this before you start with the tutorial: ## Get the script started -Since you should have installed cflib in the previous step by step tutorial, you are all ready to got now. Open up an new python script called `motion_flying.py`. First you will start by adding the following import to the script: +Since you should have installed cflib in the previous step by step tutorial, you are all ready to go now. Open up an new python script called `motion_flying.py`. First you will start by adding the following import to the script: ```python import logging @@ -46,7 +46,7 @@ This probably all looks pretty familiar, except for one thing line, namely: `from cflib.positioning.motion_commander import MotionCommander` -This imports the motion commander, which is pretty much a wrapper around the position setpoint frame work of the crazyflie. You probably have unknowingly experienced this a when trying out the assist modes in this [tutorial with the flow deck in the cfclient](https://www.bitcraze.io/documentation/tutorials/getting-started-with-flow-deck/) +This imports the motion commander, which is pretty much a wrapper around the position setpoint frame work of the crazyflie. You probably have unknowingly experienced this when trying out the assist modes in this [tutorial with the flow deck in the cfclient](https://www.bitcraze.io/documentation/tutorials/getting-started-with-flow-deck/) ## Step 1: Security before flying From 14e304f7ca72cf9ab191b58a777d37e268784e23 Mon Sep 17 00:00:00 2001 From: Stefan Thorstenson Date: Thu, 22 Jan 2026 13:16:21 +0100 Subject: [PATCH 08/10] Updated code to match instructions --- docs/user-guides/sbs_motion_commander.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/user-guides/sbs_motion_commander.md b/docs/user-guides/sbs_motion_commander.md index 3486854ad..cec4a1735 100644 --- a/docs/user-guides/sbs_motion_commander.md +++ b/docs/user-guides/sbs_motion_commander.md @@ -30,11 +30,9 @@ from cflib.crazyflie.syncCrazyflie import SyncCrazyflie from cflib.positioning.motion_commander import MotionCommander from cflib.utils import uri_helper - URI = uri_helper.uri_from_env(default='radio://0/80/2M/E7E7E7E7E7') -DEFAULT_HEIGHT = 0.5 -BOX_LIMIT = 0.5 +logging.basicConfig(level=logging.ERROR) if __name__ == '__main__': @@ -150,7 +148,7 @@ Now make the function `take_off_simple(..)` above `__main__`, which will contain ```python def take_off_simple(scf): - with MotionCommander(scf, default_height=DEFAULT_HEIGHT) as mc: + with MotionCommander(scf) as mc: time.sleep(3) mc.stop() ``` From b8aa607d3b90e71bd5724c7124878e96063d4b47 Mon Sep 17 00:00:00 2001 From: Stefan Thorstenson Date: Thu, 22 Jan 2026 13:19:05 +0100 Subject: [PATCH 09/10] Add sleep after take-off to clarify the different movements --- docs/user-guides/sbs_motion_commander.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/user-guides/sbs_motion_commander.md b/docs/user-guides/sbs_motion_commander.md index cec4a1735..53ebbccf7 100644 --- a/docs/user-guides/sbs_motion_commander.md +++ b/docs/user-guides/sbs_motion_commander.md @@ -159,11 +159,12 @@ The reason for the crazyflie to immediately take off, is that the motion command ### Changing the height -Currently the motion commander had 0.3 meters height as default but this can of course be changed. +Currently the motion commander has 0.3 meters height as default but this can of course be changed. -Change the following line in `take_off_simple(...)`: +Change the following lines in `take_off_simple(...)`: ```python with MotionCommander(scf) as mc: + time.sleep(3) mc.up(0.3) time.sleep(3) mc.stop() From 544714b425e2c973c100e999c8cbf87ef0835a4a Mon Sep 17 00:00:00 2001 From: Stefan Thorstenson Date: Thu, 22 Jan 2026 13:36:27 +0100 Subject: [PATCH 10/10] Removed mc.stop as it is not necessary and not commented on --- docs/user-guides/sbs_motion_commander.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/user-guides/sbs_motion_commander.md b/docs/user-guides/sbs_motion_commander.md index 53ebbccf7..2d560f738 100644 --- a/docs/user-guides/sbs_motion_commander.md +++ b/docs/user-guides/sbs_motion_commander.md @@ -150,7 +150,6 @@ Now make the function `take_off_simple(..)` above `__main__`, which will contain def take_off_simple(scf): with MotionCommander(scf) as mc: time.sleep(3) - mc.stop() ``` If you run the python script, you will see the crazyflie connect and immediately take off. After flying for 3 seconds it will land again. @@ -167,7 +166,6 @@ Change the following lines in `take_off_simple(...)`: time.sleep(3) mc.up(0.3) time.sleep(3) - mc.stop() ``` Run the script again. The crazyflie will first take off to 0.3 meters and then goes up for another 0.3 meters. @@ -209,7 +207,6 @@ logging.basicConfig(level=logging.ERROR) def take_off_simple(scf): with MotionCommander(scf, default_height=DEFAULT_HEIGHT) as mc: time.sleep(3) - mc.stop() def param_deck_flow(name, value_str):