did:roboclub:lab8
Speech recognition and voice commands II – grammar based recognition
In grammar-based recognition, to make the robot recognize your voice commands we need to specify the set of possible commands. Most of the commands will share some parts, like for instance: run forward with maximum speed and run backward with maximum speed. It sounds inefficient to enumerate each command separately, as there will be a lot of redundant stuff in such configuration file.
That is why, instead of explicitly write every possible commands, we define a grammar file, which allows us to do the same in a more compact way:
#JSGF V1.0; grammar robot; <forward> = run forward; <backward> = run backward; <stop> = stop; <max> = (<forward> | <backward> ) with maximum speed; public <item> = <forward> | <stop> | <backward> | <max> ;
Exercises
- Update your project. To see how, go to: Pulling/updating
- Play with speakBack method :)
- Define new command(s) that will allow to specify speed of robot, for instance: run forward with speed 50
- Do the same with a rotation angle, for instance rotate motor A 4 times forward with speed 50.
- Think of how to allow different versions of this command, such as:
- rotate motor A and B 4 times forward with speed <some value>
- rotate motor A and B and C 4 times forward with speed <some value>
- Read JSGF manual to see how to do this (section Unary Operators)
- How to keep some information about the context? How to implement a short-term memory of a robot?Add following voice commands:
- Increase/Decrease speed by <some value> or Slow down/speed up
did/roboclub/lab8.txt · Last modified: 2024/10/10 09:22 by 127.0.0.1