Tutorial

Introduction

This tutorial explains how to use the ALAudioSourceLocalization module.

Note:

The tutorial is written in Python.

Subscribe to ALAudioSourceLocalization/SoundLocated event

Because ALAudioSourceLocalization/SoundLocated is an event, you can use a callback to process your algorithm

from naoqi import ALModule, ALProxy import time # define python module class MyModule(ALModule): """ this python module test ALAudioSourceLocalization module """ def __init__( self, strName ): ALModule.__init__( self, strName ); def myCallBack(self, strVarName, angle, strMessage) : """ just print value of event """ print "sound location : " + str(angle[1][0]) + str(angle[1][1]) print "confidence : " + str(angle[1][2]) if __name__ == "__main__": # Replace IP with your robot's IP address broker = ALBroker("pythonBroker", "0.0.0.0", 9600,IP, 9559) pythonModule = MyModule("MypythonModule") ALMemoryProxy = ALProxy("ALMemory") #subscribe to ALAudioSourceLocalization/SoundLocated event ALMemoryProxy.subscribeToEvent("ALAudioSourceLocalization/SoundLocated","MypythonModule", "myCallBack") time.sleep(9) ALMemoryProxy.unsubscribeToEvent("ALAudioSourceLocalization/SoundLocated","MypythonModule")





Copyright © 2010 Aldebaran-Robotics - All rights reserved