Welcome to DOFBOT-Ultra repository
2. Smart Voice Control
Smart Voice Control
If using a depth camera (DABAI_DCW2), before running this example, be sure to execute
ros2 run dofbot_ultra_driver calibrate_6pointfor a six-point calibration, otherwise the robot arm cannot accurately locate the target.
Please ensure that the web control program backend process is not running in the background. To close it, refer to the [Get Started Quickly - 2. Access the Terminal] section in [Disable the Auto-Start Web Control Backend Process]. After closing, please restart DofbotUltra!!!
1. Operation Instructions
1.1. Startup
Before running the function, you need to shut down the web control program backend process. For the shutdown method, please refer to the [4. Preparation - 1. Manage Web control services].
Raspberry Pi version (in Docker environment), enter the following command:
python3 /home/yahboom/dofbot_ultra/2d/dofbot_voice/scripts/intelligent_voice_ctrl.pyRDK X5 version (native environment), enter the following command:
xxxxxxxxxxpython3 /home/sunrise/dofbot_ultra_ws/src/2d/dofbot_voice/scripts/intelligent_voice_ctrl.py1.2. Command Word Table
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) |
2. Code Logic
Compared to the simple mode, this case adds the "action a" and "action b" commands, controlling the arm through angle control mode, using Arm_serial_servo_write6() to write 6 servo angles simultaneously.
Each movement replicates human gestures (such as clapping, nodding, praying, and so on) through precisely calibrated combinations of joint angles. The coordinated motion timing between servo motors is the key to achieving lifelike movements.
3. Source Code
Raspberry Pi: /home/yahboom/dofbot_ultra/2d/dofbot_voice/scripts/intelligent_voice_ctrl.py
RDK X5: /home/sunrise/dofbot_ultra_ws/src/2d/dofbot_voice/scripts/intelligent_voice_ctrl.py
ximport Arm_Libfrom Speech_Lib import SpeechmySpeech = Speech()Arm = Arm_Lib.Arm_Device()result = mySpeech.speech_read()Arm.Arm_serial_servo_write6(90, 90, 90, 90, 90, 90, 1000)Arm_serial_servo_write6(s1, s2, s3, s4, s5, s6, time)- Simultaneously control 6 servos with angle values, motion completes within the specified time- Unlike the simple mode, this function does not block with
time.sleep(), allowing continuous control during motion