Welcome to DOFBOT-JetsonNANO repository
02.Smart Voice Control
Smart Voice Control
First, enter the Docker container; then, execute the instructions provided in the tutorial within the container to launch the program.
1. Function Description
Control the robotic arm to perform different actions through voice commands.
2. Startup and Operation
2.1. Startup
Open the terminal and enter the following command to start:
xxxxxxxxxxpython3 ~/Dofbot_2D/src/dofbot_voice/scripts/intelligent_voice_ctrl.py2.2. Operation Steps
After the program runs, the voice module will broadcast "here". Then say "Hello, yahboom" to the voice module. The voice module will reply "here" to indicate successful wake-up. Then say "action a" to the voice module. The voice module will broadcast "ok", and then the robotic arm's gripper will tighten and then release, tighten and then release, simulating a clapping motion. The voice commands that this program can recognize are as follows:
| Voice Command | Effect |
|---|---|
| ACTION-A | Gripper opens and closes (clapping) |
| ACTION-B | Robotic arm moves up, servo 4 moves up and down (nodding) |
| ACTION-C | Robotic arm presents praying posture (praying) |
| ACTION-D | Robotic arm presents kneeling posture (kneeling) |
| RESET | Return to robotic arm extended state |
| ACTION-E | Robotic arm extends upward, turns left and right (startled) |
3. Core Code Analysis
Users need to enter the docker container to view
Source code path: ~/Dofbot_2D/src/dofbot_voice/scripts/intelligent_voice_ctrl.py
x#Import robotic arm underlying control libraryimport Arm_Lib#Import voice recognition broadcast libraryfrom Speech_Lib import Speech#Create voice recognition broadcast object mySpeechmySpeech = Speech()#Create robotic arm underlying control object ArmArm = Arm_Lib.Arm_Device()#Call speech_read function to get voice recognition resultresult = mySpeech.speech_read()#Call Arm_serial_servo_write6 function to control six servos to rotate to set angles, 1000 means complete the six servo angle rotation task within 1000 millisecondsArm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 1000)