Welcome to DOFBOT-JetsonNANO repository
04.Memory Learning Mode
Memory Learning Mode
First, enter the Docker container; then, execute the instructions provided in the tutorial within the container to launch the program.
1. Function Description
Achieve action learning and execution through voice commands.
2. Startup and Operation
2.1. Startup
Open the terminal and enter the following command to start:
xxxxxxxxxxpython3 ~/Dofbot_2D/src/dofbot_voice/scripts/learnning_model.py2.2. Operation Steps
After the program runs successfully, the voice module will broadcast "I'm here". Then say "Hello, yahboom" to the voice module. The voice module will reply "here" to indicate successful wake-up.
2.2.1. Learning Actions
Move the robotic arm to the desired position, then say "Record it" to the voice module. If fewer than 20 action groups have been entered, the voice module will reply "ok". If 20 action groups have already been entered, the voice module will reply "Too many actions, I Can't record them". If you want to end input, say "Over" to the voice module, and the voice module will reply "ok".
2.2.2. Executing Actions
Say "Display actions" to the voice module. The voice module will reply "ok", and the robotic arm will sequentially move to the previously learned positions.
2.2.3. Clearing Actions
Say "Clear actions" to the voice module. The voice module will reply "ok", and then you can proceed with the next learning session.
3. Core Code Analysis
Source code path: ~/Dofbot_2D/src/dofbot_voice/scripts/learnning_model.py
#Call function to get voice recognition resultresult = mySpeech.speech_read()#If voice recognition result is 55, it means need to learn and record current robotic arm positionif result == 55: time.sleep(.1) Arm.Arm_Action_Study() time.sleep(.5) num = Arm.Arm_Read_Action_Num() print(num) time.sleep(.5) #If less than 20 action groups, broadcast "OK" if num < 20: mySpeech.void_write(55) #If greater than or equal to 20 action groups, broadcast "Too many actions, I Can't record them" elif num >= 20: mySpeech.void_write(56)#If voice recognition result is 56, it means end recording learning actions elif result == 56: mySpeech.void_write(57) Arm.Arm_Button_Mode(0)#If voice recognition result is 57, it means execute previously learned actions elif result == 57: mySpeech.void_write(58) Arm.Arm_Action_Mode(1)#If voice recognition result is 58, it means clear actions in the action list elif result == 58: mySpeech.void_write(59) Arm.Arm_Clear_Action()