Boe-bot wall detection problems (IR)
Hello!
My name is Johan and I'm new at this forum. I have worked with my boebot for many weeks now, but I have run in to a problem that i cannot solve. I'm using a sony remote to control the robots movements. But here comes the tricky part: I cant make it detect walls with the IR sensors when its driving. Is this possible? Im not very good at this and I was wondering if you could help me out here. I have attached the code. If you could modify it so it works the way i said i would be more than happy. Sorry for my english.
// Johan
My name is Johan and I'm new at this forum. I have worked with my boebot for many weeks now, but I have run in to a problem that i cannot solve. I'm using a sony remote to control the robots movements. But here comes the tricky part: I cant make it detect walls with the IR sensors when its driving. Is this possible? Im not very good at this and I was wondering if you could help me out here. I have attached the code. If you could modify it so it works the way i said i would be more than happy. Sorry for my english.
// Johan
Comments
FREQOUT IR_Pin, 38500
PULSIN IR_Decoder, CheckVal
Syntax -- but I don't see it anywhere in your code.
You know that the IR Receiver is working (from using it with a Remote Control), therefore, it is either because the IR Led's are not working (or installed incorrectly (backwards), or you code is not correct.· Check both of these.
·
I'm assuming that you already completed the experiments on the "Robotics with the Boe-Bot, Student Guide" (http://www.parallax.com/detail.asp?product_id=28154).
·
It seems that your code is not checking the IR sensors to detect obstacles, but just listening to the instructions you send with your remote control.
·
We have a brand new book that covers extensively the use of IR remote with the Boe-Bot.
·
Please take a look at this page and download the book "IR Remote for the Boe-Bot" (for free as usual).
http://www.parallax.com/detail.asp?product_id=28139
·
This book will guide you step by step, from just receiving signals from an IR remote control to advance programming as Autonomous Navigation with Remote Speed Control.
·
Regards,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aristides Alvarez
Education and Technical Support Manager
aalvarez@parallax.com
Parallax, Inc. www.parallax.com
// Johan
Please check the book I provided the link on my previous post.
All what you're asking for is covered there.
You don’t only need a sample of working code.
You also need to understand how each piece work by itself and how to integrate all pieces together in one single and complex program.
That's the only way to learn to write your own code and that's what we try to teach through our Stamps in Class program books.
Otherwise you'll always have to rely on code that someone else wrote.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aristides Alvarez
Education and Technical Support Manager
aalvarez@parallax.com
Parallax, Inc. www.parallax.com
I think I have a bare-metal approach.. Yet another robot, using the bs2, The TAB Robotics version of the Sumo-Bot,
has a program for solving a maze, by constantly taking a quick right to look for the wall, if detected, turn back, and go
foward a few steps, Else, keep turning right a little till wall detected, then follow, or, if something detected to left, turn left
till it's avoided..
It's still quirky, but try this little number I whipped up for the BOE, to mimmick the behaviour..
it does tend to SNAFU when it gets too close to a wall, but it does keep a 1-foot distance when
it does as it's supposed to.. If anyone can improve on it, be my guest! I'd like to see it work flawless!!
Just re-read original post.. It may also hitting a problem I noticed when using the BOE, and the TAB-Sumo..
The TAB Sumo's IR remote, sends a serial IR pulse, that tends to interfere with the BOE's ability to
track a wall by IR reflection, because it is getting the IR signals from (a) itself, (b) the remote.
Anyways, forgive me.. It won't allow uploading as an attachment, so... there goes the forum... here comes the code.
' Robotics with the Boe-Bot - MazeSolver.bs2
'Based roughly on the TAB Robotics version of the Sumo-Bot
'4th behaviour, Follow along the right wall, to solve a maze
'Assemble Boe-Bot as you would for Fast IR Roaming (pages
'237 - 239), for the IR LED's & IR Detectors
' By Stephen Griswold (gelfling6@hotmail.com)
' {$STAMP BS2}
' {$PBASIC 2.5}
forx VAR Word
counter VAR Word
irDetectLeft VAR Bit
irDetectRight VAR Bit
pulseLeft VAR Word
pulseRight VAR Word
DO
'first, detect if anything to the left
FREQOUT 8, 1, 38500 'send blip to left IR LED
irDetectLeft = IN9 'and detect with left IR detector
FREQOUT 2, 1, 38500 'send blip to right IR LED
irDetectRight = IN0 ' then detect on right IR detector
IF irDetectLeft = 0 THEN 'OBJECT LEFT, TURN LEFT A FEW TIMES.
pulseLeft = 650
pulseRight = 650
counter = 30
ELSEIF irDetectRight = 0 THEN 'Wall detected to right,
pulseLeft = 650 'only turn slightly left
pulseRight = 650
counter = 10
ELSEIF (irDetectLeft = 0 AND irDetectRight = 0) THEN 'Wall directly ahead
pulseLeft = 650 ' Turn around to avoid
pulseRight = 650
counter = 60
ELSEIF (irDetectLeft = 1 AND irDetectRight = 1) THEN 'no objects, but not detecting
pulseLeft = 850 ' wall. turn right slightly
pulseRight = 850
counter = 20
ENDIF
movement:
FOR forx = 1 TO counter
' Apply the pulse
PULSOUT 13,pulseLeft
PULSOUT 12,pulseRight
NEXT
' now move slightly forward
FOR forx = 1 TO 20
PULSOUT 13,850
PULSOUT 12,650
NEXT
LOOP
END
Post Edited (gelfling6) : 4/1/2005 12:38:30 AM GMT