How to use the cfclient.utils.logconfigreader.LogVariable function in cfclient

To help you get started, we’ve selected a few cfclient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitcraze / crazyflie-clients-python / lib / cfclient / ui / dialogs / logconfigdialogue.py View on Github external
logger.warning("Could not load config")
        else:
            self.resetTrees()
            self.loggingPeriod.setText("%d" % config.getPeriod())
            self.period = config.getPeriod()
            for v in config.getVariables():
                if (v.getVarType() == LogVariable.TOC_TYPE):
                    parts = v.getName().split(".")
                    varParent = parts[0]
                    varName = parts[1]
                    if self.moveNodeByName(self.logTree,
                                            self.varTree,
                                            varParent,
                                            varName) == False:
                        logger.warning("Could not find node!!")
                elif (v.getVarType() == LogVariable.MEM_TYPE):
                    logger.warning("Error: Mem vars not supported!")
github bitcraze / crazyflie-clients-python / lib / cfclient / ui / tabs / FlightTab.py View on Github external
def connected(self, linkURI):
        # IMU & THRUST
        lg = LogConfig("Stabalizer", 50)
        lg.addVariable(LogVariable("stabilizer.roll", "float"))
        lg.addVariable(LogVariable("stabilizer.pitch", "float"))
        lg.addVariable(LogVariable("stabilizer.yaw", "float"))
        lg.addVariable(LogVariable("stabilizer.thrust", "uint16_t"))

        self.log = self.helper.cf.log.create_log_packet(lg)
        if (self.log is not None):
            self.log.dataReceived.add_callback(self._imu_data_signal.emit)
            self.log.error.add_callback(self.loggingError)
            self.log.start()
        else:
            logger.warning("Could not setup logconfiguration after "
                           "connection!")


        # MOTOR
        lg = LogConfig("Motors", 50)
        lg.addVariable(LogVariable("motor.m1", "uint32_t"))
        lg.addVariable(LogVariable("motor.m2", "uint32_t"))
github bitcraze / crazyflie-clients-python / lib / cfclient / ui / tabs / FlightTab.py View on Github external
self.log = self.helper.cf.log.create_log_packet(lg)
        if (self.log is not None):
            self.log.dataReceived.add_callback(self._imu_data_signal.emit)
            self.log.error.add_callback(self.loggingError)
            self.log.start()
        else:
            logger.warning("Could not setup logconfiguration after "
                           "connection!")


        # MOTOR
        lg = LogConfig("Motors", 50)
        lg.addVariable(LogVariable("motor.m1", "uint32_t"))
        lg.addVariable(LogVariable("motor.m2", "uint32_t"))
        lg.addVariable(LogVariable("motor.m3", "uint32_t"))
        lg.addVariable(LogVariable("motor.m4", "uint32_t"))

        self.log = self.helper.cf.log.create_log_packet(lg)
        if (self.log is not None):
            self.log.dataReceived.add_callback(self._motor_data_signal.emit)
            self.log.error.add_callback(self.loggingError)
            self.log.start()
        else:
            logger.warning("Could not setup logconfiguration after "
                           "connection!")
            
        # BARO
        lg = LogConfig("Baro", 50)
        lg.addVariable(LogVariable("baro.asl", "float"))
        lg.addVariable(LogVariable("baro.aslLong", "float"))
        lg.addVariable(LogVariable("baro.aslRaw", "float"))
        lg.addVariable(LogVariable("baro.temp", "float"))
github bitcraze / crazyflie-clients-python / lib / cfclient / ui / dialogs / logconfigdialogue.py View on Github external
def createConfigFromSelection(self):
        logconfig = LogConfig(str(self.configNameCombo.currentText()),
                              self.period)
        for node in self.getNodeChildren(self.varTree.invisibleRootItem()):
            parentName = node.text(NAME_FIELD)
            for leaf in self.getNodeChildren(node):
                varName = leaf.text(NAME_FIELD)
                varType = str(leaf.text(CTYPE_FIELD))
                completeName = "%s.%s" % (parentName, varName)
                newVar = LogVariable(completeName,
                                     fetchAs=varType,
                                     storedAs=varType)
                logconfig.addVariable(newVar)
        return logconfig
github bitcraze / crazyflie-clients-python / lib / cfclient / ui / tabs / FlightTab.py View on Github external
lg.addVariable(LogVariable("baro.asl", "float"))
        lg.addVariable(LogVariable("baro.aslLong", "float"))
        lg.addVariable(LogVariable("baro.aslRaw", "float"))
        lg.addVariable(LogVariable("baro.temp", "float"))

        self.log = self.helper.cf.log.create_log_packet(lg)
        if (self.log is not None):
            self.log.dataReceived.add_callback(self._baro_data_signal.emit)
            self.log.error.add_callback(self.loggingError)
            self.log.start()
        else:
            logger.warning("Could not setup logconfiguration after "
                           "connection!")            
        # HOVER
        lg = LogConfig("Hover", 50)
        lg.addVariable(LogVariable("hover.target", "float"))

        self.log = self.helper.cf.log.create_log_packet(lg)
        if (self.log is not None):
            self.log.dataReceived.add_callback(self._hover_data_signal.emit)
            self.log.error.add_callback(self.loggingError)
            self.log.start()
        else:
            logger.warning("Could not setup logconfiguration after "
                           "connection!")
github bitcraze / crazyflie-clients-python / lib / cfclient / ui / tabs / FlightTab.py View on Github external
lg.addVariable(LogVariable("motor.m3", "uint32_t"))
        lg.addVariable(LogVariable("motor.m4", "uint32_t"))

        self.log = self.helper.cf.log.create_log_packet(lg)
        if (self.log is not None):
            self.log.dataReceived.add_callback(self._motor_data_signal.emit)
            self.log.error.add_callback(self.loggingError)
            self.log.start()
        else:
            logger.warning("Could not setup logconfiguration after "
                           "connection!")
            
        # BARO
        lg = LogConfig("Baro", 50)
        lg.addVariable(LogVariable("baro.asl", "float"))
        lg.addVariable(LogVariable("baro.aslLong", "float"))
        lg.addVariable(LogVariable("baro.aslRaw", "float"))
        lg.addVariable(LogVariable("baro.temp", "float"))

        self.log = self.helper.cf.log.create_log_packet(lg)
        if (self.log is not None):
            self.log.dataReceived.add_callback(self._baro_data_signal.emit)
            self.log.error.add_callback(self.loggingError)
            self.log.start()
        else:
            logger.warning("Could not setup logconfiguration after "
                           "connection!")            
        # HOVER
        lg = LogConfig("Hover", 50)
        lg.addVariable(LogVariable("hover.target", "float"))

        self.log = self.helper.cf.log.create_log_packet(lg)
github gtagency / crazyflie-ros / scripts / crazyflie_node.py View on Github external
accel_log_conf.addVariable(LogVariable("acc.z", "float"))
 
        # Now that the connection is established, start logging
        self.accel_log = self.crazyflie.log.create_log_packet(accel_log_conf)
 
        if self.accel_log is not None:
            self.accel_log.dataReceived.add_callback(self.log_accel_data)
            self.accel_log.start()
        else:
            print("acc.x/y/z not found in log TOC")

        motor_log_conf = LogConfig("Motor", 10)
        motor_log_conf.addVariable(LogVariable("motor.m1", "int32_t"))
        motor_log_conf.addVariable(LogVariable("motor.m2", "int32_t"))
        motor_log_conf.addVariable(LogVariable("motor.m3", "int32_t"))
        motor_log_conf.addVariable(LogVariable("motor.m4", "int32_t"))
 
        # Now that the connection is established, start logging
        self.motor_log = self.crazyflie.log.create_log_packet(motor_log_conf)
 
        if self.motor_log is not None:
            self.motor_log.dataReceived.add_callback(self.log_motor_data)
            self.motor_log.start()
        else:
            print("motor.m1/m2/m3/m4 not found in log TOC")
github gtagency / crazyflie-ros / scripts / crazyflie_node.py View on Github external
self.setupStabilizerLog()

        """
        Configure the logger to log accelerometer values and start recording.
 
        The logging variables are added one after another to the logging
        configuration. Then the configuration is used to create a log packet
        which is cached on the Crazyflie. If the log packet is None, the
        program exits. Otherwise the logging packet receives a callback when
        it receives data, which prints the data from the logging packet's
        data dictionary as logging info.
        """
        # Set accelerometer logging config
        accel_log_conf = LogConfig("Accel", 10)
        accel_log_conf.addVariable(LogVariable("acc.x", "float"))
        accel_log_conf.addVariable(LogVariable("acc.y", "float"))
        accel_log_conf.addVariable(LogVariable("acc.z", "float"))
 
        # Now that the connection is established, start logging
        self.accel_log = self.crazyflie.log.create_log_packet(accel_log_conf)
 
        if self.accel_log is not None:
            self.accel_log.dataReceived.add_callback(self.log_accel_data)
            self.accel_log.start()
        else:
            print("acc.x/y/z not found in log TOC")

        motor_log_conf = LogConfig("Motor", 10)
        motor_log_conf.addVariable(LogVariable("motor.m1", "int32_t"))
        motor_log_conf.addVariable(LogVariable("motor.m2", "int32_t"))
        motor_log_conf.addVariable(LogVariable("motor.m3", "int32_t"))
        motor_log_conf.addVariable(LogVariable("motor.m4", "int32_t"))
github gtagency / crazyflie-ros / scripts / crazyflie_node.py View on Github external
def setupStabilizerLog(self):
        log_conf = LogConfig("Pitch", 10)
        log_conf.addVariable(LogVariable("stabilizer.pitch", "float"))
        log_conf.addVariable(LogVariable("stabilizer.roll", "float"))
        log_conf.addVariable(LogVariable("stabilizer.thrust", "int32_t"))
        log_conf.addVariable(LogVariable("stabilizer.yaw", "float"))
        self.pitch_log = self.crazyflie.log.create_log_packet(log_conf)
 
        if self.pitch_log is not None:
            self.pitch_log.dataReceived.add_callback(self.log_pitch_data)
            self.pitch_log.start()
            print("stabilizer.pitch/roll/thrust/yaw now logging")
        else:
            print("stabilizer.pitch/roll/thrust/yaw not found in log TOC")
github bitcraze / crazyflie-clients-python / lib / cfclient / ui / tabs / FlightTab.py View on Github external
lg.addVariable(LogVariable("stabilizer.thrust", "uint16_t"))

        self.log = self.helper.cf.log.create_log_packet(lg)
        if (self.log is not None):
            self.log.dataReceived.add_callback(self._imu_data_signal.emit)
            self.log.error.add_callback(self.loggingError)
            self.log.start()
        else:
            logger.warning("Could not setup logconfiguration after "
                           "connection!")


        # MOTOR
        lg = LogConfig("Motors", 50)
        lg.addVariable(LogVariable("motor.m1", "uint32_t"))
        lg.addVariable(LogVariable("motor.m2", "uint32_t"))
        lg.addVariable(LogVariable("motor.m3", "uint32_t"))
        lg.addVariable(LogVariable("motor.m4", "uint32_t"))

        self.log = self.helper.cf.log.create_log_packet(lg)
        if (self.log is not None):
            self.log.dataReceived.add_callback(self._motor_data_signal.emit)
            self.log.error.add_callback(self.loggingError)
            self.log.start()
        else:
            logger.warning("Could not setup logconfiguration after "
                           "connection!")
            
        # BARO
        lg = LogConfig("Baro", 50)
        lg.addVariable(LogVariable("baro.asl", "float"))
        lg.addVariable(LogVariable("baro.aslLong", "float"))