5.4.6 Voice-Controlled Car Movement
Feature Introduction
The voice-controlled car movement feature enables controlling the robot to move forward, backward, left, or right through voice commands. This functionality requires integration with the D-Robotics RDK robotic operating system's intelligent voice module. The workflow is illustrated in the figure below:
![]()
This application uses a simulated virtual car in the Gazebo environment on a PC as an example. The published control commands can also be directly applied to physical robots.
Code repository: (https://github.com/D-Robotics/audio_control.git)
Supported Platforms
| Platform | Runtime Environment | Example Functionality |
|---|---|---|
| RDK X3 | Ubuntu 20.04 (Foxy), Ubuntu 22.04 (Humble) | Launch the intelligent voice module to parse voice commands and perform voice control; demonstrate control effects via Gazebo |
| RDK X5, RDK X5 Module | Ubuntu 22.04 (Humble) | Launch the intelligent voice module to parse voice commands and perform voice control; demonstrate control effects via Gazebo |
Note: Only RDK X3 is supported; RDK X3 Module is currently not supported.
Prerequisites
RDK Platform
-
RDK has been flashed with Ubuntu 20.04 or Ubuntu 22.04 image.
-
TogetheROS.Bot has been successfully installed on RDK.
-
The intelligent voice algorithm package has been successfully installed on RDK. Installation commands:
- Foxy
- Humble
sudo apt update
sudo apt install tros-hobot-audiosudo apt update
sudo apt install tros-humble-hobot-audio
If the sudo apt update command fails or returns an error, refer to the FAQ section Common Issues, specifically Q10: How to resolve issues when apt update fails or reports errors?
-
A compatible audio board has been properly connected to the RDK (refer to the Intelligent Voice chapter).
-
A PC on the same network segment as the RDK (either wired or connected to the same Wi-Fi network; the first three segments of the IP addresses must match). The following environments must be installed on the PC:
- Foxy
- Humble
- Ubuntu 20.04 system and ROS2 Foxy Desktop
- Gazebo and Turtlebot3-related packages. Installation commands:
sudo apt-get install ros-foxy-gazebo-*
sudo apt install ros-foxy-turtlebot3
sudo apt install ros-foxy-turtlebot3-simulations
- Ubuntu 22.04 system and ROS2 Humble Desktop
- Gazebo and Turtlebot3-related packages. Installation commands:
sudo apt-get install ros-humble-gazebo-*
sudo apt install ros-humble-turtlebot3
sudo apt install ros-humble-turtlebot3-simulations
Usage Instructions
Start the simulation environment on the PC:
- Foxy
- Humble
source /opt/ros/foxy/setup.bash
source /opt/ros/humble/setup.bash
export TURTLEBOT3_MODEL=burger
ros2 launch turtlebot3_gazebo empty_world.launch.py
After successful launch, the simulated car appears as follows in the Gazebo environment:
![]()
Launch the program on the RDK platform:
- Copy the audio configuration files
- Foxy
- Humble
# Configure the tros.b environment
source /opt/tros/setup.bash
# Configure the tros.b environment
source /opt/tros/humble/setup.bash
# Copy required configuration files for the example from the tros.b installation path.
cp -r /opt/tros/${TROS_DISTRO}/lib/hobot_audio/config/ .
-
Verify the microphone device
The microphone device ID is configured via the
micphone_namefield in the configuration file config/audio_config.json. The default value is "hw:0,0", indicating audio device Card 0, Device 0. You can check available devices using the commandls /dev/snd, e.g., "pcmC0D1c": the trailing "c" denotes a capture device, "C0" indicates Card 0, and "D1" indicates Device 1. In this case, set the parameter to "hw:0,1". -
Launch the program
- Foxy
- Humble
# Configure the tros.b environment
source /opt/tros/setup.bash# Configure the tros.b environment
source /opt/tros/humble/setup.bash# Launch the launch file
ros2 launch audio_control audio_control.launch.pyAfter successful startup, you can control the car’s movement using voice commands such as “Move forward,” “Move backward,” “Turn left,” “Turn right,” and “Stop moving.”