An error occurred while loading the file. Please try again.
Select Git revision
binaulocExample.m
-
Fredrik Bagge Carlson authoredFredrik Bagge Carlson authored
binaulocExample.m 2.07 KiB
% Assuming that you already have a 'client' handle, and that the 'binauloc'
% component is running on the turtlebot, load this component.
binauloc = client.load('binauloc')
% Connect the input port of binauloc to the output port of bass, so that
% binauloc receives the raw audio data from bass. Note that the data flow
% goes from bass on the Raspberry Pi to binauloc on the turtlebot. The
% audio data does not pass by Matlab here.
binauloc.connect_port('Audio', 'bass/Audio')
% Setup the parameters of the algorithm. To have a bit more information
% about the role of each parameter, you can call binauloc.Setup('-h'). To
% have further information, c.f. Portello et al. IROS 2013 & IROS 2014
binauloc.Setup( ...
'/home/turtlebot/genom3/activeloc/data/setup', ... % just a file to write parameters in (please do not change)
24414, ... % the sample rate
5000, ... % the maximum frequency
1024, ... % the number of samples per frame (here a frame is a block of audio)
512, ... % the overlap between two frames
'::localization::HANNING', ... % the window function
10, ... % contributes to the smoothing of the pseudo-likelihood
'/home/turtlebot/genom3/activeloc/data/projector', ... % another file to write data in (please do not change)
'/home/turtlebot/genom3/activeloc/data/noise') % yet another file to write data in (please do not change)
% Learn the noise characteristics. Make sure the environment is silent
% before calling this service!
binauloc.LearnNoise(2) % 2 seconds
% Use the inter-aural transfer function to compute a projector on the space
% spanned by the steering vector [1; inter-aural transfer function]
binauloc.PretabProj('/home/turtlebot/genom3/activeloc/steerVecs/steerVecS72')
% Start the localization (runs indefinitely, don't forget the '-a' option)
rLocalizeSources = binauloc.LocalizeSources('-a', 1, 1, 4)
% The azimuth detection is now running, you can retrieve the current
% estimated azimuth in p = binauloc.Azimuths(). The value is in radians,
% increasing towards right.
% The localization can be stopped with binauloc.StopLocalization()