当前位置: 首页>>代码示例>>Python>>正文


Python logconfigreader.LogConfig类代码示例

本文整理汇总了Python中cfclient.utils.logconfigreader.LogConfig的典型用法代码示例。如果您正苦于以下问题:Python LogConfig类的具体用法?Python LogConfig怎么用?Python LogConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LogConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _connected

    def _connected(self, link_uri):
        """ This callback is called form the Crazyflie API when a Crazyflie
        has been connected and the TOCs have been downloaded."""
        print "Connected to %s" % link_uri

        Thread(target=self._control).start()

        ########################################################################
        # Set up Stabilizer Logger
        ########################################################################
        self._lg_stab = LogConfig(name="Stabilizer", period_in_ms=10)
        self._lg_stab.add_variable("stabilizer.roll", "float")
        self._lg_stab.add_variable("stabilizer.pitch", "float")
        self._lg_stab.add_variable("stabilizer.yaw", "float")
        self._cf.log.add_config(self._lg_stab)
        if self._lg_stab.valid:
            # This callback will receive the data
            self._lg_stab.data_received_cb.add_callback(self._log_stab_data)
            # This callback will be called on errors
            self._lg_stab.error_cb.add_callback(self._log_error)
            # Start the logging
            self._lg_stab.start()
        else:
            print("Could not add logconfig since some variables are not in TOC")

        ########################################################################
        # Set up Acc Logger
        ########################################################################
        self._lg_acc = LogConfig(name="Acc", period_in_ms=10)
        self._lg_acc.add_variable("acc.x", "float")
        self._lg_acc.add_variable("acc.y", "float")
        self._lg_acc.add_variable("acc.z", "float")
        self._cf.log.add_config(self._lg_acc)
        if self._lg_acc.valid:
            # This callback will receive the data
            self._lg_acc.data_received_cb.add_callback(self._log_acc_data)
            # This callback will be called on errors
            self._lg_acc.error_cb.add_callback(self._log_error)
            # Start the logging
            self._lg_acc.start()
        else:
            print("Could not add logconfig since some variables are not in TOC")

        ########################################################################
        # Set up Gyro Logger
        ########################################################################
        self._lg_gyro = LogConfig(name="Gyro", period_in_ms=10)
        self._lg_gyro.add_variable("gyro.x", "float")
        self._lg_gyro.add_variable("gyro.y", "float")
        self._lg_gyro.add_variable("gyro.z", "float")
        self._cf.log.add_config(self._lg_gyro)
        if self._lg_gyro.valid:
            # This callback will receive the data
            self._lg_gyro.data_received_cb.add_callback(self._log_gyro_data)
            # This callback will be called on errors
            self._lg_gyro.error_cb.add_callback(self._log_error)
            # Start the logging
            self._lg_gyro.start()
        else:
            print("Could not add logconfig since some variables are not in TOC")
开发者ID:dreal,项目名称:quadcopter,代码行数:60,代码来源:quad_20140213.py

示例2: connectSetupFinished

    def connectSetupFinished(self, linkURI):
        """
        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 stabilizer logging config
        acc_log_conf = LogConfig("acc", 10)
        acc_log_conf.addVariable(LogVariable("acc.x", "float"))
        acc_log_conf.addVariable(LogVariable("acc.y", "float"))
        acc_log_conf.addVariable(LogVariable("acc.z", "float"))

        # Now that the connection is established, start logging
        self.acc_log = self.crazyflie.log.create_log_packet(acc_log_conf)

        if self.acc_log is not None:
            self.acc_log.dataReceived.add_callback(self.log_acc_data)
            self.acc_log.start()
        else:
            print("acc.x/y/z not found in log TOC")
开发者ID:dreal,项目名称:quadcopter,代码行数:25,代码来源:testcode5.py

示例3: _connected

    def _connected(self, link_uri):
        """ This callback is called form the Crazyflie API when a Crazyflie
        has been connected and the TOCs have been downloaded."""

        rospy.loginfo("Connected to %s" % link_uri)
        self._state = CrazyflieROS.Connected

        self._lg_imu = LogConfig(name="IMU", period_in_ms=10)
        self._lg_imu.add_variable("acc.x", "float")
        self._lg_imu.add_variable("acc.y", "float")
        self._lg_imu.add_variable("acc.z", "float")
        self._lg_imu.add_variable("gyro.x", "float")
        self._lg_imu.add_variable("gyro.y", "float")
        self._lg_imu.add_variable("gyro.z", "float")

        self._cf.log.add_config(self._lg_imu)
        if self._lg_imu.valid:
            # This callback will receive the data
            self._lg_imu.data_received_cb.add_callback(self._log_data_imu)
            # This callback will be called on errors
            self._lg_imu.error_cb.add_callback(self._log_error)
            # Start the logging
            self._lg_imu.start()
        else:
            rospy.logfatal("Could not add logconfig since some variables are not in TOC")

        self._lg_log2 = LogConfig(name="LOG2", period_in_ms=100)
        self._lg_log2.add_variable("mag.x", "float")
        self._lg_log2.add_variable("mag.y", "float")
        self._lg_log2.add_variable("mag.z", "float")
        self._lg_log2.add_variable("baro.temp", "float")
        self._lg_log2.add_variable("baro.pressure", "float")
        self._lg_log2.add_variable("pm.vbat", "float")
	self._lg_log2.add_variable("test.tval", "float")

        self._cf.log.add_config(self._lg_log2)
        if self._lg_log2.valid:
            # This callback will receive the data
            self._lg_log2.data_received_cb.add_callback(self._log_data_log2)
            # This callback will be called on errors
            self._lg_log2.error_cb.add_callback(self._log_error)
            # Start the logging
            self._lg_log2.start()
        else:
            rospy.logfatal("Could not add logconfig since some variables are not in TOC")

        p_toc = self._cf.param.toc.toc
        for group in p_toc.keys():
            self._cf.param.add_update_callback(group=group, name=None, cb=self._param_callback)
            for name in p_toc[group].keys():
                ros_param = "~{}/{}".format(group, name)
                cf_param = "{}.{}".format(group, name)
                if rospy.has_param(ros_param):
                    self._cf.param.set_value(cfparam, rospy.get_param(ros_param))
                else:
                    self._cf.param.request_param_update(cf_param)
开发者ID:gnunoe,项目名称:Cf_ROS,代码行数:56,代码来源:crazyflie_param.py

示例4: connectSetupFinished

    def connectSetupFinished(self, linkURI):
        """
        Set the loggers
        """
        # Log stabilizer
        self.logStab = LogConfig("Stabalizer", 200)
        self.logStab.add_variable("stabilizer.roll", "float")
        self.logStab.add_variable("stabilizer.pitch", "float")
        self.logStab.add_variable("stabilizer.yaw", "float")
        self.logStab.add_variable("stabilizer.thrust", "uint16_t")
 
        self.crazyflie.log.add_config(self.logStab)
 
        if self.logStab.valid:
            self.logStab.data_received_cb.add_callback(self.print_stab_data)
            self.logStab.start()
        else:
            logger.warning("Could not setup log configuration for stabilizer after connection!")

        # Log barometer
        self.logBaro = LogConfig("Baro", 200)
        self.logBaro.add_variable("baro.aslLong", "float")

        self.crazyflie.log.add_config(self.logBaro)
        if self.logBaro.valid:
            self.logBaro.data_received_cb.add_callback(self.print_baro_data)
            self.logBaro.start()
        else:
            logger.warning("Could not setup log configuration for barometer after connection!")

        # Log Accelerometer
        self.logAccel = LogConfig("Accel",200)
        self.logAccel.add_variable("acc.x", "float")
        self.logAccel.add_variable("acc.y", "float")
        self.logAccel.add_variable("acc.z", "float")

        self.crazyflie.log.add_config(self.logAccel)

        if self.logAccel.valid:
            self.logAccel.data_received_cb.add_callback(self.print_accel_data)
            self.logAccel.start()
        else:
            logger.warning("Could not setup log configuration for accelerometer after connection!")

        # Call the requested thrust profile. 
        # Start a separate thread to run test.
        # Do not hijack the calling thread!
        if args.thrust_profile == 'increasing_step':
            Thread(target=self.increasing_step).start()
        if args.thrust_profile == 'prbs_hover':
            Thread(target=self.prbs_hover).start()
        if args.thrust_profile == 'prbs_asc':
            Thread(target=self.prbs_asc).start()
        if args.thrust_profile == 'prbs_desc':
            Thread(target=self.prbs_desc).start()
开发者ID:patxu,项目名称:attackofthedrones,代码行数:55,代码来源:test_flight.py

示例5: createConfigFromSelection

 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
开发者ID:djvolz,项目名称:Self-Navigating-Crazyflie-Quadcopter,代码行数:11,代码来源:logconfigdialogue.py

示例6: _init_logs

	def _init_logs(self):
		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"))
		
		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")	
开发者ID:LARS-robotics,项目名称:lars-ros,代码行数:13,代码来源:crazyflie_node.py

示例7: connectionDone

    def connectionDone(self, linkURI):
        self.setUIState(UIState.CONNECTED, linkURI)

        GuiConfig().set("link_uri", linkURI)

        lg = LogConfig("Battery", 1000)
        lg.addVariable(LogVariable("pm.vbat", "float"))
        self.log = self.cf.log.create_log_packet(lg)
        if self.log != None:
            self.log.dataReceived.add_callback(self.batteryUpdatedSignal.emit)
            self.log.error.add_callback(self.loggingError)
            self.log.start()
        else:
            logger.warning("Could not setup loggingblock!")
开发者ID:EmilBechMadsen,项目名称:dronecharge,代码行数:14,代码来源:main.py

示例8: connectSetupFinished

 def connectSetupFinished(self, linkURI):
     lg = LogConfig("Magnetometer", 100)
     lg.addVariable(LogVariable("mag.x", "int16_t"))
     lg.addVariable(LogVariable("mag.y", "int16_t"))
     lg.addVariable(LogVariable("mag.z", "int16_t"))
         
     log = self.crazyflie.log.create_log_packet(lg)
     if log is not None:
         log.dataReceived.add_callback(self.magData)
         log.start()
     else:
         print "Magnetometer not found in log TOC"        
     
     # Keep the commands alive so the firmware kill-switch doesn't kick in.
     Thread(target=self.pulse_command).start()
     Thread(target=self.input_loop).start()
开发者ID:ak1394,项目名称:crazyflie-magnetometer-calibration,代码行数:16,代码来源:calibrate_hardsoft.py

示例9: _connected

    def _connected(self, link_uri):
        """ This callback is called form the Crazyflie API when a Crazyflie
        has been connected and the TOCs have been downloaded."""

        #setup log config for sensor
        self._log_sensor = LogConfig("Logs", 1000)
        self._log_sensor.add_variable("altHold.err")
        self._log_sensor.add_variable("altHold.target")

        #self._cf.log.add_config(self._log_sensor)

        try:
            self._cf.log.add_config(self._log_sensor)
            # This callback will receive the data
            self._log_sensor.data_received_cb.add_callback(self._log_data)
            # This callback will be called on errors
            self._log_sensor.error_cb.add_callback(self._log_error)
            # Start the logging
            self._log_sensor.start()
        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.")

        # Start a timer to disconnect in s
        print("Motors ON, starting timer")
         # Start a timer to disconnect in 10s


        t = Timer(5, self._landing)
        t.start()
        # Start a separate thread to do the motor test.
        # Do not hijack the calling thread!
        Thread(target=self._ramp_motors).start()
开发者ID:gitwikta,项目名称:testing,代码行数:35,代码来源:test_hover_0.4.py

示例10: log_thread

    def log_thread(self):

        self.log_acc = LogConfig(name="acc", period_in_ms=100)
        self.log_acc.add_variable("acc.x", "float")
        self.log_acc.add_variable("acc.y", "float")
        self.log_acc.add_variable("acc.z", "float")

        self.log_acc.add_variable("gyro.x", "float")
        self.log_acc.add_variable("gyro.y", "float")
        self.log_acc.add_variable("gyro.z", "float")

        try:
            self.cf.log.add_config(self.log_acc)

            # This callback will receive the data
            self.log_acc.data_received_cb.add_callback(self.log_received_acc)

            # # This callback will be called on errors
            self.log_acc.error_cb.add_callback(self.log_error)

            # Start the logging
            self.log_acc.start()
        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."
开发者ID:Venris,项目名称:crazyflie-multilink,代码行数:27,代码来源:CF_class_imu.py

示例11: log_thread

    def log_thread(self):
        print "test"
        self.log = LogConfig(name="logs", period_in_ms=10)
        self.log.add_variable("stabilizer.roll", "float")
        self.log.add_variable("stabilizer.pitch", "float")
        self.log.add_variable("stabilizer.yaw", "float")
        # self.log.add_variable("stabilizer.thrust", "float")
        # self.log.add_variable("motor.m1", "float")
        # self.log.add_variable("motor.m2", "float")
        # self.log.add_variable("motor.m3", "float")
        # self.log.add_variable("motor.m4", "float")

        try:
            print "test 2"
            self.cf.log.add_config(self.log)
            # This callback will receive the data
            self.log.data_received_cb.add_callback(self.log_received)
            # # This callback will be called on errors
            self.log.error_cb.add_callback(self.log_error)
            # Start the logging
            self.log.start()
        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."
开发者ID:Venris,项目名称:crazyflie-multilink,代码行数:26,代码来源:CF_class.py

示例12: connectSetupFinished

    def connectSetupFinished(self, linkURI):
        """
        Set the loggers
        """

        # Log barometer
        # we use only barometer value(ASL Value) to control altitude
        self.logBaro = LogConfig("Baro", 200)
        self.logBaro.add_variable("baro.aslLong", "float")
        self.crazyflie.log.add_config(self.logBaro)
        if  self.logBaro.valid:
            self.logBaro.data_received_cb.add_callback(self.print_baro_data)
            self.logBaro.start()
        else:
            print 'Could not setup log configuration for barometer after connection!'





        # Start another thread and doing control function call
        print "log for debugging: before start increasing_step"

        # Thread(target=self.increasing_step).start()
        # Thread(target=self.recursive_step).start()

        Thread(target=self.init_alt).start()
开发者ID:Daomaster,项目名称:Crazyflie-DDrone,代码行数:27,代码来源:Dance_Test.py

示例13: _connected

    def _connected(self, link_uri):
        """ This callback is called form the Crazyflie API when a Crazyflie
        has been connected and the TOCs have been downloaded."""
        print "Connected to %s" % link_uri

        # The definition of the logconfig can be made before connecting
        self._lg_stab = LogConfig(name="Stabilizer", period_in_ms=2000)
        self._lg_stab.add_variable("gyro.x", "float")
        self._lg_stab.add_variable("gyro.y", "float")
        self._lg_stab.add_variable("gyro.z", "float")
        self._lg_stab.add_variable("stabilizer.roll", "float")
        self._lg_stab.add_variable("stabilizer.pitch", "float")
        self._lg_stab.add_variable("stabilizer.yaw", "float")
        self._lg_stab.add_variable("stabilizer.thrust", "uint16_t")

        # Adding the configuration cannot be done until a Crazyflie is
        # connected, since we need to check that the variables we
        # would like to log are in the TOC.
        self._cf.log.add_config(self._lg_stab)
        if self._lg_stab.valid:
            # This callback will receive the data
            self._lg_stab.data_received_cb.add_callback(self._stab_log_data)
            # This callback will be called on errors
            self._lg_stab.error_cb.add_callback(self._stab_log_error)
            # Start the logging
            self._lg_stab.start()
        else:
            print("Could not add logconfig since some variables are not in TOC")

        self._cf.commander.send_setpoint(0, 0, 0, 20000)
开发者ID:nqs,项目名称:quopper,代码行数:30,代码来源:basiclog.py

示例14: _connected

    def _connected(self, link_uri):
        """ This callback is called form the Crazyflie API when a Crazyflie
        has been connected and the TOCs have been downloaded."""

        #setup log config for sensor
        self._log_sensor = LogConfig("Logs", 200)
        self._log_sensor.add_variable("baro.aslLong")
        self._cf.log.add_config(self._log_sensor)

        if self._log_sensor.valid:
             # This callback will receive the data
           self._log_sensor.data_received_cb.add_callback(self._log_data)
            # This callback will be called on errors
           self._log_sensor.error_cb.add_callback(self._log_error)
            # Start the logging
           self._log_sensor.start()
        else:
           print("Could not add logconfig since some variables are not in TOC")

        # Start a timer to disconnect in s
        print("Motors ON, starting timer")

        t = Timer(3, self._landing)
        t.start()
        # Start a separate thread to do the motor test.
        # Do not hijack the calling thread!
        Thread(target=self._ramp_motors).start()

        print("sleeping 20")
        time.sleep(20)
开发者ID:gitwikta,项目名称:testing,代码行数:30,代码来源:test_hover_0.1.py

示例15: _connected

    def _connected(self, link_uri):
        """ This callback is called form the Crazyflie API when a Crazyflie
        has been connected and the TOCs have been downloaded."""
        print "Connected to %s" % link_uri
        #Start the motors
        #Thread(target=self._ramp_motors).start()
        # The definition of the logconfig can be made before connecting
        self._lg_stab = LogConfig(name="Sensors", period_in_ms=10)

        self._lg_stab.add_variable("stabilizer.roll", "float")
        self._lg_stab.add_variable("stabilizer.pitch", "float")
        self._lg_stab.add_variable("stabilizer.yaw", "float")
        
        self._lg_stab.add_variable("pm.vbat", "float") 
        """
        self._lg_stab.add_variable("motor.m1", "float")
        self._lg_stab.add_variable("motor.m2", "float")
        self._lg_stab.add_variable("motor.m3", "float")
        self._lg_stab.add_variable("motor.m4", "float")
        print "4"
        """
        # Adding the configuration cannot be done until a Crazyflie is
        # connected, since we need to check that the variables we
        # would like to log are in the TOC.
        self._cf.log.add_config(self._lg_stab)
        if self._lg_stab.valid:
            # This callback will receive the data
            self._lg_stab.data_received_cb.add_callback(self._stab_log_data)
            # This callback will be called on errors
            self._lg_stab.error_cb.add_callback(self._stab_log_error)
            # Start the logging
            self._lg_stab.start()
        else:
            print("Could not add logconfig since some variables are not in TOC")
开发者ID:gradyrw,项目名称:pi3-crazyflie,代码行数:34,代码来源:crazyflie_angles.py


注:本文中的cfclient.utils.logconfigreader.LogConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。