Welcome to AI Voice Interaction Module repository
5. Voice control multi-point navigation
5. Voice-controlled multi-point navigation
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,

1. Program startup
1.1. Calibrate the target point
Terminal input,
xxxxxxxxxxroslaunch yahboomcar_nav laser_bringup.launch #laser + yahboomcarroslaunch yahboomcar_nav yahboomcar_navigation.launch use_rviz:=false map:=house#Open navigation, house is changed to the map name for mapping[use_rviz] parameter: whether to open rviz.
[map] parameter: map name, map to load.
Open the visualization interface (virtual machine side)
xxxxxxxxxxroslaunch yahboomcar_nav view_navigate.launch
1) In the map rviz, adjust the initial posture of ROSMASTER;
2) Terminal input
xxxxxxxxxxrostopic echo /move_base_simple/goal
3) Use the 2D Nav Goal tool in rviz to give the car a target point in rviz, recorded as position 1. At this time, the coordinates of the target point will be printed in the terminal window where the data of /move_base_simple/goal was just viewed, as shown in the figure below,

Just record the pose part of the data, and you need to send this part manually through the program later.
1.2. Write the target point position into the program
Open ~/yahboomcar/src/yahboomcar_voice_ctrl/scripts/voice_Ctrl_send_mark.py, and modify the pose data just recorded to the corresponding position.
xxxxxxxxxxpose.pose.position.x = 2.15381097794pose.pose.position.y = -5.02386903763pose.pose.orientation.z = 0.726492681307pose.pose.orientation.w = 0.687174202082
The marking results of the other points are also marked in rviz according to the above steps, and the coordinates of the pose points are recorded. Then modify them to the corresponding positions.
1.3, Voice Navigation
Terminal input,
xxxxxxxxxxroslaunch yahboomcar_nav laser_bringup.launch #laser + yahboomcarroslaunch yahboomcar_nav yahboomcar_navigation.launch use_rviz:=false map:=house #Open navigation, house is changed to the map name for mappingpython ~/yahboomcar_ws/src/yahboomcar_voice_ctrl/scripts/voice_Ctrl_send_mark.pyAfter calibrating the initial position in rviz, say "Hi Yahboom" to ROSMASTER to wake up the voice module. After hearing the voice module feedback "Here", say "Navigate to location 1" to ROSMASTER; the voice module will feedback "OK, going to location 1". The same is true for other locations, as long as the coordinate values of the destinations of other points are written in the program.
2. Code analysis
Code path: ~/driver_ws/src/yahboomcar_voice_ctrl/scripts/voice_Ctrl_send_mark.py
xxxxxxxxxx#创建目标点发布者发布目标位姿 Create a target point publisher to publish the target posepub_goal = rospy.Publisher('move_base_simple/goal', PoseStamped, queue_size=1)#打包目标点数据 Packing target point dataspeech_r = spe.speech_read()if speech_r == 19 : print("goal to one") spe.void_write(speech_r) pose.pose.position.x = 2.15381097794 pose.pose.position.y = -5.02386903763 pose.pose.orientation.z = 0.726492681307 pose.pose.orientation.w = 0.687174202082 #发布坐标点位姿 Publish coordinate point pose pub_goal.publish(pose)