Shop OBEX P1 Docs P2 Docs Learn Events
Say It Module - asyncrhonously? — Parallax Forums

Say It Module - asyncrhonously?

mtylerjrmtylerjr Posts: 5
edited 2011-01-16 13:54 in BASIC Stamp
Hello!

I'm trying to use the "Say It" module - its a nice little package and it seems fairly accurate.

My only problem is that it seems to be only useable synchronously - if it is listening for a match, it is tying up the Micro.

Im using the standard boe-bot, with stamp BS2 - is there any way to continue to do other things, while the say-it module is listening?

For instance, can you even drive servos and have the boe-bot rol continuously, and still be able to command it to stop?

From what Ive seen of the documentation and sample program, you cant do this. Has anyone else made better progress?

Thanks in advance!

Comments

  • FranklinFranklin Posts: 4,747
    edited 2011-01-14 21:02
    Have you tried the demo code for controlling your boebot with the sayit module referenced in the documentation and available on the Parallax site?
  • mtylerjrmtylerjr Posts: 5
    edited 2011-01-14 21:34
    Yes - the demo program is the "sample program" I mentioned in my post. The sample program issues a serial command to the say it module, but then must wait for the timeout, or a recognized response, before moving on to any other task, like updating servos, or communicating via bluetooth, or anything else. Im just looking for ideas that anyone might have around this limitation (if I am understanding the limitation)

    Maybe if I added some serial buffers that would store any response, so I could go look for it later... has anyone done that?
  • mtylerjrmtylerjr Posts: 5
    edited 2011-01-14 22:06
    Hmm

    Looking further into the docs, it looks like the host has to ack each byte of the response anyway - so perhaps I can write code so that the command is issed, then the code services other tasks, and only then does it pull the response out, just before sending the next "listen" command.

    I will restructure things to see if that works!
  • FranklinFranklin Posts: 4,747
    edited 2011-01-14 22:08
    The stamp can only do one thing at a time. What happens when you run the demo code and have you loaded it exactly as published?
  • mtylerjrmtylerjr Posts: 5
    edited 2011-01-16 13:54
    The sample program works fine, but it is a start/stop kind of program program - the code sends a command to the say-it-module to listen to a wordset or trigger, then waits for the response, then does one thing (moves, turns, whatever)

    I was trying to do something more real-time.

    Right now, I have a mini rtos that updates the servos continuously, and communicates to a host via bluetooth. I can poll the bluetooth for input, and timeout after a few milliseconds if there is none, and then continue to update the servos so they never slow down, and I can control the bot, turn it, change speeds etc, as it moves continuously, it doesnt need to stop unless I send it a command to stop.

    I was trying also add a voice-control aspect to my existing setup, but the problem is that I needed to be able to poll the status of the say-it-module and only wait (use up precious milliseconds during the main loop) if it has a response. I cant wait long or the servos will slow and the bot will stop.

    I almost was able to do this, setting the module to use an "unlimited" timeout, then sending a recognize command, and then giving a short (20-30 ms) timeout for the SERIN command to get responses, checking the module each time through my main loop to see if it has recognized anything - but this seems to only work sometimes - using the SERIN command that frequently, while the module it is in recognize mode, seems to but hit and miss as far as getting the response. Sometimes it works, sometimes it doesnt.

    I think the say-it-module would be infinitely more useable, especially in a real-time way, if it simply provided a signal on one of its unused pins, driving it high when it has a recogniztion response, so all you would need to do is send a command, then just check the status of that pin/signal from time to to time to see if a command has been recognized, before asking for the response. That way, you wouldnt need to waste precious milliseconds waiting for a SERIN timeout if there is no response yet.

    Then it could be used in a much-more real-time way.

    For now, to do what I want to do, I am actually going to mount a second board (a spare homework board) on top of the BOE, as a second level, that will handle just the voice-activation part - so when a command is recognized, I can just set a signal pin, and then the lower BOE board itself can just check this signal , and only react when a command is recognized. I need to use dual processors to do what I need, basically, with one dedicated just to handling the say-it-module.

    Who makes the say-it-module, anyway? Is it a parallax-specific product? Just adding a "response ready" signal on a spare pin would make it very much more useful in a real-time environment, imho.

    In any case, it is a cool little module, despite the limitations. I am having a lot of fun with it, and I definitely think it was worth the money
Sign In or Register to comment.