client.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # Author: furushchev <furushchev@jsk.imi.i.u-tokyo.ac.jp>
4 
5 from dynamic_reconfigure.client import Client
6 import rospy
7 from speech_recognition_msgs.srv import SpeechRecognition
8 from ros_speech_recognition.cfg import SpeechRecognitionConfig as Config
9 
10 
12  def __init__(self,
13  srv_name="/speech_recognition",
14  node_name="/speech_recognition",
15  timeout=10):
16  self._sr_srv = rospy.ServiceProxy(srv_name, SpeechRecognition)
17  self._sr_srv.wait_for_service(timeout=timeout)
18  self._cfg = Client(node_name, timeout=timeout)
19 
20  @property
21  def language(self):
22  return self._cfg.config["language"]
23 
24  @language.setter
25  def language(self, value):
26  self._cfg.update_configuration({'language': value})
27 
28  @property
29  def engine(self):
30  return self._cfg.config["engine"]
31 
32  @engine.setter
33  def engine(self, value):
34  self._cfg.update_configuration({'engine': value})
35 
36  @property
37  def energy_threshold(self):
38  return self._cfg.config["energy_threshold"]
39 
40  @energy_threshold.setter
41  def energy_threshold(self, value):
43  rospy.logerr("Dynamic energy thresholding is enabled")
44  else:
45  self._cfg.update_configuration({
46  "energy_threshold": value
47  })
48 
49  @property
51  return self._cfg.config["dynamic_energy_threshold"]
52 
53  @dynamic_energy_threshold.setter
54  def dynamic_energy_threshold(self, value):
55  self._cfg.update_configuration({
56  "dynamic_energy_threshold": value
57  })
58 
59  def recognize(self, **args):
60  return self._sr_srv(**args).result
def __init__(self, srv_name="/speech_recognition", node_name="/speech_recognition", timeout=10)
Definition: client.py:15


ros_speech_recognition
Author(s): Yuki Furuta
autogenerated on Tue May 11 2021 02:55:47