by ozfiddler » Wed Dec 01, 2010 10:37 am
by ozfiddler
Wed Dec 01, 2010 10:37 am
Hi Kelpy, happy to pass on what I know but it really was quite easy - the VRbot does everything. When you download the GUI and connect it to Robo it installs a revised program automatically that does all of the included sets of commands straight out of the box (it even handled my Australian accent).
If you want to train up some new commands you just do that and then use the "generate code" function and it will make up a new program that includes the new set.
In my case it automatically generated a program that included this code that defines where the commands are:
- Code: Select all
'Groups and Commands
CONST GROUP_0 = 0 '(Command count: 1)
CONST G0_ROBO = 0
CONST GROUP_1 = 1 '(Command count: 9)
CONST G1_STOP = 0
CONST G1_MOVE = 1
CONST G1_HANDS_UP = 2
CONST G1_ROLL = 3
CONST G1_TURN = 4
CONST G1_CLAP = 5
CONST G1_BATTERY = 6
CONST G1_HELLO = 7
CONST G1_HEADSTAND = 8
CONST GROUP_2 = 2 '(Command count: 4)
CONST G2_LEFT = 0
CONST G2_RIGHT = 1
CONST G2_FORWARD = 2
CONST G2_BACK = 3
CONST GROUP_3 = 3 '(Command count: 4)
CONST G3_LEFT = 0
CONST G3_RIGHT = 1
CONST G3_FORWARD = 2
CONST G3_BACK = 3
CONST GROUP_4 = 4 '(Command count: 3)
CONST G4_LEFT = 0
CONST G4_RIGHT = 1
CONST G4_AROUND = 2
Then you just need to edit the code a bit further down, where it says "'start Voice Recognition in current group". This is where you define what each group command will do. My programming is not very elegant but I used this for the above command set:
- Code: Select all
'implement actions based on VRGROUP and VRCOMMAND
IF VRGROUP = GROUP_0 THEN ' Robo has recognised his name
VRGROUP = GROUP_1 ' so activate command Group 1
PRINT &HFE, &H01 ' clear LCD screen
PRINT &HFE, &H80 ' move cursor top left
PRINT "YES" ' Robo is ready for his orders
VRBLINK = 1 ' blink LED to show he is waiting
VRLED = 1 ' on
GOTO MAIN
ENDIF
IF VRGROUP = GROUP_1 THEN ' Robo has received his next command
IF VRCOMMAND = 1 THEN ' Consider MOVE as word 1 of Group 1
VRGROUP = GROUP_2
PRINT &HFE, &H01
PRINT &HFE, &H80
PRINT "MOVE WHICH WAY?"
ELSEIF VRCOMMAND = 3 THEN ' Consider ROLL as word 3 of Group 1
VRGROUP = GROUP_3
PRINT &HFE, &H01
PRINT &HFE, &H80
PRINT "ROLL WHICH WAY?"
ELSEIF VRCOMMAND = 4 THEN ' Consider TURN as word 4 of Group 1
VRGROUP = GROUP_4
PRINT &HFE, &H01
PRINT &HFE, &H80
PRINT "TURN WHICH WAY?"
ELSE
VRGROUP = GROUP_0 ' back to trigger
VRBLINK = 0 'still
VRLED = 1 'off
ENDIF
ON VRCOMMAND GOTO sleep,MAIN,hands_up,MAIN,MAIN,clap,battery,bow,K9
ENDIF
IF VRGROUP = GROUP_2 THEN
VRGROUP = GROUP_0 ' back to trigger
VRBLINK = 0 'still
VRLED = 1 'off
ON VRCOMMAND GOTO left_shift,right_shift,forward_move,backward_move
ENDIF
IF VRGROUP = GROUP_3 THEN
VRGROUP = GROUP_0 ' back to trigger
VRBLINK = 0 'still
VRLED = 1 'off
ON VRCOMMAND GOTO left_roll,right_roll,forward_roll,back_roll
ENDIF
IF VRGROUP = GROUP_4 THEN
VRGROUP = GROUP_0 ' back to trigger
VRBLINK = 0 'still
VRLED = 1 'off
ON VRCOMMAND GOTO left_turn,right_turn,turn_around
ENDIF
GOTO MAIN
'============================================
The "ON VRCOMMAND GOTO..." line just passes the program to command 0, 1, 2 ...etc of the group that is currently defined. I've used the subroutine name but you can also use k1, k2, k3 etc. It's probably kindergarten programming for most people but it took me a little while to get my head around it.
You might also want to look at this post on the VRbot forum:
http://www.veear.eu/Forums/tabid/236/forumid/8/threadid/44/scope/posts/Default.aspx
Anyway, let me know if you have problems.
Hi Kelpy, happy to pass on what I know but it really was quite easy - the VRbot does everything. When you download the GUI and connect it to Robo it installs a revised program automatically that does all of the included sets of commands straight out of the box (it even handled my Australian accent).
If you want to train up some new commands you just do that and then use the "generate code" function and it will make up a new program that includes the new set.
In my case it automatically generated a program that included this code that defines where the commands are:
- Code: Select all
'Groups and Commands
CONST GROUP_0 = 0 '(Command count: 1)
CONST G0_ROBO = 0
CONST GROUP_1 = 1 '(Command count: 9)
CONST G1_STOP = 0
CONST G1_MOVE = 1
CONST G1_HANDS_UP = 2
CONST G1_ROLL = 3
CONST G1_TURN = 4
CONST G1_CLAP = 5
CONST G1_BATTERY = 6
CONST G1_HELLO = 7
CONST G1_HEADSTAND = 8
CONST GROUP_2 = 2 '(Command count: 4)
CONST G2_LEFT = 0
CONST G2_RIGHT = 1
CONST G2_FORWARD = 2
CONST G2_BACK = 3
CONST GROUP_3 = 3 '(Command count: 4)
CONST G3_LEFT = 0
CONST G3_RIGHT = 1
CONST G3_FORWARD = 2
CONST G3_BACK = 3
CONST GROUP_4 = 4 '(Command count: 3)
CONST G4_LEFT = 0
CONST G4_RIGHT = 1
CONST G4_AROUND = 2
Then you just need to edit the code a bit further down, where it says "'start Voice Recognition in current group". This is where you define what each group command will do. My programming is not very elegant but I used this for the above command set:
- Code: Select all
'implement actions based on VRGROUP and VRCOMMAND
IF VRGROUP = GROUP_0 THEN ' Robo has recognised his name
VRGROUP = GROUP_1 ' so activate command Group 1
PRINT &HFE, &H01 ' clear LCD screen
PRINT &HFE, &H80 ' move cursor top left
PRINT "YES" ' Robo is ready for his orders
VRBLINK = 1 ' blink LED to show he is waiting
VRLED = 1 ' on
GOTO MAIN
ENDIF
IF VRGROUP = GROUP_1 THEN ' Robo has received his next command
IF VRCOMMAND = 1 THEN ' Consider MOVE as word 1 of Group 1
VRGROUP = GROUP_2
PRINT &HFE, &H01
PRINT &HFE, &H80
PRINT "MOVE WHICH WAY?"
ELSEIF VRCOMMAND = 3 THEN ' Consider ROLL as word 3 of Group 1
VRGROUP = GROUP_3
PRINT &HFE, &H01
PRINT &HFE, &H80
PRINT "ROLL WHICH WAY?"
ELSEIF VRCOMMAND = 4 THEN ' Consider TURN as word 4 of Group 1
VRGROUP = GROUP_4
PRINT &HFE, &H01
PRINT &HFE, &H80
PRINT "TURN WHICH WAY?"
ELSE
VRGROUP = GROUP_0 ' back to trigger
VRBLINK = 0 'still
VRLED = 1 'off
ENDIF
ON VRCOMMAND GOTO sleep,MAIN,hands_up,MAIN,MAIN,clap,battery,bow,K9
ENDIF
IF VRGROUP = GROUP_2 THEN
VRGROUP = GROUP_0 ' back to trigger
VRBLINK = 0 'still
VRLED = 1 'off
ON VRCOMMAND GOTO left_shift,right_shift,forward_move,backward_move
ENDIF
IF VRGROUP = GROUP_3 THEN
VRGROUP = GROUP_0 ' back to trigger
VRBLINK = 0 'still
VRLED = 1 'off
ON VRCOMMAND GOTO left_roll,right_roll,forward_roll,back_roll
ENDIF
IF VRGROUP = GROUP_4 THEN
VRGROUP = GROUP_0 ' back to trigger
VRBLINK = 0 'still
VRLED = 1 'off
ON VRCOMMAND GOTO left_turn,right_turn,turn_around
ENDIF
GOTO MAIN
'============================================
The "ON VRCOMMAND GOTO..." line just passes the program to command 0, 1, 2 ...etc of the group that is currently defined. I've used the subroutine name but you can also use k1, k2, k3 etc. It's probably kindergarten programming for most people but it took me a little while to get my head around it.
You might also want to look at this post on the VRbot forum:
http://www.veear.eu/Forums/tabid/236/forumid/8/threadid/44/scope/posts/Default.aspx
Anyway, let me know if you have problems.