voice_recognition_alg.h
Go to the documentation of this file.
00001 // Copyright (C) 2010-2011 Institut de Robotica i Informatica Industrial, CSIC-UPC.
00002 // Author 
00003 // All rights reserved.
00004 //
00005 // This file is part of iri-ros-pkg
00006 // iri-ros-pkg is free software: you can redistribute it and/or modify
00007 // it under the terms of the GNU Lesser General Public License as published by
00008 // the Free Software Foundation, either version 3 of the License, or
00009 // at your option) any later version.
00010 //
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public License
00017 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 // 
00019 // IMPORTANT NOTE: This code has been generated through a script from the 
00020 // iri_ros_scripts. Please do NOT delete any comments to guarantee the correctness
00021 // of the scripts. ROS topics can be easly add by using those scripts. Please
00022 // refer to the IRI wiki page for more information:
00023 // http://wikiri.upc.es/index.php/Robotics_Lab
00024 
00025 #ifndef _voice_recognition_alg_h_
00026 #define _voice_recognition_alg_h_
00027 
00028 #include <iri_voice_recognition/VoiceRecognitionConfig.h>
00029 #include "mutex.h"
00030 
00031 //include voice_recognition_alg main library
00032 extern "C"
00033 {
00034   #include <iatros-speech/version.h>
00035   #include <iatros/version.h>
00036   #include <prhlt/args.h>
00037   #include <iatros/lex.h>
00038   #include <iatros/hmm.h>
00039   #include <iatros/grammar.h>
00040   #include <iatros/viterbi.h>
00041   #include <iatros/heap.h>
00042   #include <iatros/lattice.h>
00043   #include <prhlt/trace.h>
00044   #include <prhlt/gzip.h>
00045   #include <prhlt/constants.h>
00046   #include <iatros-speech/libAudio.h>
00047   #include <iatros-speech/acquisitor.h>
00048   #include <time.h>
00049 }
00050 
00051 #define NONE 0
00052 #define AUTORES 1
00053 #define HABILIDADES 2
00054 #define IDENTIFICACION 3
00055 #define LUGAR 4
00056 #define OTROS_PROYECTOS 5
00057 #define OTROS_ROBOTS 6
00058 #define ZONA 7
00059 #define EDIF 8
00060 #define AUL 9
00061 #define NCLASSES 10
00062 
00068 class VoiceRecognitionAlgorithm
00069 {
00070   protected:
00077     CMutex alg_mutex_;
00078 
00079     // private attributes and methods
00080     std::string filePath_;
00081     
00082     args_t *args;
00083     decoder_t *decoder;
00084     acquisitor_t *acquisitor;
00085     
00086     std::string answer_type(std::string answerfn);
00087     std::string answer_type_location(std::string answerfn, std::string loc);
00088     std::string generate_answer(double *probs, char **sentences_str, int n);
00089     std::string outputs(const args_t *args, lattice_t *lattice);
00090 
00091   public:
00098     typedef iri_voice_recognition::VoiceRecognitionConfig Config;
00099 
00106     Config config_;
00107 
00116     VoiceRecognitionAlgorithm(void);
00117 
00123     void lock(void) { alg_mutex_.enter(); };
00124 
00130     void unlock(void) { alg_mutex_.exit(); };
00131 
00139     bool try_enter(void) { return alg_mutex_.try_enter(); };
00140 
00152     void config_update(Config& new_cfg, uint32_t level=0);
00153 
00154     // here define all voice_recognition_alg interface methods to retrieve and set
00155     // the driver parameters
00156     void initialize();
00157     std::string iteration();  
00158     void finalize();
00159     void setFilePath(std::string path);
00160     
00161     int answerCode_;
00162 
00169     ~VoiceRecognitionAlgorithm(void);
00170 };
00171 
00172 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends Defines


iri_voice_recognition
Author(s): fherrero
autogenerated on Mon Jan 14 2013 13:02:57