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


Python ALProxy.getData方法代码示例

本文整理汇总了Python中naoqi.ALProxy.getData方法的典型用法代码示例。如果您正苦于以下问题:Python ALProxy.getData方法的具体用法?Python ALProxy.getData怎么用?Python ALProxy.getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在naoqi.ALProxy的用法示例。


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

示例1: BoardMemoryMonitor

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
class BoardMemoryMonitor(object):
    def __init__(self, args):
        self._prefix = 'Device/DeviceList'
        self._board = args.board
        self._key = args.key
        try:
            self._mem = ALProxy('ALMemory', args.url, args.port)
            self._out = UnbufferedStreamWrapper(stdout)
        except RuntimeError as e:
            exceptRgx = compile('[^\n\t]+$')
            print '\n', 'RuntimeError:', exceptRgx.search(e.args[0]).group(0)
            exit(1)

    def run(self):
        progVersion = self._mem.getData('/'.join([self._prefix,
                                        self._board,
                                        'ProgVersion']))
        system('clear')
        print 'Monitoring key \'{0}\' on board \'{1}\' [ProgVersion: {2}]'.format(self._key,
                                                                                  self._board,
                                                                                  str(progVersion))
        while True:
            data = self._mem.getData('/'.join([self._prefix, self._board, self._key]))
            self._out.write(str(data))
            self._out.write('   \r')
开发者ID:d0nn13,项目名称:python-tools,代码行数:27,代码来源:BoardMemoryMonitor.py

示例2: main

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
def main(robotIp,robotPort):
    sonarProxy = ALProxy("ALSonar",robotIp,robotPort)
    sonarProxy.subscribe("Sensores")
    memoryProxy = ALProxy("ALMemory",robotIp,robotPort)
    while (1):
        left=memoryProxy.getData("Device/SubDeviceList/US/Left/Sensor/Value")
        right=memoryProxy.getData("Device/SubDeviceList/US/Right/Sensor/Value")
        val=[left,right]
        print val
        if left<0.3 and right<0.3:
            if left<right:
                talker("ObsL")
            else:
            	talker("ObsR")
            time.sleep(7)
            continue
        if left<0.3:
            talker("ObsL")
            time.sleep(7)
            continue
        if right<0.3:
            talker("ObsR")
            time.sleep(7)
            continue
    sonarProxy.unsubscribe("Sensores")
开发者ID:JesusViveros,项目名称:Proyectos,代码行数:27,代码来源:Sonar.py

示例3: armData

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
def armData():
	memory = ALProxy("ALMemory", IP, PORT)
	data = list()
	for key in ALMEMORY_KEY_ARMS:
		value = memory.getData(key)
		data.append(value)
	return data
开发者ID:cephdon,项目名称:NAO_SLAM,代码行数:9,代码来源:nao_grab_cam2.py

示例4: __init__

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
class CollisionDetect:
    # Class used to have values from sensor's feet

    def __init__(self):
        # Constructor

        self.memoryProxy = None

        rightFootSensorL = "Device/SubDeviceList/RFoot/Bumper/Left/Sensor/Value"
        rightFootSensorR = "Device/SubDeviceList/RFoot/Bumper/Right/Sensor/Value"
        leftFootSensorL = "Device/SubDeviceList/LFoot/Bumper/Left/Sensor/Value"
        leftFootSensorR = "Device/SubDeviceList/LFoot/Bumper/Right/Sensor/Value"

        self.listSensorNames = [leftFootSensorL, leftFootSensorR, rightFootSensorL, rightFootSensorR]

    def connect(self, robotIP, port):
        # Connect to the Memory Proxy of Nao

        try:
            self.memoryProxy = ALProxy("ALMemory", robotIP, port)
        except:
            return 1
        return 0

    def getFeetSensor(self):
        # Return a list with last values of feet sensor

        values = []
        for n in self.listSensorNames:
            values.append(self.memoryProxy.getData(n, 0))

        return values
开发者ID:Niels28,项目名称:LeapMotionWithNao,代码行数:34,代码来源:collisionDetect.py

示例5: getFaceData

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
def getFaceData(IP, PORT):
    #make proxy to face detection
    faceProxy = ALProxy("ALFaceDetection", IP, PORT)

    #Make proxy to memory
    memoryProxy = ALProxy("ALMemory", IP, PORT)

    faceProxy.subscribe("GetFaceData")

    faceData = memoryProxy.getData("FaceDetected")
    faceProxy.unsubscribe("GetFaceData")

    return faceData
开发者ID:afranka69,项目名称:ShowRobbie,代码行数:15,代码来源:FacialRecognitionModule.py

示例6: getJointValue

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
def getJointValue(jointName):
        print '[NAO] getJointValue', jointName
        memoryProxy = ALProxy('ALMemory', 'nao.local', 9559)

        aux = "Device/SubDeviceList/" + jointName + "/Position/Sensor/Value"
        val = memoryProxy.getData(aux)
        return val
开发者ID:ioanaantoche,项目名称:muhaha,代码行数:9,代码来源:movesTest.py

示例7: say

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
def say( text, shape, speed, color ):

	# Verbindung mit ALBroker herstellen
	tts = ALProxy( "ALTextToSpeech", config.naoIP, config.naoPort )
	mem = ALProxy( 'ALMemory', config.naoIP, config.naoPort )	
	
	# Sprachausgabe formatieren
	sentence = "\RSPD="+ str( speed )+ "\ "
        sentence += "\VCT="+ str( shape ) + "\ "
        sentence += text
        sentence +=  "\RST\ "
	
	# AUugenfarbe setzen
	setEyeCol( color )
	
	# Text ausgeben und bis Ende warten
	if config.bodytalk:
		mem.raiseMicroEvent( "naostory_say_bodytalk", sentence )
		while mem.getData( "naostory_talking" ) :
			try: sleep(0.1)
			except: pass
	else:
		ID = tts.post.say( str(sentence) )
		tts.wait( ID, 0 )
	
	return True
开发者ID:hanneseilers,项目名称:NAOStory,代码行数:28,代码来源:command.py

示例8: __init__

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
class Nao:
    def __init__(self, robotIP, port):
        # proxies
        self.memoryProxy = ALProxy("ALMemory", robotIP, port)
        self.managerProxy = ALProxy("ALBehaviorManager", robotIP, port)
        self.motionProxy = ALProxy("ALMotion", robotIP, port)
        self.animatedSpeechProxy = ALProxy("ALAnimatedSpeech", robotIP, port)
        self.navigationProxy = ALProxy("ALNavigation", robotIP, port)
        self.postureProxy = ALProxy("ALRobotPosture", robotIP, port)
        self.trackerProxy = ALProxy("ALTracker", robotIP, port)
        self.peopleProxy = ALProxy("ALPeoplePerception", robotIP, port)
        self.autonomousMovesProxy = ALProxy("ALAutonomousMoves", robotIP, port)
        self.autonomousMovesProxy.setExpressiveListeningEnabled(False)
        self.dialog_p = ALProxy('ALDialog', robotIP, port)
        self.tts = ALProxy("ALTextToSpeech", robotIP, port)
        self.tts.setParameter("speed", 90)
        self.basic_awareness = ALProxy("ALBasicAwareness", robotIP, port)
        self.peopleLocation = []
        self.trackerTarget = -1
        self.People_list = []
        self.People_undetected = []
        self.People_detected = []
        self.visible_detection = 5
        self.People_angles = []
        self.undetected_person_count = 50
        self.same_person_threshold = 0.2

        # publishers
        self.trackingPub = rospy.Publisher('/nao_behavior/tracking', Bool, queue_size=1)
        self.visualPub = rospy.Publisher('visual', MarkerArray, queue_size=5)
        rospy.Subscriber("/nao_behavior/enable_Diag", String, self.startDialog)
        rospy.Subscriber("/nao_behavior/reset_Diag", String, self.resetDialog)
        rospy.Subscriber("/nao_behavior/add/blocking", String, self.blocking_callback)
        rospy.Subscriber("/nao_behavior/add/nonblocking", String, self.nonblocking_callback)

        self.dialogLoaded = False

        Thread(target=self.start_PeopleDetectection).start()
        self.breath()

    def start_awareness(self):
        self.basic_awareness.setTrackingMode("Head")
        self.basic_awareness.setEngagementMode("FullyEngaged")
        self.basic_awareness.setStimulusDetectionEnabled("Sound", True)
        self.basic_awareness.setStimulusDetectionEnabled("Movement", True)
        self.basic_awareness.setStimulusDetectionEnabled("People", True)
        self.basic_awareness.setStimulusDetectionEnabled("Touch", False)
        self.basic_awareness.setParameter("MaxHumanSearchTime", float(2))
        self.basic_awareness.startAwareness()
        time.sleep(0.5)
        while not rospy.is_shutdown():
            # get current target being tracked
            try:
                self.trackerTarget = self.memoryProxy.getData('ALBasicAwareness/HumanTracked', 0)
                self.trackingPub.publish(not self.trackerProxy.isTargetLost())
            except Exception, e:
                print e
开发者ID:vainmouse,项目名称:Nao,代码行数:59,代码来源:Nao2.py

示例9: sonar_publisher

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
def sonar_publisher():
    # NAO connect
    # Connect to ALSonar module.
    sonarProxy = ALProxy("ALSonar", IP, PORT)
    # Subscribe to sonars, this will launch sonars (at hardware level) and start data acquisition.
    sonarProxy.subscribe("ROS_sonar_publisher")
    #Now you can retrieve sonar data from ALMemory.
    memoryProxy = ALProxy("ALMemory", IP, PORT)

    #ROS
    pub_right = rospy.Publisher(TOPIC_NAME+'right', Range, queue_size=10)
    pub_left = rospy.Publisher(TOPIC_NAME+'left', Range, queue_size=10)
    rospy.init_node('nao_sonar_publisher')
    r = rospy.Rate(PUBLISH_RATE)
    while not rospy.is_shutdown():
        # Get sonar left first echo (distance in meters to the first obstacle).
        left_range = memoryProxy.getData("Device/SubDeviceList/US/Left/Sensor/Value")
        # Same thing for right.
        right_range = memoryProxy.getData("Device/SubDeviceList/US/Right/Sensor/Value")

        left = Range()
        left.header.stamp = rospy.Time.now()
        left.header.frame_id = '/torso'
        left.radiation_type = Range.ULTRASOUND
        left.field_of_view = 60
        left.min_range = 0.25 # m
        left.max_range = 2.55 # m
        left.range = left_range

        right = Range()
        right.header.stamp = rospy.Time.now()
        right.header.frame_id = '/torso'
        right.radiation_type = Range.ULTRASOUND
        right.field_of_view = 60
        right.min_range = 0.25 # m
        right.max_range = 2.55 # m
        right.range = right_range

        pub_right.publish(right)
        pub_left.publish(left)
        r.sleep()
开发者ID:gerardcanal,项目名称:NAO-UPC,代码行数:43,代码来源:nao_sonar_publisher.py

示例10: application

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
def application(environ, start_response):

    try:
        ALMemory = ALProxy("ALMemory", "192.168.178.31", 9559)
        output = str(ALMemory.getData("demojam2014/Status"))
    except:
        output = 'Unknown'

    status = '200 OK'
    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]
开发者ID:grahamrobbo,项目名称:demos,代码行数:16,代码来源:status.py

示例11: recordData

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
def recordData(nao_ip):
	""" Records data from the specified robot on the memory values from AL_MEMORY_VALUES """

	memory = ALProxy("ALMemory", nao_ip, PORT)
	data = list()
	
	for i in xrange(1, 200):	
		line = list()
		for key in AL_MEMORY_VALUES:
			value = memory.getData(key)		
			line.append(value)
		data.append(line)
		time.sleep(0.1)
	return data
开发者ID:JDulin,项目名称:nao-pickupbehavior,代码行数:16,代码来源:walk_recording.py

示例12: __call__

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
    def __call__(self):
        if ALProxy is None:
            _logger.warn('ALProxy is None.')
            return None

        memProxy = ALProxy("ALMemory", "localhost", 9559)
        ret = dict()
        for key in _keys:
            value = memProxy.getData(
                "Device/SubDeviceList/%s/Temperature/Sensor/Value" % key)
            ret[key] = value
            if not value:
                _logger.warn('Noting return value %s' % key)
                continue
        return ret
开发者ID:k-nii0211,项目名称:rbp_agent,代码行数:17,代码来源:metrics_device_temperature.py

示例13: __sensor

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
    def __sensor(self, data):
        global stopProgramFlag
        
        if 'type' in data and 'value' in data:
            if data['type'] == 'Tactile' or data['type'] == 'Bumper':
                sensor = ALProxy("ALTouch", Settings.naoHostName, Settings.naoPort)
                value = str( data['value'] )
                value = value.replace("Left Hand", "LHand").replace("Right Hand", "RHand")
                value = value.replace("Left Bumper", "LFoot/Bumper/Left").replace("Right Bumper", "RFoot/Bumper/Right")
                value = value.replace(" Side", "")
                value = value.replace(" ", "/Touch/")
                ret = False
                print value
                print sensor.getStatus()
                while not ret and not stopProgramFlag:
                    for sens in sensor.getStatus():
                        if sens[0] == value:
                            ret = sens[1]                    
                    sleep(0.01)
             
#             elif data['type'] == 'Chest button':
#                 pass
            
            elif data['type'] == 'Sonar':
                mem = ALProxy("ALMemory", Settings.naoHostName, Settings.naoPort)
                sonar = ALProxy("ALSonar", Settings.naoHostName, Settings.naoPort)
                sonar.subscribe("NAOCOM")
                
                key = str( data['value'] )
                key = key.replace("detected", "Detected").replace("NOT", "Nothing").replace(" ", "")
                key = "Sonar" + key
                value = mem.getData(key)
                while value == mem.getData(key) and not stopProgramFlag:
                    sleep(0.01)
                    
                sonar.unsubscribe("NAOCOM")
开发者ID:Adriencerbelaud,项目名称:NAO-Communication-server,代码行数:38,代码来源:cmdPlayProgram.py

示例14: recordData

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
def recordData(nao_ip):
    """ Record the data from ALMemory.
    Returns a matrix of values

    """
    print "Recording data ..."
    memory = ALProxy("ALMemory", nao_ip, 9559)
    data = list()
    for i in range (1, 100):
        line = list()
        for key in ALMEMORY_KEY_NAMES:
            value = memory.getData(key)
            line.append(value)
        data.append(line)
        time.sleep(0.05)
    return data
开发者ID:KellyChan,项目名称:python-examples,代码行数:18,代码来源:data_recording.py

示例15: searchBall

# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getData [as 别名]
def searchBall(angle, isenabled, robotIP="127.0.0.1", port=9559):
    MEMORY = ALProxy("ALMemory", robotIP, port)
    REDBALL = ALProxy("ALRedBallDetection", robotIP, port)
    MOTION = ALProxy("ALMotion", robotIP, port)
    #周期为200毫秒,也就是每隔200毫秒刷入一次内存(memory)
    period = 200
    REDBALL.subscribe("Redball",period,0.0)
    MEMORY.insertData("redBallDetected",None)
    time.sleep(0.5)
    MOTION.angleInterpolation("HeadYaw",angle*math.pi/180.0,0.5,isenabled)
    time.sleep(2)
    #读取检测到的红球数据,如果没有被检测到则返回None
    temp = MEMORY.getData("redBallDetected")
    MEMORY.insertData("redBallDetected",None)
    REDBALL.unsubscribe("Redball")
    return temp
开发者ID:hayifeng,项目名称:Robot_Group,代码行数:18,代码来源:detection.py


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