Book Image

Raspberry Pi Robotics Projects - Second Edition

By : Dr. Richard Grimmett
Book Image

Raspberry Pi Robotics Projects - Second Edition

By: Dr. Richard Grimmett

Overview of this book

<p>This book starts with the essentials of turning on the basic hardware. It provides the capability to interpret your commands and have your robot initiate actions. In this second edition, you will learn more specifics on how to use the Raspberry Pi’s GPIO pins to communicate with and control a wide range of additional hardware.</p> <p>Teaching you to use the Raspberry Pi from scratch, this book will discuss a wide range of capabilities that can be achieved with it. These capabilities include voice recognition, human-like speech simulation, computer vision, motor control, GPS location, and wireless control. You will then learn how to combine these capabilities to create your own robotics projects. By the end of the book, you will be able to employ the Raspberry Pi to build some intricate and enthralling robotics projects with ease.</p>
Table of Contents (18 chapters)
Raspberry Pi Robotics Projects Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Interpreting commands and initiating actions


Now that the system can both hear and speak, you'll want to provide the capability to respond to your speech and execute some commands based on the speech input. Next, you're going to configure the system to respond to simple commands.

In order to respond, we're going to edit the continuous.c code in the /home/pi/pocketsphinx-0.8/src/programs directory. We could create our own C file, but this file is already set up in the makefile system and is an excellent starting spot. You can save a copy of the current file in continuous.c.old so that you can always get back to the starting program, if required. Then, you will need to edit the continuous.c file. It is very long and a bit complicated, but you are specifically looking for the section in the code, which is shown in the following screenshot. Look for the comment line /* Exit if the first word spoken was GOODBYE */:

In this section of the code, the word has already been decoded and is held in the...