SayIt Module - Program Help
Hey, i have a SayIt Module and the downloadable standard program is working fine.
Anyway i want to have the following commands:
Move forward X feets (0-10)
Move backward X feets(0-10)
Move left X feets (0-10)
Move right X feets (0-10)
Turn left 90,180,270,360 degrees
Turn right 90,180,270,360 degrees
Spin around
Go in Detection Mode
Actually i am very new to PBASIC and i don't know how to program this. I always get an error that my eeprom is full, because my code is very dirty i think.
Could be someone so kind and tell me how to program this ?
Thanks so much.
Anyway i want to have the following commands:
Move forward X feets (0-10)
Move backward X feets(0-10)
Move left X feets (0-10)
Move right X feets (0-10)
Turn left 90,180,270,360 degrees
Turn right 90,180,270,360 degrees
Spin around
Go in Detection Mode
Actually i am very new to PBASIC and i don't know how to program this. I always get an error that my eeprom is full, because my code is very dirty i think.
Could be someone so kind and tell me how to program this ?
Thanks so much.

Comments
this will involve a lot of voice recording and code portions.written, as there will be so many options. Unfortunately you cannot load a variable with this unit as I assume from your post you wish to do.
Wordlist 1: Move, Turn
Wordlist 2: Forward, Backward, Left, Right
Wordlist 3: 1,2,3,4,5,6,7,8,9
I have to make i this way: ??
Move Forward 1
Move Forward 2
......
Move Backward 1
....
?
you have to recvord and write all the necessary code and wordlists for all the options you feel you need and it maybe that's why you are running out of space?
I don't know how to fix that. I mean look at the link i posted. There is a guy who succeeded with this, so there must be a way to get this working.
You first group of wordlists if the way the SayIt works. You need to program the BS to switch wordlists though.
Usually you'd start with the SayIt listening for the trigger word "Robot". Once it hears "Robot" it knows to listen for more commands.
In you example, when "Robot" is heard, the BS would then switch the SayIt's wordlist to #1. While listening for words in wordlist #1, if the SayIt hears "Move", then your program would switch to wordlist #2 and listen for the direction. Once the direction is heard, the BS would switch the SayIt to wordlist #3 to determine how much to move.
The main thing about all this is the SayIt itself isn't very smart. It doesn't know when to switch to different wordlists on its own; it needs the BS to tell it which wordlist to use.
I see you're new to the forum. Welcome. Have you programmed your robot without the SayIt much? You want to make sure you know how to program the robot to do all these tasks without the SayIt before adding the complication of using the SayIt module as an input device.
You mentioned you're new to PBASIC. You might want to get a little more comfortable with programming before adding the SayIt.
It will also help us help you if you post the code you're working on. Phil made a little tutorial on how to use code tags. Here's the link.
Then i say the direction and this works fine too and i set VRGROUP = 3 so he listens for the distance variable. But then i think i have to much cases and thats why my eeprom is full.
Wait a minute i will write the code again like i had it and will post it here.
Thanks again !
The voice recognition unit talked direct to his laptop whereas the Sayit talks via the boe, you may be able to read the serial data from the sayit into your pc but you would have to write some pc code to utilise this and then send the appropriate command back to the boe-bot.
of course this could be achieved with a mic and voice recognition software also.
' {$STAMP BS2} ' {$PBASIC 2.5} ' COM Parameters COM_RX PIN 0 ' rx pin COM_TX PIN 2 ' tx pin COM_SPEED CON 84 ' baud 9600 COM_10MS CON 10 ' 10ms unit ' Protocol Command CMD_BREAK CON "b" ' abort recog or ping CMD_SLEEP CON "s" ' go to power down CMD_KNOB CON "k" ' set si knob <1> CMD_LEVEL CON "v" ' set sd level <1> CMD_LANGUAGE CON "l" ' set si language <1> CMD_TIMEOUT CON "o" ' set timeout <1> CMD_RECOG_SI CON "i" ' do si recog from ws <1> CMD_RECOG_SD CON "d" ' do sd recog at group <1> (0 = trigger mixed si/sd) ' Protocol Status STS_AWAKEN CON "w" ' back from power down mode STS_ERROR CON "e" ' signal error code <1-2> STS_INVALID CON "v" ' invalid command or argument STS_TIMEOUT CON "t" ' timeout expired STS_INTERR CON "i" ' back from aborted recognition (see 'break') STS_SUCCESS CON "o" ' no errors status STS_RESULT CON "r" ' recognised sd command <1> - training similar to sd <1> STS_SIMILAR CON "s" ' recognised si <1> (in mixed si/sd) - training similar to si <1> ' Protocol arguments are in the range 0x40 (-1) TO 0x60 (+31) inclusive ARG_MIN CON 64 ' 0x40 ARG_MAX CON 96 ' 0x60 ARG_ZERO CON 65 ' 0x41 ARG_ACK CON 32 ' 0x20 'TO READ more status arguments 'Groups and Commands GROUP_2 CON 2 '(Command count: 5) G2_FORWARD CON 0 G2_BACKWARD CON 1 G2_LEFT CON 2 G2_RIGHT CON 3 GROUP_3 CON 3 '(Command count: 10) G3_1 CON 0 G3_2 CON 1 G3_3 CON 2 G3_4 CON 3 G3_5 CON 4 G3_6 CON 5 G3_7 CON 6 G3_8 CON 7 G3_9 CON 8 G3_10 CON 9 RES_ERROR CON 255 RES_TIMEOUT CON 254 RES_COMMFAIL CON 253 RES_BUILTIN CON 32 'Robot Constant VRLED PIN 4 'Global Variable VRA VAR Byte VRA1 VAR Byte VRGROUP VAR Byte VRCOMMAND VAR Byte VRVARIABLE VAR Byte ' Main Start INPUT COM_RX HIGH COM_TX Restart: LOW VRLED VRGROUP = 2 DEBUG CR, "Setting up Robot... " 'Wake up or stop recognition GOSUB VR_Wakeup DEBUG "awake... " 'Set SI Language VRA1 = 3 GOSUB VR_SetLanguage DEBUG "language ", DEC VRA1, "... " 'Set 5 seconds timeout VRA1 = 5 GOSUB VR_SetTimeout DEBUG "timeout ", DEC VRA1, "... " DEBUG CR, "Robot ready!" VR_Loop: DEBUG CR, "Robot in group ", DEC VRGROUP, " waiting for command... " LOW VRLED PAUSE 150 IF VRGROUP > 0 THEN HIGH VRLED VRA1 = VRGROUP GOSUB VR_RecognizeSD '-- handle errors or timeout IF VRA1 = RES_ERROR THEN DEBUG "error" 'try again in the same group GOTO VR_Loop ENDIF IF VRA1 = RES_TIMEOUT THEN DEBUG "timed out" VRGROUP = 2 ' back to trigger GOTO VR_Loop ENDIF IF VRA1 = RES_COMMFAIL THEN DEBUG "comm failed" 'resync and try again GOSUB VR_Wakeup GOTO VR_Loop ENDIF '-- got a command VRCOMMAND = VRA1 IF VRCOMMAND <= RES_BUILTIN THEN GOSUB VR_Action GOTO VR_Loop VR_Action: SELECT VRGROUP CASE GROUP_2 SELECT VRCOMMAND CASE G2_FORWARD VRGROUP = 3 VRVARIABLE = 0 CASE G2_BACKWARD VRGROUP = 3 VRVARIABLE = 1 CASE G2_LEFT VRGROUP = 3 VRVARIABLE = 2 CASE G2_RIGHT VRGROUP = 3 VRVARIABLE = 3 ENDSELECT CASE GROUP_3 SELECT VRCOMMAND CASE G3_1 SELECT VRVARIABLE CASE 0 DEBUG "Move Forward 1" CASE 1 DEBUG "Move Backward 1" CASE 2 DEBUG "Move Left 1" CASE 3 DEBUG "Move Right 1" ENDSELECT CASE G3_2 SELECT VRVARIABLE CASE 0 DEBUG "Move Forward 2" CASE 1 DEBUG "Move Backward 2" CASE 2 DEBUG "Move Left 2" CASE 3 DEBUG "Move Right 2" ENDSELECT CASE G3_3 SELECT VRVARIABLE CASE 0 DEBUG "Move Forward 3" CASE 1 DEBUG "Move Backward 3" CASE 2 DEBUG "Move Left 3" CASE 3 DEBUG "Move Right 3" ENDSELECT CASE G3_4 SELECT VRVARIABLE CASE 0 DEBUG "Move Forward 4" CASE 1 DEBUG "Move Backward 4" CASE 2 DEBUG "Move Left 4" CASE 3 DEBUG "Move Right 4" ENDSELECT CASE G3_5 SELECT VRVARIABLE CASE 0 DEBUG "Move Forward 5" CASE 1 DEBUG "Move Backward 5" CASE 2 DEBUG "Move Left 5" CASE 3 DEBUG "Move Right 5" ENDSELECT CASE G3_6 SELECT VRVARIABLE CASE 0 DEBUG "Move Forward 6" CASE 1 DEBUG "Move Backward 6" CASE 2 DEBUG "Move Left 6" CASE 3 DEBUG "Move Right 6" ENDSELECT CASE G3_7 SELECT VRVARIABLE CASE 0 DEBUG "Move Forward 7" CASE 1 DEBUG "Move Backward 7" CASE 2 DEBUG "Move Left 7" CASE 3 DEBUG "Move Right 7" ENDSELECT CASE G3_8 SELECT VRVARIABLE CASE 0 DEBUG "Move Forward 8" CASE 1 DEBUG "Move Backward 8" CASE 2 DEBUG "Move Left 8" CASE 3 DEBUG "Move Right 8" ENDSELECT CASE G3_9 SELECT VRVARIABLE CASE 0 DEBUG "Move Forward 9" CASE 1 DEBUG "Move Backward 9" CASE 2 DEBUG "Move Left 9" CASE 3 DEBUG "Move Right 9" ENDSELECT CASE G3_10 SELECT VRVARIABLE CASE 0 DEBUG "Move Forward 10" CASE 1 DEBUG "Move Backward 10" CASE 2 DEBUG "Move Left 10" CASE 3 DEBUG "Move Right 10" ENDSELECT ENDSELECT ENDSELECT RETURN '=== VR Routines === ' Wake up: VR_Wakeup: TOGGLE VRLED VRA = CMD_BREAK SEROUT COM_TX, COM_SPEED, [VRA] SERIN COM_RX, COM_SPEED, 100*COM_10MS, VR_Wakeup, [VRA] IF (VRA <> STS_SUCCESS) THEN GOTO VR_Wakeup LOW VRLED RETURN ' Inputs: ' VRA1 = language index (0 = english, ...) VR_SetLanguage: VRA = CMD_LANGUAGE SEROUT COM_TX, COM_SPEED, [VRA] VRA1 = VRA1 + ARG_ZERO SEROUT COM_TX, COM_SPEED, [VRA1] SERIN COM_RX, COM_SPEED, 20*COM_10MS, VR_CommFailed, [VRA] VRA1 = VRA1 - ARG_ZERO 'IF (VRA <> STS_SUCCESS) THEN GOTO VR_Wakeup RETURN ' Inputs: ' VRA1 = timeout (in ms, 0=forever, 255=default) VR_SetTimeout: VRA = CMD_TIMEOUT SEROUT COM_TX, COM_SPEED, [VRA] VRA1 = VRA1 + ARG_ZERO SEROUT COM_TX, COM_SPEED, [VRA1] SERIN COM_RX, COM_SPEED, 20*COM_10MS, VR_CommFailed, [VRA] VRA1 = VRA1 - ARG_ZERO 'IF (VRA <> STS_SUCCESS) THEN GOTO VR_Wakeup RETURN ' Inputs: ' VRA1 = SI knob (0=loosest, 2=normal, 4=tightest) VR_SetKnob: VRA = CMD_KNOB SEROUT COM_TX, COM_SPEED, [VRA] VRA1 = VRA1 + ARG_ZERO SEROUT COM_TX, COM_SPEED, [VRA1] SERIN COM_RX, COM_SPEED, 20*COM_10MS, VR_CommFailed, [VRA] VRA1 = VRA1 - ARG_ZERO 'IF (VRA <> STS_SUCCESS) THEN GOTO VR_Wakeup RETURN ' Inputs: ' VRA1 = SD level (1=easy, 2=default, 5=hard) VR_SetLevel: VRA = CMD_LEVEL SEROUT COM_TX, COM_SPEED, [VRA] VRA1 = VRA1 + ARG_ZERO SEROUT COM_TX, COM_SPEED, [VRA1] SERIN COM_RX, COM_SPEED, 20*COM_10MS, VR_CommFailed, [VRA] VRA1 = VRA1 - ARG_ZERO 'IF (VRA <> STS_SUCCESS) THEN GOTO VR_Wakeup RETURN ' Inputs: ' VRA1 = wordset (0=trigger) ' Ouputs: ' VRA1 = result (0-31=word, 32..=builtin, 253=comm err, 254=timeout, 255=error) VR_RecognizeSI: VRA = CMD_RECOG_SI GOTO VR_Recognize0 VR_RecognizeSD: VRA = CMD_RECOG_SD VR_Recognize0: SEROUT COM_TX, COM_SPEED, [VRA] ' send Group/WS VRA1 = VRA1 + ARG_ZERO SEROUT COM_TX, COM_SPEED, [VRA1] ' wait for answer SERIN COM_RX, COM_SPEED, 600*COM_10MS, VR_CommFailed, [VRA] IF VRA = STS_RESULT THEN ' send ack VRA = ARG_ACK SEROUT COM_TX, COM_SPEED, [VRA] ' wait for recognised command code SERIN COM_RX, COM_SPEED, 20*COM_10MS, VR_CommFailed, [VRA1] VRA1 = VRA1 - ARG_ZERO ELSEIF VRA = STS_SIMILAR THEN ' send ack VRA = ARG_ACK SEROUT COM_TX, COM_SPEED, [VRA] ' wait for recognised command code SERIN COM_RX, COM_SPEED, 20*COM_10MS, VR_CommFailed, [VRA1] VRA1 = VRA1 - ARG_ZERO + RES_BUILTIN ELSEIF VRA = STS_TIMEOUT THEN VRA1 = RES_TIMEOUT ELSE VRA1 = RES_ERROR ENDIF RETURN VR_CommFailed: VRA1 = RES_COMMFAIL RETURNOf course instead of the DEBUG commands i would move the robot but for test purposes this is my code. Anyway i always get "eeprom is full" i think because of this high number of CASE commands.
I just looked at the post you linked to. He was using a computer for the speech recognition. The computer was only sending three variables to the robot. His setup doesn't put much of a burden on the BS2.
I do think the BS2 will be able to use the SayIt to control the BOE-Bot. It might take some careful programming not to use up all its EEPROM. I personally don't program Basic Stamps any more (I'm a Propeller fan) but there are lots of other forum members who could help you squeeze your code into a BS2. I'd suggest starting simple and then add more advanced features once you have the simple stuff working correctly.
Anyway how could i complete this ?
One thing I noticed was all the strings. Strings take up a lot of memory.
Instead of
use
You could alternatively have the string
stored only a single time and reuse it in your debug statements and just add a unique ending as needed. I don't know how to do this with a BS2 but I bet others around here do.
I bet there are other memory saving tricks that would help reduce the size of your code. Hopefully other forum members will point them out.
I still think the BS2 can handle this project just fine (without needing a PC). Of course there will be a limit on how many tasks the BS2 can store, but I bet you could get your BOE-Bot to do a lot of stuff if you're careful with your programming.
Otherwise it's a case of going down the route like in the link you posted.
Do you mean hacking the SayIt's firmware?
The SayIt will work fine independent of the PC. You don't even need a PC to program in custom words. The PC software for the SayIt just sends serial commands to the SayIt module (via the bridge program). A microcontroller could also send these same commands. The PC software just make it more convient to program the custom words in the SayIt by letting the user interact with an easy to use GUI that takes care of sending the proper serial commands for you.
The PC software also generates a PBASIC template to help get you started with the programming process. The template isn't very smart. The user still needs to do a lot of work to make a useful PBASIC program from the template.
This is a great project. The BS2 can do this! It will only need the PC for editing and loading the program. It will not be dependent on the PC when it's roaming around listening for your commands. (Because of servo noise, the BOE-Bot might need to be standing still to hear commands.)
The suggestion to hack the firmware was so that it could be used like the speech recognition unit he posted in his link, as it stands the Sayit would not be able to do what he wants unles he cuts back on his command list.
I check the cases and for example i am in the case forward 1 feet. So i write in this case GOSUB MForward
The MForward Method looks like this:
MForward: FOR counter = 1 TO ((var3-48) * 70) GOSUB Forward PAUSE 20 NEXT RETURNAnd the Forward method like this:
But how does the method MForward get the value for var3 ?
Thanks !
Really? You don't think a BS2 could handle these commands?
I just find that hard to believe. As I mentioned, I don't use Basic Stamps anymore but I still think the BS2 could handle this project.
Any other BS2 users around that have an opinion about this? Chris, Mike, Tracy, erco, PJ?
You will have to record a command for each value of var 3 to do something for each option you would fill in the program code in the template, it's laborius but i'm afraid it's the only way
So to summarize you would have forward code for 1 foot, 2 foot, 3 foot etc.......
you could get the relevant code to say that var 3 is this value but it would still probably have the same amount of commands and code snippets to achieve the same result.