Welcome to ROSMASTER X3 Plus repository
7. Voice control multi-point navigation
7. Voice control multi-point navigation
7. Voice control multi-point navigation7.1. Description 7.2. Steps7.2.1. Function package path 7.2.2. Calibrate the target point7.2.2. Voice navigation 7.3. Code analysis 7.3.1. For the principle of navigation, please refer to the tutorial "11. Lidar/12. Navigation and Obstacle Avoidance". This course is mainly to judge the results of voice recognition.7.3.2. Flowchart 7.3.3. Voice module communication protocol
7.1. Description
On the established map, voice control ROSMASTER to navigate to point1, point2, point3. The R2 key on the handle can stop/start this function at any time.
7.2. Steps
7.2.1. Function package path
xxxxxxxxxx~/yahboomcar/src/yahboomcar_voice_ctrl/
7.2.2. Calibrate the target point
robot side
xxxxxxxxxx#You need to enter docker first, perform this step more#If running the script to enter docker fails, please refer to 07.Docker-orin/05, Enter the robot's docker container~/run_docker.shroslaunch yahboomcar_nav laser_bringup.launch #laser + yahboomcar <Open another terminal and enter the same docker container

xxxxxxxxxxroslaunch yahboomcar_nav yahboomcar_navigation.launch use_rviz:=false map:=house # start navigation, change house to the map name of the map [use_rviz] parameter: whether to open rviz.
[map] Parameters: map name, the map to be loaded.
Open the visual interface (virtual machine side)
xxxxxxxxxxroslaunch yahboomcar_nav view_navigate.launch1) In the map rviz, adjust the initial posture of ROSMASTER;
- terminal input
xxxxxxxxxxrostopic echo /move_base_simple/goal- Using the 2D Nav Goal tool in rviz, a target point of the car is given in rviz, which is recorded as position 1. At this time, the coordinates of the target point will be printed out in the terminal window that just viewed the data of/move_base_simple/goal. As shown below.

We only need to record the data for that part of the pose. Later, we need to send this part of the content manually through the program.
- open ~/yahboomcar/src/yahboomcar_voice_ctrl/scripts/voice_Ctrl_send_mark.py, and modify the pose data just recorded to the corresponding location.
xxxxxxxxxx pose.pose.position.x = 2.15381097794 pose.pose.position.y = -5.02386903763 pose.pose.orientation.z = 0.726492681307 pose.pose.orientation.w = 0.687174202082About the other two points B/C, use the same steps.
7.2.2. Voice navigation
xxxxxxxxxxroslaunch yahboomcar_nav laser_bringup.launch #laser + yahboomcar roslaunch yahboomcar_nav yahboomcar_navigation.launch use_rviz:=false map:=house # start navigation, change house to the map name of the map python ~/yahboomcar_ws/src/yahboomcar_voice_ctrl/scripts/voice_Ctrl_send_mark.py- After calibrating the initial pose in rviz, we can say "Hi Yahboom" to wake up the voice module, until it replies "Hi, i'm here", indicating that the module has been woken up.
- We say "Go to the point A", it will reply "OK, I'm going to the point A."
7.3. Code analysis
7.3.1. For the principle of navigation, please refer to the tutorial "11. Lidar/12. Navigation and Obstacle Avoidance". This course is mainly to judge the results of voice recognition.
Target point data,
xxxxxxxxxx speech_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 pub_goal.publish(pose) elif speech_r == 20 : print("goal to tow") spe.void_write(speech_r) pose.pose.position.x = 1.57744419575 pose.pose.position.y = 4.8174996376 pose.pose.orientation.z = -0.683335654604 pose.pose.orientation.w = 0.730104364558 pub_goal.publish(pose) elif speech_r == 21 : print("goal to three") spe.void_write(speech_r) pose.pose.position.x = -1.08106160164 pose.pose.position.y = 1.30198049545 pose.pose.orientation.z = -0.0132771070267 pose.pose.orientation.w = 0.99991185533 pub_goal.publish(pose) elif speech_r == 32 : print("goal to four") spe.void_write(speech_r) pose.pose.position.x = -1.08106160164 pose.pose.position.y = 1.30198049545 pose.pose.orientation.z = -0.0132771070267 pose.pose.orientation.w = 0.99991185533 pub_goal.publish(pose) elif speech_r == 33 : print("goal to Origin")