Example program - robot speech

I committed an example program to our “example robot programs” Github repository that uses the Google text-to-speech library and an MP3 utility to give the robot the ability to translate text into speech. The example can be downloaded here: https://github.com/tormach/example_robot_programs

I’ve found it helpful to ask the robot to tell me what it’s doing while programming certain tasks, e.g. training the Multigrip gripper. The Multigrip product requires the gripper that holds the vise jaws to execute a precise set of moves sequenced with commands that open/close the gripper and the vise. Proving out the program a few inches above the vise I realized it was challenging to figure out exactly what step was being executed at what time, so I wrote this little utility to have the robot tell me where it was in the sequence.

Here’s a video showing from my initial test with the Multigrip gripper showing the robot talking me through the sequence of moves:

My speech code could really use a few improvements:

  1. The mp3 files that it creates are stored in the same folder as the robot program. It would be nice to at least create a new subdirectory so those mp3s don’t clutter your program directory.
  2. gTTS library doesn’t do well with characters like ! or &. It would be nice to filter these out before sending them off to gTTS. The program was a quick and dirty implementation and could use a little error checking to make it more robust.

If you download this and find it useful, don’t hesitate to submit a pull request or make suggestions here.


1 Like