Skip to content

Commit

Permalink
test: añadidos casos de prueba
Browse files Browse the repository at this point in the history
  • Loading branch information
maxfloresv authored Nov 9, 2022
1 parent 5c66480 commit c6e4ee6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions voice2text.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,23 @@ def __init__(self, args):
self.args = args

# Publisher de voz
self.pub = rospy.Publisher("/duckiebot/voz/v2t", String, queue_size=1)
# latch=True para publicar mensajes perdidos
# https://stackoverflow.com/a/60661094
self.pub = rospy.Publisher("/duckiebot/voz/v2t", String, queue_size=1, latch=True)

# Programa de voz
self.r = sr.Recognizer()

self.published = False

def callback(self):
if not self.published:
msg = String()
msg.data = "izquierda"
self.pub.publish(msg)

self.published = True
"""
with sr.Microphone() as source:
print("Quack quack...") # que lo diga
audio = self.r.listen(source, None, 3)
Expand All @@ -27,7 +38,7 @@ def callback(self):
self.pub.publish(msg)
except Exception as e:
print("No quackche", str(e))
print("No quackche", str(e))"""

def main():
# Nodo local del PC
Expand Down

0 comments on commit c6e4ee6

Please sign in to comment.