Welcome to DOFBOT Pro repository
2. Voice Control Remove Height Abnormal AprilTag
Voice Control Remove Height Abnormal AprilTag
Before running the function, you need to close the App and large programs. For the closing method, refer to [4. Preparation] - [1. Manage APP control services].
1. Function Description
Voice commands are issued to instruct the robotic arm to remove height-abnormal AprilTags.
The wooden blocks used in this lesson: 30x30x30mm Machine Code Blocks.
2. Startup and Operation
2.1. Startup
Users with Jetson-Nano board version need to enter the docker container and input the following commands. Orin board users can directly open the terminal and input the following commands,
xxxxxxxxxx#Start camera and inverse kinematicsros2 launch dofbot_pro_info camera_arm_kin.launch.py#Start speech recognition and broadcastros2 launch yahboom_speech speech.launch.py#AprilTag recognition:ros2 run dofbot_pro_voice_ctrl apriltag_list_VC#Grasp AprilTagros2 run dofbot_pro_voice_ctrl apriltag_remove_higher_VC2.2. Operation Steps
After all programs are running, say "Hello, yahboom" to the speech recognition module, and the speaker will broadcast "here". Then say "Remove machine codes with height anomalies" to the speech module. The robotic arm will lower its gripper to grasp AprilTag blocks higher than 4cm, and the speech module will broadcast "OK". After grasping the AprilTag block, it will place it at the designated position. Finally, the robotic arm returns to its initial posture, and the speech broadcast module will announce "Placement complete". If there are no height-abnormal AprilTags on the current desktop, the speech broadcast module will announce "Stop".

3. Core Code Analysis
3.1. apriltag_list_VC AprilTag Recognition Node
Source code path: ~/dofbot_pro_ws/src/dofbot_pro_voice_ctrl/dofbot_pro_voice_ctrl/AprilTag/apriltag_list_VC.py
Mainly explains how to subscribe to and process speech recognition result topics and publish voice broadcast topics.
xxxxxxxxxx#Create subscriber for speech recognition result topicself.sub_voice = self.create_subscription(Int8,"voice_result",self.getVoiceResultCallBack,1)#Create publisher for voice broadcast topicself.pub_playID = self.create_publisher(Int8,"player_id", 1)#Callback function, if the received speech recognition result data is 99, it means to execute "Remove machine codes with height anomalies" task, then publish voice broadcast command and change self.start_flag, publish target AprilTag informationdef getVoiceResultCallBack(self,msg): if msg.data == 99: play_id = Int8() play_id.data = 45 self.pub_playID.publish(play_id) self.start_flag = True print("Start removing.")#If no height-abnormal AprilTag is found, then publish "Stop" voice broadcast topic if self.no_found == True and self.start_flag == True: print("Not found!") self.no_found = False self.start_flag = False play_id = Int8() play_id.data = 1 self.pub_playID.publish(play_id)3.2. apriltag_remove_higher_VC Robotic Arm AprilTag Grasping Node
Source code path: ~/dofbot_pro_ws/src/dofbot_pro_voice_ctrl/dofbot_pro_voice_ctrl/AprilTag/apriltag_remove_higher_VC.py
Mainly explains how to create and publish voice broadcast topics.
#Create publisher for voice broadcast topicself.pub_playID = self.create_publisher(Int8,"player_id", 1)#After placement is completed, publish "Placement complete" voice broadcast topic messageplay_id = Int8()play_id.data = 81self.pub_playID.publish(play_id)