speech_to_text_action_handler.h
Go to the documentation of this file.
1 #ifndef SPEECH_TO_TEXT_ACTION_HANDLER_H_
2 #define SPEECH_TO_TEXT_ACTION_HANDLER_H_
3 
4 #include <atomic>
5 
7 #include "gcloud_speech_msgs/SpeechToTextAction.h"
8 #include "gcloud_speech_msgs/RecognitionHypothesis.h"
9 #include "gcloud_speech_msgs/LinearPcm16Le16000Audio.h"
10 
13 #include "third_party/glog.h"
15 
16 namespace gcloud_speech {
17 
19  public:
20  // Constructor: recognizer is a GoogleSpeechRecognizer that will be used to
21  // contact Google Speech API and do speech recognition, simple_action_server
22  // is a SimpleActionServer handle that interacts with client.
26  simple_action_server);
27 
28  // ROS subscriber callback for LinearPcm16Le16000Audio.
29  void AudioMsgCallback(
30  const gcloud_speech_msgs::LinearPcm16Le16000Audio::ConstPtr& msg);
31 
32  // ROS callback for SimpleActionServer.
34  const gcloud_speech_msgs::SpeechToTextGoalConstPtr& goal);
35 
36  private:
37  // audio_queue_ contains audio samples, and will be populated by
38  // AudioMsgCallback function.
40 
41  // is_active_ indicates whether the action server is active. This handler will
42  // only record audio if the action server is active.
43  std::atomic_bool is_active_;
44 
45  // result_queue_ contains results from recognizer_.
48 
52 };
53 
54 } // namespace gcloud_speech
55 
56 #endif // SPEECH_TO_TEXT_ACTION_HANDLER_H_
util::SimpleThreadSafeQueue< cogrob::cloud::speech::RecognitionResult > result_queue_
void AudioMsgCallback(const gcloud_speech_msgs::LinearPcm16Le16000Audio::ConstPtr &msg)
actionlib::SimpleActionServer< gcloud_speech_msgs::SpeechToTextAction > * simple_action_server_
void ExecuteSpeechToTextAction(const gcloud_speech_msgs::SpeechToTextGoalConstPtr &goal)
SpeechToTextActionHandler(cogrob::cloud::speech::GoogleSpeechRecognizerInterface *recognizer, actionlib::SimpleActionServer< gcloud_speech_msgs::SpeechToTextAction > *simple_action_server)
cogrob::cloud::speech::GoogleSpeechRecognizerInterface * recognizer_


gcloud_speech
Author(s):
autogenerated on Wed Jun 5 2019 21:24:06