FastIrRoaming
I recently bought the parallax IR emitter/led pair and was trying the FastIrRoaming program on pg 252-253 of the boe bot manual and it seems to be working funny. When both pair sense an object it seems to reverse in a jerking fashion. When I place my hand right in front of both senors it backs up okay. However when I place my hand in front of both sensors from further away my robot starts jerking. The right and left sensor seem to work okay independently from each other. Initially I tried RoamingWithIr.bs2 and it worked perfect. I am not using parallax servo motors. But I dont thinks its the servos because when I disconnected the
servos and just monitored the leds( pin 4 and pin 5) it seems
that when it first detects an object these leds are flickering, which I
think is causing the problem.I tried to experiment with the pulseleft and pulseright values but it had no effect. Is the basic stamp trying to read the sensors to quickly.
Any help would be appreciated.
' Robotics with the Boe-Bot - FastIrRoaming.bs2
' Higher performance IR object detection assisted navigation
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
irDetectLeft VAR Bit ' Variable Declarations
irDetectRight VAR Bit
pulseLeft VAR Word
pulseRight VAR Word
FREQOUT 4, 2000, 3000 ' Signal program start/reset.
DO ' Main Routine
FREQOUT 3, 1, 38500 ' Check IR Detectors
irDetectLeft = IN2
FREQOUT 1, 1, 38500
irDetectRight = IN0
' Decide how to navigate.
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
HIGH 4
HIGH 5
pulseLeft = 650
pulseRight = 850
ELSEIF (irDetectLeft = 0) THEN
HIGH 5
pulseLeft = 850
pulseRight = 850
ELSEIF (irDetectRight = 0) THEN
HIGH 4
pulseLeft = 650
pulseRight = 650
ELSE
LOW 4
LOW 5
pulseLeft = 850
pulseRight = 650
ENDIF
PULSOUT 15,pulseLeft ' Apply the pulse.
PULSOUT 14,pulseRight
PAUSE 15
LOOP
Post Edited (ltmhall) : 1/19/2007 1:51:03 AM GMT
servos and just monitored the leds( pin 4 and pin 5) it seems
that when it first detects an object these leds are flickering, which I
think is causing the problem.I tried to experiment with the pulseleft and pulseright values but it had no effect. Is the basic stamp trying to read the sensors to quickly.
Any help would be appreciated.
' Robotics with the Boe-Bot - FastIrRoaming.bs2
' Higher performance IR object detection assisted navigation
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
irDetectLeft VAR Bit ' Variable Declarations
irDetectRight VAR Bit
pulseLeft VAR Word
pulseRight VAR Word
FREQOUT 4, 2000, 3000 ' Signal program start/reset.
DO ' Main Routine
FREQOUT 3, 1, 38500 ' Check IR Detectors
irDetectLeft = IN2
FREQOUT 1, 1, 38500
irDetectRight = IN0
' Decide how to navigate.
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
HIGH 4
HIGH 5
pulseLeft = 650
pulseRight = 850
ELSEIF (irDetectLeft = 0) THEN
HIGH 5
pulseLeft = 850
pulseRight = 850
ELSEIF (irDetectRight = 0) THEN
HIGH 4
pulseLeft = 650
pulseRight = 650
ELSE
LOW 4
LOW 5
pulseLeft = 850
pulseRight = 650
ENDIF
PULSOUT 15,pulseLeft ' Apply the pulse.
PULSOUT 14,pulseRight
PAUSE 15
LOOP
Post Edited (ltmhall) : 1/19/2007 1:51:03 AM GMT
Comments
2.· Servos need to receive a pulse signal every 20ms ... It looks like you are not allowing enough time delay between sending out your pulses...
PULSOUT 15,pulseLeft
PULSOUT 14,pulseRight
PAUSE 20
··· place my hand right in front of it it works. However when I placed my hand in front
··· right when it starts to sense, my led's kind of flicker, this is even when I disconnect the servos
2. I tried
·· PULSOUT 15,pulseLeft
·· PULSOUT 14,pulseRight
·· PAUSE 20
·· and it didn't work.
··
Post Edited (ltmhall) : 1/19/2007 1:17:27 PM GMT
Your servos should be connected to pins 12 and 13
Your IR LED's should be connected to Pins 8 and 2
Your IR Detectors should be connected to Pins 9 and 0
Your speaker should be connected to Pin 4
Try to copy and paste this code...
' Robotics with the Boe-Bot - FastIrRoaming.bs2
' Higher performance IR object detection assisted navigation
' {$STAMP BS2}
' {$PBASIC 2.5}
·
DEBUG "Program Running!"
irDetectLeft VAR Bit ' Variable Declarations
irDetectRight VAR Bit
pulseLeft VAR Word
pulseRight VAR Word
FREQOUT 4, 2000, 3000 ' Signal program start/reset.
DO ' Main Routine
FREQOUT 8, 1, 38500 ' Check IR Detectors
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight = IN0
' Decide how to navigate.
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
pulseLeft = 650
pulseRight = 850
ELSEIF (irDetectLeft = 0) THEN
pulseLeft = 850
pulseRight = 850
ELSEIF (irDetectRight = 0) THEN
pulseLeft = 650
pulseRight = 650
ELSE
pulseLeft = 850
pulseRight = 650
ENDIF
PULSOUT 13,pulseLeft ' Apply the pulse.
PULSOUT 12,pulseRight
PAUSE 15
LOOP ' Repeat main routine
I don't this will cause a problem, but I will remove them and connect everything like you said.
and I removed the HIGH and LOW commands, but it still reacts the
same way.
DOES ANYONE ELSE HAVE ANY SUGGESTIONS ?
Thanks for any suggestions
As a bot approaches an obstacle, the IR sensor begins to get some return signal, the voltage on the output is more than zero, but less than the threshold. So no detection. As the bot gets closer the return signal grows just strong enough for the sensor to output the threshold voltage. If there is any noise in the system (electrical or optical) the signal will bounce back and forth across the threshold. So you get flicker.
The program works with your hand because you stick your hand closer to the sensor so the signal is well above the threshold. It would actually be very hard to hold your hand at the exactly right position to get flicker.
The robot is good at finding the flicker band because it moves slowly and precisely from out-of-range to within-range.
I have not solved the problem yet. I am thinking about a scheme that uses two frequencies for the IR lamp (like is done for distance measuring p271). When the bot gets it first flicker on the less sensitive frequency, then check the output at the higher sensitivity frequency and use that signal, should be cleaner.
I'd like to hear if you find another solution.
i had the same problem and i thought it was like button bounce or the detecters where saying turn left ,turn right and back and forth ,,,try this program i hacked up u can play with the # so it can wedge in tight places its meant for 3ir,s and a motor controller but should work on ur servos and its got ramping and min\max speed control have fun
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Problems are the "roads" of life,
solutions are only "onramps" to the next problem
············································· "Brad Smith"
·