Welcome to DOFBOT SE repository
2.Smart Voice Control
Smart Voice Control
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_voice/scripts/intelligent_voice_ctrl.py2.2 Operation Steps
After the program runs, the voice module will broadcast "I'm here", then say "Hi, yahboom" to the voice module. The voice module replies "I'm here" indicating successful wake-up. Then say "Applaud" to the voice module. The voice module will broadcast "OK", and then the gripper of the robotic arm will clamp and release, clamp and release, simulating a clapping action. 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
Source code path: ~/dofbot_voice/scripts/intelligent_voice_ctrl.py
x# Import robotic arm low-level control libraryimport Arm_Lib# Import voice recognition and broadcast libraryfrom Speech_Lib import Speech# Create voice recognition and broadcast object mySpeechmySpeech = Speech()# Create robotic arm low-level 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, control six servos to rotate to set angles, 1000 means complete the rotation of six servos within 1000 millisecondsArm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 1000)