View Full Version : How di I better navagate with IR Eyes..

01-11-2006, 09:46 PM
Little history, trying to get a couple of Sharp IR to work. Finally did that with help from here. Now I cant seem to get the bot to move while I am checking the IR's. Pusedo Code is as follows:

Gosub CheckEyes ' This checks the Ir's both Left Front and Right Front.
If (left Distance < Min Distance) and (Right Distance < Min Distance)
Rightpulse = XXX 'All Stop
leftpuse = XXX
ElseIf left Distance < xxx
RightPulse = XXXX ' Turn Right
ElseIf Right Distance < XXX
LeftPUlse = XXX 'Turn Left
RightPulse = XXXX
LeftPulse = XXXX 'Go Forward
Pulsout 14, rightpulse
Pulsout 15, leftpulse

Now, if I take out the CheckEyes it works fine, but once I put the Checkeyes Routine in then the bot pulses..

Don "Ho"

Post Edited (don_s) : 1/11/2006 5:44:41 PM GMT

PJ Allen
01-11-2006, 09:49 PM
The STAMP doesn't multi-task --·if you're going to "Check Eyes" then you can't do anything else, exactly.

01-11-2006, 10:04 PM
Thanks for the fast reply. I understand about the multi-tasking, so I guess I am trying to find help on correcting this problem. Is there a way to put the servos in a "COAST" mode until I can get the info back from the IR's? Or every time I want to check my distance, I have to stop the bot? I dont seem to remember having this issue when I was using the IR's that came with the kit.

Don "Ho"

PJ Allen
01-11-2006, 10:11 PM
How about re-titling your Subject to something like, "How Do I Better Integrate Robot Eyes?".

Anyway, how did the other sensors get checked?· Maybe you need to check fewer times and/or use/execute fewer instructions (Tighten Up!)

Chris Savage
01-11-2006, 10:35 PM
Another thing to look at is your lack of a PAUSE 20 after the PULSOUT commands, which may be over-driving the servos, causing them to be jittery.· The PAUSE should only be decreased or removed if you have 20 mS or more of routines happening in your loop.

Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

01-12-2006, 12:46 AM
Sorry, yes I do have the Pause after the Pulsout. Thanks for all the suggestions..

Don "Ho"