I would like to define stateEstimate.vx, stateEstimate.vy, and stateEstimate.vz variables to access those data. I used the following code parts.

def _connected(self, link_uri):

        self._lg_stab = LogConfig(name='Stabilizer', period_in_ms=100)
        self._lg_stab.add_variable('stateEstimate.x', 'float')
        self._lg_stab.add_variable('stateEstimate.y', 'float')
        self._lg_stab.add_variable('stateEstimate.z', 'float')
        self._lg_stab.add_variable('stateEstimate.vx', 'float')
        self._lg_stab.add_variable('stateEstimate.vy', 'float')
        self._lg_stab.add_variable('stateEstimate.vz', 'float')        
        self._lg_stab.add_variable('stateEstimate.roll', 'float')
        self._lg_stab.add_variable('stateEstimate.pitch', 'float')
        self._lg_stab.add_variable('stateEstimate.yaw', 'float')
        self._lg_range = LogConfig(name='Range', period_in_ms=100)
        self._lg_range.add_variable('range.zrange', 'uint16_t')
        self._lg_range.add_variable('range.front', 'uint16_t')
        self._lg_range.add_variable('range.right', 'uint16_t')
        self._lg_range.add_variable('range.left', 'uint16_t')
        self._lg_range.add_variable('range.back', 'uint16_t')

        except KeyError as e:
            print('Could not start log configuration,'
                  '{} not found in TOC'.format(str(e)))
        except AttributeError:
            print('Could not add Stabilizer log config, bad configuration.')

When I run my python file via ROS2, I saw the following part on the terminal (Could not add Stabilizer log config, bad configuration). I could not get why it happens. However, whenver I use the above code part without stateEstimate.vx, stateEstimate.vy, and stateEstimate.vz, it works pretty well. Could you help us to fix it, thanks.

ntukenmez3@ae-icps-407120:~/Documents/2023-crazy-flie-1/crazyflie_ros2_experimental_2/crazyflie_ros2$ ros2 run crazyflie_ros2 crazyflie_publisher 
[INFO] [1698871075.735318053] [crazyflie_publisher]: Connected!
Could not add Stabilizer log config, bad configuration.
  • 1
    $\begingroup$ hmm.... strange I didn't get a notification of this support question... I'm even monitoring the UAV tag!. If it takes too long, make an issue on the experimental repository or start a thread on the bitcraze forum $\endgroup$ Nov 13, 2023 at 13:47

1 Answer 1


The error itself comes from your own (or the copied) script

        except AttributeError:
            print('Could not add Stabilizer log config, bad configuration.')`

This is an error but it is not clear why it fails. Here is the API documentation of the crazyflie python library logging functionality:


Here it says that you can only create logblocks for messages that are no larger than 30 bytes. the logblock 'Stabilizer' contains 36 bytes (9 x float which is 4 bytes each). So therefore it fails.

If you look in the documentation, you can see that there is a possibility of declaring a 16 - bit (2 byte) float. In the logblock declaration, you can replace 'float' with 'FP16', and reduce the total message size. This should fix it.

  • $\begingroup$ Yes, you are right. I changed the data type and it worked. $\endgroup$ Nov 13, 2023 at 17:21
  • 1
    $\begingroup$ great! good to hear $\endgroup$ Nov 14, 2023 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.