Week 8: You Can Walk The Walk, Now Talk The Talk

I accomplished two tasks this week… adding more robustness to the movement grammar, and integrating speech recognition.

In particular, I added the abilities to parse commands such as:

  • “go left/right” — turns left 90 degrees and then moves the given distance.
  • “wait” — pauses the robot for x seconds.
  • “stop” — stops all movement.
  • “turn around” — turns 180 degrees, optionally “to the left”/”to the right”.
  • “spin around” — turns 360 degrees, optionally “to the left”/”to the right”.
  • “take a picture” — takes a photo using the fluke camera, which is transmitted to the computer via bluetooth and displayed.  This functionality is still a little buggy, which I suspect is due to some instability with my version of the Python Imaging Library.

I also loosened up the grammar in some other places to make it more flexible.  I wrote the following DCG predicate which has really come in handy:

optional(X) –> [X] ; [].

This is a case of something so obvious, that I don’t know why I didn’t think of it earlier.  That simple little line of Prolog code enables the insertion of “optional” words or phrases in a sentence and has become invaluable.  It is analogous to square-bracket notation in EBNF grammar definitions.

Integrating the Microsoft Speech Engine with the program proved to be quite a bit easier than I had imagined.  I was able to do this via a library called PySpeech.  After running through only one round of Microsoft’s voice training program, the engine is fairly accurate and fast enough to be useful.  So now, the parser can be run in either text or speech mode– pretty cool!  It is a blast to call out voice commands and see the scribbler react.

Next week I plan to wrap up the feature side of the project by adding a few more fun things (“beep” springs to mind) as well as conditional statements (“go forward until you hit a wall”).  All that will then remain is to flush out my comments and documentation.

About the Author: Justin
A 34 year old Software Engineer in Seattle, WA with a love for coding, music, video games, and the great outdoors.
Author Website: http://www.justinmangue.com

Leave a Reply

Your email address will not be published. Required fields are marked *