following boe-bot problem
sushiandmorihiko
Posts: 40
hello guys,i was trying this following boe-bot from boe-bot book from page 282 for later to be used in my pan and tilt project to detect my hand.
however right now i dont know if this is working well--it really did detect my hand or book,however i dont think it is that accurate---is there anyway i can make the sensors more accurate in reacting to its obstacle in front and why is my boe-bot backing up when she detects nothing-always---why is this so?
here is the codes that i used[noparse]:([/noparse]exactly like in the boe-bot book page 282).
DEBUG "Program Running!"
'
[noparse][[/noparse] Constants ]
Kpl CON -35
Kpr CON 35
SetPoint CON 2
CenterPulse CON 750
'
[noparse][[/noparse] Variables ]
freqSelect VAR Nib
irFrequency VAR Word
irDetectLeft VAR Bit
irDetectRight VAR Bit
distanceLeft VAR Nib
distanceRight VAR Nib
pulseLeft VAR Word
pulseRight VAR Word
'
[noparse][[/noparse] Initialization ]
FREQOUT 4, 2000, 3000
'
[noparse][[/noparse] Main Routine ]
DO
GOSUB Get_Ir_Distances
pulseLeft = SetPoint - distanceLeft * Kpl + CenterPulse
pulseRight = SetPoint - distanceRight * Kpr + CenterPulse
GOSUB Send_Pulse
LOOP
'
[noparse][[/noparse] Subroutine - Get IR Distances ]
Get_Ir_Distances:
distanceLeft = 0
distanceRight = 0
FOR freqSelect = 0 TO 4
LOOKUP freqSelect,[noparse][[/noparse]37500,38250,39500,40500,41500], irFrequency
FREQOUT 8,1,irFrequency
irDetectLeft = IN9
distanceLeft = distanceLeft + irDetectLeft
FREQOUT 1,1,irFrequency
irDetectRight = IN0
distanceRight = distanceRight + irDetectRight
NEXT
RETURN
'
[noparse][[/noparse] Subroutine – Get Pulse ]
Send_Pulse:
PULSOUT 14,pulseLeft
PULSOUT 15,pulseRight
PAUSE 5
RETURN
is there anyway i can modify these codes to make it more sensitive and react better?
thank you in advance
however right now i dont know if this is working well--it really did detect my hand or book,however i dont think it is that accurate---is there anyway i can make the sensors more accurate in reacting to its obstacle in front and why is my boe-bot backing up when she detects nothing-always---why is this so?
here is the codes that i used[noparse]:([/noparse]exactly like in the boe-bot book page 282).
DEBUG "Program Running!"
'
[noparse][[/noparse] Constants ]
Kpl CON -35
Kpr CON 35
SetPoint CON 2
CenterPulse CON 750
'
[noparse][[/noparse] Variables ]
freqSelect VAR Nib
irFrequency VAR Word
irDetectLeft VAR Bit
irDetectRight VAR Bit
distanceLeft VAR Nib
distanceRight VAR Nib
pulseLeft VAR Word
pulseRight VAR Word
'
[noparse][[/noparse] Initialization ]
FREQOUT 4, 2000, 3000
'
[noparse][[/noparse] Main Routine ]
DO
GOSUB Get_Ir_Distances
pulseLeft = SetPoint - distanceLeft * Kpl + CenterPulse
pulseRight = SetPoint - distanceRight * Kpr + CenterPulse
GOSUB Send_Pulse
LOOP
'
[noparse][[/noparse] Subroutine - Get IR Distances ]
Get_Ir_Distances:
distanceLeft = 0
distanceRight = 0
FOR freqSelect = 0 TO 4
LOOKUP freqSelect,[noparse][[/noparse]37500,38250,39500,40500,41500], irFrequency
FREQOUT 8,1,irFrequency
irDetectLeft = IN9
distanceLeft = distanceLeft + irDetectLeft
FREQOUT 1,1,irFrequency
irDetectRight = IN0
distanceRight = distanceRight + irDetectRight
NEXT
RETURN
'
[noparse][[/noparse] Subroutine – Get Pulse ]
Send_Pulse:
PULSOUT 14,pulseLeft
PULSOUT 15,pulseRight
PAUSE 5
RETURN
is there anyway i can modify these codes to make it more sensitive and react better?
thank you in advance
Comments
Andy Lindsay also has some additional material regarding IR detection and better PID control for things like IR following:
IR detection: http://forums.parallax.com/showthread.php?p=561496
Basic PID control: http://forums.parallax.com/showthread.php?p=529609
Excellent Boe-bot Dual PID discussion: http://forums.parallax.com/showthread.php?p=649354
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔