Robot Localization
|
Contains functions to analyze room impulse response, odometry measurements and visual localization. More...
Public Member Functions | |
def | read_files (self) |
Reads all files that have been specified. | |
def | get_TOA (self) |
Calculate matrix of estimated time of arrival based on distances to wall, calculated from real positions and room width and height. More... | |
def | get_RIR (self) |
calculates the RIR from self.input_wav and all corresponding self.output_wav_list files and saves plots in self.out_dir with the same stepnumber and channel number in name. More... | |
def | apply_filter (self, time, freq, method='Y') |
Filters out required frequencies from frequency spectrum of signal. More... | |
def | get_crosscorr (self) |
Computes and plots cross correlation between self.input_files and self.output_files. More... | |
def | save_RIR (self, y_file, h) |
Saves RIR in binary file. More... | |
def | odometry (self, position_0) |
Calculates positions based on encoder measures and start position. More... | |
def | plot_geometry (self, fname='', zoom=False) |
Plots all results read by read_files() in the wall reference frame. More... | |
Contains functions to analyze room impulse response, odometry measurements and visual localization.
Members: (All optional members are set to '' if not specified and ignored in further analysis)
out_dir: folder where results should be saved
[input_wav]: audio input file with path (most likely sine sweep)
[output_wav_list]: list of audio output files
[output_enc]: encoder output file (with absoltue encoder positions)
[output_mov]: expected robot movement file
[output_real]: real positions output file
[output_vis]: visual localization output file
[output_cam]: camera centers output file
[output_camreal]: real camera centers file
def Analysis.Analysis.apply_filter | ( | self, | |
time, | |||
freq, | |||
method = 'Y' |
|||
) |
Filters out required frequencies from frequency spectrum of signal.
Parameters:
time: [t,h] nparray of time vector and corresponding time response, as returned by Analysis.Analysis.get_RIR. Only used in method 'kaiser'
freq: [f,H] nparray of frequency vector and corresponding DFT, as returned by Analysis.Analysis.get_RIR. Indirectly filtered with 'kaiser', directly filtered with other methods.
method: if set to 'kaiser', the Kaiser method from http://nbviewer.ipython.org/github/LORD-MicroStrain/SensorCloud/blob/master/MathEngine/Example%20Notebooks/LORD%20Notch%20Filter.ipynb ATTENTION: never tested completely because it always led to crash because of overloaded software memory. When set to anything other than 'kaiser', the desired frequencies are simply set to 0 and the parameter method is only used for naming the output files.(default: Y)
Returns:
[t,h_filt]: vectors of time and corresponding filtered impulse response
[f,H_filt]: vectors of frequency and corresponding DFT of filtered impulse response
def Analysis.Analysis.get_crosscorr | ( | self | ) |
Computes and plots cross correlation between self.input_files and self.output_files.
Parameters:
self.output_wav_list and self.input_wav need to be defined.
Returns:
corrs: list of correlations for each output-file.
def Analysis.Analysis.get_RIR | ( | self | ) |
calculates the RIR from self.input_wav and all corresponding self.output_wav_list files and saves plots in self.out_dir with the same stepnumber and channel number in name.
(for example: "out_dir/0_1_RIR_....png" saves impulse response at step 0 of channel 1)
Parameters:
self.output_wav_list and self.input_wav have to be defined.
Returns:
(t,h_filtered): time vector and impulse response
(f,H_filtered): frequency vector and FFT of impulse response
def Analysis.Analysis.get_TOA | ( | self | ) |
Calculate matrix of estimated time of arrival based on distances to wall, calculated from real positions and room width and height.
Parameters:
self.output_real needs to be defined.
Returns:
np.Array U of size K*N_steps, where N_steps is number of steps and K is number of walls. Therefore, the rows correspond the response times from the K walls and the columns correspond to steps.
def Analysis.Analysis.odometry | ( | self, | |
position_0 | |||
) |
Calculates positions based on encoder measures and start position.
Parameters:
position_0: nparray of start position ([x0,y0,theta0]) in mm and radians rsp. Theta0 is measured with respect to y axis, positive in the trigonometric sense.
self.enc has to be defined.
Returns:
positions: nparray of all resulting positons (x,y,theta)
def Analysis.Analysis.plot_geometry | ( | self, | |
fname = '' , |
|||
zoom = False |
|||
) |
Plots all results read by read_files() in the wall reference frame.
Run read_files() before running this function.
Parameters:
[fname:] file name where resulting image is saved (within self.out_dir) no output saved if not specified or set to '' (default '')
[zoom:] weather to zoom to positions or not. (default False)
Returns: Nothing
def Analysis.Analysis.save_RIR | ( | self, | |
y_file, | |||
h | |||
) |
Saves RIR in binary file.
Parameters:
y_file: input file for rir response (used for naming only)
h: vector of impulse response
Returns: Nothing