Robotic with Boe Bot
new_garbage
Posts: 8
i have the problem with " Boe-Bot shadow vechile" coding from "robotic with boe bot" book..
' {$STAMP BS2} ' Stamp directive.
' {$PBASIC 2.5} ' PBASIC directive.
'
[ Constants ]
Kpl CON -35
Kpr CON 35
SetPoint CON 1
CenterPulse CON 750
'
[ 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
'
[ Initialization ]
'
[ Main Routine ]
DO
GOSUB Get_Ir_Distances
' Calculate proportional output.
pulseLeft = SetPoint - distanceLeft * Kpl + CenterPulse
pulseRight = SetPoint - distanceRight * Kpr + CenterPulse
GOSUB Send_Pulse
LOOP
'
[ Subroutine - Get IR Distances ]
Get_Ir_Distances:
distanceLeft = 0
distanceRight = 0
FOR freqSelect = 0 TO 4
LOOKUP freqSelect,[37500,38250,39500,40500,41500], irFrequency
FREQOUT 14,1,irFrequency
irDetectLeft = IN15
distanceLeft = distanceLeft + irDetectLeft
FREQOUT 2,1,irFrequency
irDetectRight = IN0
distanceRight = distanceRight + irDetectRight
NEXT
RETURN
'
[ Subroutine - Get Pulse ]
Send_Pulse:
PULSOUT 12,pulseLeft
PULSOUT 13,pulseRight
RETURN
the problem that i faced is the boe bot can follow the object but the movement of the boe bot is not stable or smooth. when i placed the paper in front of boe bot, the robot able to follow the paper...foward, backward, left or right. that means it maintain the distance between boe bot and paper. when i stop the movement of paper, the boe bot able to stop but not stable..which is the bot cannot fix it their movement( move forward and backward)
i understand, the the sensor still calculating the range between it and the paper... that why the movement of boe bot not smooth. what must i do with the coding to smooth the movement of boe bot?
' {$STAMP BS2} ' Stamp directive.
' {$PBASIC 2.5} ' PBASIC directive.
'
[ Constants ]
Kpl CON -35
Kpr CON 35
SetPoint CON 1
CenterPulse CON 750
'
[ 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
'
[ Initialization ]
'
[ Main Routine ]
DO
GOSUB Get_Ir_Distances
' Calculate proportional output.
pulseLeft = SetPoint - distanceLeft * Kpl + CenterPulse
pulseRight = SetPoint - distanceRight * Kpr + CenterPulse
GOSUB Send_Pulse
LOOP
'
[ Subroutine - Get IR Distances ]
Get_Ir_Distances:
distanceLeft = 0
distanceRight = 0
FOR freqSelect = 0 TO 4
LOOKUP freqSelect,[37500,38250,39500,40500,41500], irFrequency
FREQOUT 14,1,irFrequency
irDetectLeft = IN15
distanceLeft = distanceLeft + irDetectLeft
FREQOUT 2,1,irFrequency
irDetectRight = IN0
distanceRight = distanceRight + irDetectRight
NEXT
RETURN
'
[ Subroutine - Get Pulse ]
Send_Pulse:
PULSOUT 12,pulseLeft
PULSOUT 13,pulseRight
RETURN
the problem that i faced is the boe bot can follow the object but the movement of the boe bot is not stable or smooth. when i placed the paper in front of boe bot, the robot able to follow the paper...foward, backward, left or right. that means it maintain the distance between boe bot and paper. when i stop the movement of paper, the boe bot able to stop but not stable..which is the bot cannot fix it their movement( move forward and backward)
i understand, the the sensor still calculating the range between it and the paper... that why the movement of boe bot not smooth. what must i do with the coding to smooth the movement of boe bot?
Comments
Obviously a well tuned PID controller would be idea, but that's probably for a more advanced user. But any other suggestions would be helpful.