Shop OBEX P1 Docs P2 Docs Learn Events
Robotic with Boe Bot — Parallax Forums

Robotic with Boe Bot

new_garbagenew_garbage Posts: 8
edited 2011-03-30 18:07 in Robotics
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?

Comments

  • new_garbagenew_garbage Posts: 8
    edited 2011-03-30 05:13
    i already change the value of kpl and kpr getting bigest or smallest.....it just effect the responsive of boe bot when following the object. the problem is i don't know how to make the react of boe bot smoothly.
  • new_garbagenew_garbage Posts: 8
    edited 2011-03-30 05:18
    i know when i enhance the proportional algorithm to a Proportional Integral Derivative (PID) , it can smoother the movement of boe bot. the problem is it is harder to code than a proportional one. i hope, someone can help me especially someone who have the experience with boe bot
  • Martin_HMartin_H Posts: 4,051
    edited 2011-03-30 18:07
    Note: The author PM-ed me as I helped with an issue using a line sensor previously. I don't own a BOE bot and haven't done a lab where boe bot follows another one. But I suggested adding a little hysteresis to the servo pulse loop so it is slower to respond to see if that smoothed things out a bit.

    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.
Sign In or Register to comment.