yahboom
HomeTutorialsProduct
Solution
Blog
Online Store
About Us
EN/中文
Store
AI Voice Interaction Module📖
1. Module information
  • 0. Get started quickly
  • 1. Introduction to Voice Interaction Module
  • 2. Modify the wake-up word and command word
  • 3. Customized protocol entry creation
2. Firmware burning
  • Module firmware burning method
3. Multi-master communication
IIC communication
  • For STM32
  • For Arduino
  • For MSPM0G3507
  • For MSPM0G3519new
  • For ESP32
  • For PICO
  • For RPi5
  • For Jetson
  • For RDK X5
USART communication
  • For STM32
  • For Arduino
  • For MSPM0G3507
  • For MSPM0G3519new
  • For ESP32
  • For PICO2
  • For RPi5
  • For Jetson
  • For RDK X5
4. PC serial port communication
  • PC serial port communication
5. ROS voice interaction
ROS1
  • 1. Environment Construction
  • 2. Voice control car movement
  • 3. Voice control Autopilot
  • 4. Voice control color tracking
  • 5. Voice control multi-point navigation
ROS2
  • 1. Environment Construction
  • 2. Voice control car movement
  • 3. Voice control Autopilot
  • 4. Voice control color tracking
  • 5. Voice control multi-point navigation
Download
  • Code
  • Python driver library
  • Firmware
  • Communication Protocol
  • Software Tools
  • Voice chip datasheet
  • 3D Model File
Download ZIP

Welcome to AI Voice Interaction Module repository

3. Voice control Autopilot

3. Voice control Autopilot

This course needs to be combined with the Rosmaster-X3 car hardware, and only code analysis is done here. First, let's look at the built-in voice commands,

image-20230530183004429

1. Program startup

Terminal input,

xxxxxxxxxx
#Start chassis control
roslaunch yahboomcar_voice_ctrl voice_ctrl_followline.launch
#Open
Line patrol function
python3 ~/driver_ws/src/yahboomcar_voice_ctrl/scripts/voice_Ctrl_follow_line.py

Take the yellow line patrol as an example, put ROSMASTER on the yellow line, adjust the camera position, and bend the camera down. After the program starts, call ROSMASTER "Hi Yahboom" to wake up the module. When it says "Yes", it means the module is awakened. Then you can say "Patrol the yellow line" to it, and ROSMASTER will say "OK, the patrol function has been turned on".

image-20230530201747971

Then, we release the control of ROSMASTER by pressing the R2 button of the handle, and ROSMASTER starts patrolling the yellow line. If there is no remote control, you can also enter the following command through the terminal,

xxxxxxxxxx
rostopic pub /JoyState std_msgs/Bool False

If you want to cancel the patrol function, say "Turn off patrol" to ROSMASTER, ROSMASTER stops, and the voice will say "OK, the patrol function has been turned off".

2. Core code

Code path: ~/driver_ws/src/yahboomcar_voice_ctrl/scripts/voice_Ctrl_follow_line.py

xxxxxxxxxx
#导入语音识别库和创建语音识别对象 Import the speech recognition library and create a speech recognition object
from Speech_Lib import Speech
self.spe = Speech()
#根据读取语音识别到的内容,修改hsv_range的值(process函数),然后获取circle的值 According to the content of the speech recognition, modify the value of hsv_range (process function), and then get the value of circle
self.command_result = self.spe.speech_read()
self.spe.void_write(self.command_result)
if self.command_result == 23 :
    self.model = "color_follow_line"
    print("red follow line")
    self.hsv_range = [(0, 106, 175), (180, 255, 255)]
elif self.command_result == 24 :
    self.model = "color_follow_line"
    print("green follow line")
    self.hsv_range = [(55, 105, 136), (95, 255, 255)]
elif self.command_result == 25 :
    self.model = "color_follow_line"
    print("bule follow line")
    self.hsv_range = [(55, 134, 218), (125, 253, 255)]
elif self.command_result == 26 :
    self.model = "color_follow_line"
    print("yellow follow line")
    self.hsv_range = [(17, 55, 187), (81, 255, 255)]
rgb_img, binary, self.circle = self.color.line_follow(rgb_img, self.hsv_range)
#根据获取到的self.circle的值,作为实际参数传入execute,数据处理,判断是否避障,最后发布速度话题数据 According to the obtained value of self.circle, it is passed as the actual parameter to execute, data processing, whether to avoid obstacles, and finally publishing the speed topic data
if color_radius == 0: self.ros_ctrl.pub_cmdVel.publish(Twist())
else:
    twist = Twist()
    b = Bool()
    [z_Pid, _] = self.PID_controller.update([(point_x - 320)/16, 0])
    if self.img_flip == True: twist.angular.z = +z_Pid
    else: twist.angular.z = -z_Pid
    twist.linear.x = self.linear
    if self.warning > 10:
        rospy.loginfo("Obstacles ahead !!!")
        self.ros_ctrl.pub_cmdVel.publish(Twist())
        self.Buzzer_state = True
        b.data = True
        self.pub_Buzzer.publish(b)
    else:
        if self.Buzzer_state == True:
            b.data = False
            for i in range(3): self.pub_Buzzer.publish(b)
            self.Buzzer_state = False
        self.ros_ctrl.pub_cmdVel.publish(twist)

 

Voice control car movement
Voice control color tracking

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文