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


Python InstanceFileHandler.InstanceFileHandler类代码示例

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


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

示例1: testGatherCoeffs

    def testGatherCoeffs(self):
        sampleInstanceFile = self.testDirectory + \
            '/test_files/sample_instance.xml'
        instanceFileHandler = InstanceFileHandler(sampleInstanceFile)

        coeffs = instanceFileHandler.gatherCoeffs("/left_leg/j1")

        expectedCoeffs = {'TemperatureSensor_SensorLoc2': 2.0, 'TemperatureSensor_SensorLoc1': 1.0, 'JointSensors_OutputPosition': 2.0,
                          'IGainAmpsPerBit': 0.018928, 'DeltaAPSSafeLimit': 9999.0, 'TorqueControl_enablePID': 1.0,
                          'TorqueControl_FFd_fc_Hz': 25.0, 'APS1DriftSafeLimit': 9999.0, 'PositionControl_MotorTorqueDirection': 1.0,
                          'TorqueControl_Kd_fc_Hz': 50.0, 'VelocitySafeLimit': 9999.0, 'WindingResistance': 2.112, 'JointOutputAPS_MountingGain': 1.0,
                          'JointSafety_LowerLimit_Rad': -3.15, 'CommTimeoutMs': 80.0, 'PhaseACurOffset': 2048.0, 'JerkSafeLimit': 9999.0,
                          'BusVoltage_SensorGain': 0.163412, 'PositionOffset_Rad': -1.6651, 'EncMountingDir': 1.0, 'TorqueControl_TdobWindupLimit_Nm': 80.0,
                          'MotorAccFilter_fc_Hz': 50.0, 'JointOutputAPS_CountsToRad': 0.00076699038, 'PhaseCCurOffset': 2045.0, 'SpaceVector_MaxNormVoltage': 0.666,
                          'MotorWindingType': 0.0, 'TorqueControl_Tdob_fc_Hz': 50.0, 'JointSensors_OutputVelocity': 1.0, 'Renishaw_CountsToRad': 5.8516723e-09,
                          'TorqueControl_m': 1.2, 'EncoderIndexOffset': 1.16973095726, 'BusVoltage_BitOffset': 2048.0, 'SpringStiffness': 2750.0,
                          'Inductance_DAxis': 0.0009, 'MotorVelFilter_fc_Hz': 800.0, 'JointKinematicDir': -1.0, 'TorqueOffset_Nm': -9.39, 'TemperatureSensor_MaxTemp1': 125.0,
                          'TorqueControl_MotorTorqueDirection': 1.0, 'TemperatureSensor_MaxTemp2': 110.0, 'PositionControl_Kd': 1.0, 'TorqueControl_Current2MotorTorque': 0.0375,
                          'PhaseBCurOffset': 2048.0, 'TorqueControl_PD_damp': 0.95, 'EncDriftSafeLimit': 9999.0, 'DeadTimeCompensation': 0.02, 'TorqueControl_b': 70.0, 'TorqueControl_enableDOB': 0.0,
                          'SpringAPS_MountingGain': -1.0, 'PositionControl_Kd_fc_Hz': 50.0, 'Inductance_QAxis': 0.00139, 'JointVelFilter_fc_Hz': 30.0,
                          'PositionControl_Kp': 500.0, 'TorqueControl_enableFF': 1.0, 'JointGearRatio': 160.0, 'NumberOfPoles': 8.0, 'PositionControl_SensorFeedback': 4.0,
                          'PositionControl_Input_fc_Hz': 30.0, 'JointMinValue': -3.14159265359, 'FluxLinkage': 0.0444, 'TorqueControl_Kd': 0.03, 'JointTorqueLimit_Nm': 10.0,
                          'TorqueControl_Kp': 3.351, 'SpringAPS_BitOffset': 115108200.0, 'JointSensors_MotorPosition': 1.0, 'JointSafety_LimitZone_Rad': 0.07,
                          'TorqueControl_enableDynFF': 0.0, 'TorqueControl_autoKd': 0.0, 'JointSensors_OutputForce': 2.0, 'PositionControl_enableInLPF': 1.0,
                          'Commutation_Select': 2.0, 'JointMaxValue': 3.14159265359, 'CurrVelFilter_fc_Hz': 200.0, 'TorqueControl_ParallelDamping': 0.0, 'JointSafety_UpperLimit_Rad': 3.15,
                          'EncoderCPR': 544.0, 'SpaceVector_CurrentToSV': 1.0, 'CurrentSafeLimit': 13.0, 'EffortControl_Alpha': 0.0, 'EffortControl_AlphaDot': 0.5}
        import difflib
        a = '\n'.join(['%s:%s' % (key, value) for (key, value) in sorted(coeffs.items())])
        b = '\n'.join(['%s:%s' % (key, value) for (key, value) in sorted(expectedCoeffs.items())])
        for coeff in coeffs:
            assert not coeff==None
开发者ID:uml-robotics,项目名称:val_description,代码行数:31,代码来源:test_InstanceFileHandler.py

示例2: testGatherCoeffsHandleKeyError

    def testGatherCoeffsHandleKeyError(self):
        sampleInstanceFile = self.testDirectory + \
            '/test_files/sample_instance.xml'
        instanceFileHandler = InstanceFileHandler(sampleInstanceFile)

    # This next line should NOT raise a key error!
        coeffs = instanceFileHandler.gatherCoeffs("/bum_leg/j1")
开发者ID:uml-robotics,项目名称:val_description,代码行数:7,代码来源:test_InstanceFileHandler.py

示例3: testGetMechanisms

    def testGetMechanisms(self):
        sampleInstanceFile = self.testDirectory + '/test_files/valkyrie_A.xml'
        instanceFileHandler = InstanceFileHandler(sampleInstanceFile)
        mechanisms = instanceFileHandler.getMechanisms()
        mechanism_ids = ['leftHipYaw',
                         'leftHipRoll',
                         'leftHipPitch',
                         'leftKneePitch',
                         'leftAnkle',
                         'rightHipYaw',
                         'rightHipRoll',
                         'rightHipPitch',
                         'rightKneePitch',
                         'rightAnkle',
                         'leftShoulderPitch',
                         'leftShoulderRoll',
                         'leftShoulderYaw',
                         'leftElbowPitch',
                         'leftForearmYaw',
                         'leftWrist',
                         'rightShoulderPitch',
                         'rightShoulderRoll',
                         'rightShoulderYaw',
                         'rightElbowPitch',
                         'rightForearmYaw',
                         'rightWrist',
                         'lowerNeckPitch',
                         'neckYaw',
                         'upperNeckPitch',
                         'torso_yaw',
                         'waist']

        for mechanism in mechanisms:
            assert mechanism.tag == 'Mechanism'
            assert mechanism.get('id') in mechanism_ids
开发者ID:uml-robotics,项目名称:val_description,代码行数:35,代码来源:test_InstanceFileHandler.py

示例4: testSubclassFiles

    def testSubclassFiles(self):
        sampleInstanceFile = self.testDirectory + '/test_files/sample_instance.xml'
        instanceFileHandler = InstanceFileHandler(sampleInstanceFile)

        ankleLinearCoeffs = instanceFileHandler.gatherCoeffs('/left_leg/ankle/actuator0')
        torsoLinearCoeffs = instanceFileHandler.gatherCoeffs('/trunk/left_actuator')

        assert(torsoLinearCoeffs['ForceControl_SensorFeedback'] == 0)
        assert(ankleLinearCoeffs['ForceControl_SensorFeedback'] == 1)

        assert(torsoLinearCoeffs['ForceControl_Kp'] == 1)
        assert(torsoLinearCoeffs['ForceControl_Kd'] == 2)

        assert(ankleLinearCoeffs['ForceControl_Kp'] == 3)
        assert(ankleLinearCoeffs['ForceControl_Kd'] == 4)

        assert(torsoLinearCoeffs['EffortControl_Alpha'] == 0.99)
        assert(torsoLinearCoeffs['EffortControl_AlphaDot'] == 0.9)

        assert(ankleLinearCoeffs['EffortControl_Alpha'] == 0.93)
        assert(ankleLinearCoeffs['EffortControl_AlphaDot'] == 0.45)

        assert(torsoLinearCoeffs['SpringStiffness'] == 714000.0)

        assert(ankleLinearCoeffs['SpringStiffness'] == 1.6085e6)
开发者ID:RIVeR-Lab,项目名称:ihmc-open-robotics-software,代码行数:25,代码来源:test_InstanceFileHandler.py

示例5: testLoadXMLCoeffs

    def testLoadXMLCoeffs(self):
        sampleInstanceFile = self.testDirectory + \
            '/test_files/sample_instance.xml'
        instanceFileHandler = InstanceFileHandler(sampleInstanceFile)

        expectedCoeffs = {'JointSensors_OutputPosition': {'source': 'v_a_001.xml', 'value': 2.0},
                          'PositionControl_MotorTorqueDirection': {'source': 'v_a_001.xml', 'value': 1.0},
                          'JointOutputAPS_MountingGain': {'source': 'v_a_001.xml', 'value': 1.0},
                          'SpringAPS_MountingGain': {'source': 'v_a_001.xml', 'value': -1.0},
                          'PositionControl_enableInLPF': {'source': 'v_a_001.xml', 'value': 1.0},
                          'PositionOffset_Rad': {'source': 'v_a_001.xml', 'value': -1.6651},
                          'JointSensors_OutputVelocity': {'source': 'v_a_001.xml', 'value': 1.0},
                          'TorqueOffset_Nm': {'source': 'v_a_001.xml', 'value': -9.39},
                          'EncoderIndexOffset': {'source': 'v_a_001.xml', 'value': 1.16973095726},
                          'JointKinematicDir': {'source': 'v_a_001.xml', 'value': -1.0},
                          'TorqueControl_MotorTorqueDirection': {'source': 'v_a_001.xml', 'value': 1.0},
                          'EncMountingDir': {'source': 'v_a_001.xml', 'value': 1.0},
                          'JointMaxValue': {'source': 'v_a_001.xml', 'value': 3.14159265359},
                          'JointSensors_OutputForce': {'source': 'v_a_001.xml', 'value': 2.0},
                          'JointMinValue': {'source': 'v_a_001.xml', 'value': -3.14159265359},
                          'SpringAPS_BitOffset': {'source': 'v_a_001.xml', 'value': 115108200.0},
                          'JointSensors_MotorPosition': {'source': 'v_a_001.xml', 'value': 1.0},
                          'JointSafety_LimitZone_Rad': {'source': 'v_a_001.xml', 'value': 0.07},
                          'PositionControl_Input_fc_Hz': {'source': 'v_a_001.xml', 'value': 30.0}}

        assert cmp(instanceFileHandler.loadXMLCoeffs(
            'v_a_001.xml'), expectedCoeffs) == 0
开发者ID:uml-robotics,项目名称:val_description,代码行数:27,代码来源:test_InstanceFileHandler.py

示例6: testLoadAnkleInstanceFile

    def testLoadAnkleInstanceFile(self):
        sampleInstanceFile = self.testDirectory + '/test_files/ankle_instance.xml'
        instanceFileHandler = InstanceFileHandler(sampleInstanceFile)

        nodesToCheck = instanceFileHandler.getNodeNames()

        assert '/left_leg/ankle/left_actuator' in nodesToCheck
        assert '/left_leg/ankle/right_actuator' in nodesToCheck
开发者ID:uml-robotics,项目名称:val_description,代码行数:8,代码来源:test_InstanceFileHandler.py

示例7: testGetNodeType

    def testGetNodeType(self):
        sampleInstanceFile = self.testDirectory + \
            '/test_files/sample_instance.xml'
        instanceFileHandler = InstanceFileHandler(sampleInstanceFile)

        expectedNodeType = 'turbodriver'
        nodeType = instanceFileHandler.getNodeType('/left_leg/j1')

        assert nodeType == expectedNodeType
开发者ID:uml-robotics,项目名称:val_description,代码行数:9,代码来源:test_InstanceFileHandler.py

示例8: testGetChannels

 def testGetChannels(self):
     sampleInstanceFile = self.testDirectory + '/test_files/valkyrie_A.xml'
     instanceFileHandler = InstanceFileHandler(sampleInstanceFile)
     channels = instanceFileHandler.getChannels()
     channelsToCheck = [
         '/right_arm', '/left_arm', '/right_leg', '/left_leg', '/neck', '/trunk']
     for channel in channels:
         assert channel.tag == 'Channel'
         assert channel.get('id') in channelsToCheck
开发者ID:uml-robotics,项目名称:val_description,代码行数:9,代码来源:test_InstanceFileHandler.py

示例9: testGetDevices

 def testGetDevices(self):
     sampleInstanceFile = self.testDirectory + '/test_files/valkyrie_A.xml'
     instanceFileHandler = InstanceFileHandler(sampleInstanceFile)
     devices = instanceFileHandler.getDevices()
     devicesToCheck = ['pelvis_middle_imu', 'pelvis_rear_imu', 'torso_left_imu',
                       'torso_right_imu', 'left_foot_force_torque', 'right_foot_force_torque']
     for device in devices:
         assert device.tag == 'Device'
         assert device.get('id') in devicesToCheck
开发者ID:uml-robotics,项目名称:val_description,代码行数:9,代码来源:test_InstanceFileHandler.py

示例10: testGetFirmwareType

    def testGetFirmwareType(self):
        sampleInstanceFile = self.testDirectory + \
            '/test_files/sample_instance.xml'
        instanceFileHandler = InstanceFileHandler(sampleInstanceFile)

        expectedFirmwareType = 'rotary/turbo_bootloader.bin'
        firmwareType = instanceFileHandler.getFirmware('/left_leg/j1')

        assert firmwareType == expectedFirmwareType
开发者ID:uml-robotics,项目名称:val_description,代码行数:9,代码来源:test_InstanceFileHandler.py

示例11: testGetActuatorCoeffFromNodeName

    def testGetActuatorCoeffFromNodeName(self):
        sampleInstanceFile = self.testDirectory + '/test_files/sample_instance.xml'
        instanceFileHandler = InstanceFileHandler(sampleInstanceFile)

        keys = ['/left_leg/j1', '/left_leg/ankle/actuator0', '/left_leg/ankle/actuator1']
        testFiles = ['v_a_001.xml', 'v_e_001.xml', 'v_e_002.xml']

        assert instanceFileHandler.getActuatorCoeffFileByNode(keys[0]) == testFiles[0]
        assert instanceFileHandler.getActuatorCoeffFileByNode(keys[1]) == testFiles[1]
        assert instanceFileHandler.getActuatorCoeffFileByNode(keys[2]) == testFiles[2]
开发者ID:uml-robotics,项目名称:val_description,代码行数:10,代码来源:test_InstanceFileHandler.py

示例12: testGetActuatorSerialNumberByNode

    def testGetActuatorSerialNumberByNode(self):
        sampleInstanceFile = self.testDirectory + '/test_files/valkyrie_A.xml'
        instanceFileHandler = InstanceFileHandler(sampleInstanceFile)
        node = '/left_leg/j4'
        serialNumberToCheck = 'v_d_001'
        serialNumber = instanceFileHandler.getActuatorSerialNumberByNode(node)

        assert serialNumber == serialNumberToCheck

        node = '/left_leg/ankle/left_actuator'
        serialNumberToCheck = 'v_e_001'
        serialNumber = instanceFileHandler.getActuatorSerialNumberByNode(node)

        assert serialNumber == serialNumberToCheck
开发者ID:uml-robotics,项目名称:val_description,代码行数:14,代码来源:test_InstanceFileHandler.py

示例13: testInstanceConfigDictionary

    def testInstanceConfigDictionary(self):
        sampleInstanceFile = self.testDirectory + \
            '/test_files/sample_instance.xml'
        instanceFileHandler = InstanceFileHandler(sampleInstanceFile)

        expectedConfigDictionary = {'/left_leg/ankle/actuator0': {'configFiles': ['v_e_001.xml', 'e.xml', 'e_sv.xml', 'testbench.xml',
                                                                                  'sensors.xml', 'safety.xml', 'mode.xml'], 'firmware': 'linear/turbo_bootloader.bin', 'type': 'turbodriver', 'location': '/left_leg/ankle/actuator0'}, '/left_leg/j1':
                                    {'configFiles': ['v_a_001.xml', 'a.xml', 'a_sv.xml', 'testbench.xml', 'sensors.xml', 'safety.xml', 'mode.xml'], 'firmware':
                                     'rotary/turbo_bootloader.bin', 'type': 'turbodriver', 'location': '/left_leg/j1'}, '/left_leg/ankle/actuator1': {'configFiles':
                                                                                                                                                      ['v_e_002.xml', 'e.xml', 'e_sv.xml', 'testbench.xml',
                                                                                                                                                          'sensors.xml', 'safety.xml', 'mode.xml'],
                                                                                                                                                      'firmware': 'linear/turbo_bootloader.bin', 'type': 'turbodriver', 'location': '/left_leg/ankle/actuator1'}}

        instanceConfig = instanceFileHandler.getInstanceConfig()
        assert cmp(instanceConfig, expectedConfigDictionary) == 0
开发者ID:uml-robotics,项目名称:val_description,代码行数:15,代码来源:test_InstanceFileHandler.py

示例14: testInstanceConfigDictionary

    def testInstanceConfigDictionary(self):
        sampleInstanceFile = self.testDirectory + \
            '/test_files/sample_instance.xml'
        instanceFileHandler = InstanceFileHandler(sampleInstanceFile)

        instanceConfig = instanceFileHandler.getInstanceConfig()

        # Check some of them, to many to check them all though.
        assert('test_v_e_001.xml' in instanceConfig['/left_leg/ankle/actuator0']['configFiles'])
        assert('test_e_futek_dh.xml' in instanceConfig['/left_leg/ankle/actuator0']['configFiles'])
        assert('test_ankle_linear.xml' in instanceConfig['/left_leg/ankle/actuator0']['configFiles'])

        assert('test_v_e_003.xml' in instanceConfig['/trunk/left_actuator']['configFiles'])
        assert('test_e_renishaw_dh.xml' in instanceConfig['/trunk/left_actuator']['configFiles'])
        assert('test_trunk_linear.xml' in instanceConfig['/trunk/left_actuator']['configFiles'])

        assert('test_v_a_001.xml' in instanceConfig['/left_leg/j1']['configFiles'])
开发者ID:RIVeR-Lab,项目名称:ihmc-open-robotics-software,代码行数:17,代码来源:test_InstanceFileHandler.py

示例15: testForearmCoeffs

    def testForearmCoeffs(self):
        sampleInstanceFile = self.testDirectory + "/test_files/test_forearm.xml"
        instanceFileHandler = InstanceFileHandler(sampleInstanceFile)

        node1 = '/forearm/forearm_driver1'
        node2 = '/forearm/forearm_driver2'

        nodeNames = instanceFileHandler.getNodeNames()

        assert(node1 in nodeNames)
        assert(node2 in nodeNames)

        forearmCoeffDictionary = instanceFileHandler.getForearmCoeffDictionary()

        expectedAthenaDictionary = {}
        expectedAthenaDictionary[node1] = {'Pitch_offset': -2331, 'Yaw_offset': 1596, 'Pitch_hilmt': 1500, 'Pitch-lolmt': -1500, 'Pitch_cnvtrad': -0.000767}
        expectedAthenaDictionary[node2] = {'Fing1_elecoffset': 0.0, 'Fing1_locmdlmt': 100.0, 'Fing1_hicmdlmt': 5214.0, 'Fing1_posKP': 1.0, 'Fing1_posKD': 0.0}

        assert cmp(forearmCoeffDictionary[node1], expectedAthenaDictionary[node1])
        for key, value in forearmCoeffDictionary[node2].iteritems():
            assert(forearmCoeffDictionary[node2][key] - value == 0)
开发者ID:RIVeR-Lab,项目名称:ihmc-open-robotics-software,代码行数:21,代码来源:test_InstanceFileHandler.py


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