speech
Loading...
Searching...
No Matches
start-speech.h
1/*
2 * Copyright (C) 2017 Department of Robotics Brain and Cognitive Sciences - Istituto Italiano di Tecnologia
3 * Author: Vadim Tikhanoff
4 * email: vadim.tikhanoff@iit.it
5 * Permission is granted to copy, distribute, and/or modify this program
6 * under the terms of the GNU General Public License, version 2 or any
7 * later version published by the Free Software Foundation.
8 *
9 * A copy of the license can be found at
10 * http://www.robotcub.org/icub/license/gpl.txt
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15 * Public License for more details
16 */
17
18#ifndef __ICUB_STARTSPEECH_MOD_H__
19#define __ICUB_STARTSPEECH_MOD_H__
20
21#include <yarp/os/BufferedPort.h>
22#include <yarp/os/RFModule.h>
23#include <yarp/os/Network.h>
24#include <yarp/os/Thread.h>
25#include <yarp/os/PeriodicThread.h>
26#include <yarp/os/Time.h>
27#include <yarp/os/Stamp.h>
28#include <yarp/sig/Vector.h>
29#include <yarp/sig/Image.h>
30#include <yarp/os/RpcClient.h>
31
32#include <time.h>
33#include <string>
34#include <iostream>
35#include <iomanip>
36#include <cstring>
37#include <map>
38#include <algorithm>
39
40class STARTManager : public yarp::os::BufferedPort<yarp::os::Bottle>
41{
42private:
43
44 std::string moduleName; //string containing module name
45 std::string inSpeechPortName; //string containing speech input port name
46 std::string outSTARTPortName; //string containing start output port name
47
48 std::string outSTARTUrlName; //string containing start output port name
49
50 yarp::os::Port portURL;
51
52 yarp::os::BufferedPort<yarp::os::Bottle> speechInPort; //input port containing speech
53 yarp::os::BufferedPort<yarp::os::Bottle> startOutPort; //output port containing start
54
55
56public:
62 STARTManager( const std::string &moduleName );
63 ~STARTManager();
64
65 bool open();
66 void close();
67 void onRead( yarp::os::Bottle &bot );
68 void interrupt();
69
70 static bool aZCheck(char c)
71 {
72 if (isspace(c))
73 return isalpha(c);
74 else
75 return !isalpha(c);
76 }
77
78};
79
80class STARTModule:public yarp::os::RFModule
81{
82 /* module parameters */
83 std::string moduleName;
84 std::string handlerPortName;
85 yarp::os::RpcServer rpcPort;
86
87 /* pointer to a new thread */
88 STARTManager *startManager;
89 bool closing;
90
91public:
92
93 bool configure(yarp::os::ResourceFinder &rf); // configure all the module parameters and return true if successful
94 bool interruptModule(); // interrupt, e.g., the ports
95 bool close(); // close and shut down the module
96
97 double getPeriod();
98 bool updateModule();
99};
100
101
102#endif
103//empty line to make gcc happy