Follow the BoeBot
So my Son and I where trying to get the Follow the Boe Bot program to work on his little boe.(pg 282 Robotics w/ BOE bot).· We have the crawler legs installed on the BOE and he just turns slowly to the right. Any ideas what we missed and how to make his movement smoother (He spins very Jerky to the right)? Oh one more thing we just installed fresh batteries. Here is the code we copied from the book:
·' =========================================================================
'
'·· File....... fol_the_lead
'·· Purpose.... Follow the leader
'·· Author..... Parallax· pg 282
'·· E-mail.....
'·· Started....
'·· Updated....
'
'·· {$STAMP BS2}
'·· {$PBASIC 2.5}
'
' =========================================================================
'
[noparse][[/noparse] Program Description ]
'
[noparse][[/noparse] Revision History ]
'
[noparse][[/noparse] I/O Definitions ]
'
[noparse][[/noparse] Constants ]
Kpl··············· CON····· -35·· 'edited to correct value
Kpr··············· CON····· 35···
SetPoint·········· CON····· 2· 'edited to correct value
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] Program Code ]
DO
· GOSUB Get_Ir_Distances
· 'calculate proportional output
· pulseLeft· =·· SetPoint -distanceLeft * Kpl + CenterPulse
· pulseRight· =·· SetPoint -distanceLeft * Kpl + CenterPulse
· GOSUB Send_Pulse
LOOP
'
[noparse][[/noparse] Subroutines ]
'
Get IR Distance
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 2,1,irFrequency
··· irDetectRight = IN0
··· distanceRight=distanceRight + irDetectRight
· NEXT
· RETURN
'
Get Pulse
Send_Pulse:
· PULSOUT 13,pulseLeft
· PULSOUT 12,pulseRight
· PAUSE 5
· RETURN
Thanks,
Ray
Post Edited (Ray Iddings) : 3/18/2005 12:42:55 PM GMT
·' =========================================================================
'
'·· File....... fol_the_lead
'·· Purpose.... Follow the leader
'·· Author..... Parallax· pg 282
'·· E-mail.....
'·· Started....
'·· Updated....
'
'·· {$STAMP BS2}
'·· {$PBASIC 2.5}
'
' =========================================================================
'
[noparse][[/noparse] Program Description ]
'
[noparse][[/noparse] Revision History ]
'
[noparse][[/noparse] I/O Definitions ]
'
[noparse][[/noparse] Constants ]
Kpl··············· CON····· -35·· 'edited to correct value
Kpr··············· CON····· 35···
SetPoint·········· CON····· 2· 'edited to correct value
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] Program Code ]
DO
· GOSUB Get_Ir_Distances
· 'calculate proportional output
· pulseLeft· =·· SetPoint -distanceLeft * Kpl + CenterPulse
· pulseRight· =·· SetPoint -distanceLeft * Kpl + CenterPulse
· GOSUB Send_Pulse
LOOP
'
[noparse][[/noparse] Subroutines ]
'
Get IR Distance
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 2,1,irFrequency
··· irDetectRight = IN0
··· distanceRight=distanceRight + irDetectRight
· NEXT
· RETURN
'
Get Pulse
Send_Pulse:
· PULSOUT 13,pulseLeft
· PULSOUT 12,pulseRight
· PAUSE 5
· RETURN
Thanks,
Ray
Post Edited (Ray Iddings) : 3/18/2005 12:42:55 PM GMT
Comments
The following differences are noted between your provided program and that found in the Parallax manual indicated. Whether these represent typos or are elements that you chose to change for some reason, is unknown to me. Mine was just a line by line comparison of the two programs:
As Shown Should Be Parallax Manual
Kpl CON -15
> Kpl CON -35
Setpoint CON 3
> Setpoint CON 2
Regards,
Bruce Bates
Set Point, It says to try 2 or 3, I tried both.
Still Very Jerky Robot movement and still turns to the right only.
Thanks
Ray
Post Edited (Ray Iddings) : 3/18/2005 12:43:51 PM GMT
Before I installed the Shadow the Boe-Bot program Our Circut on the BOE-bot is exactly like the circut on page 239 Fig 7-5 BOE diagramn. We know that the configuration works because we preformed the TestLeftIrPair.bs2 and TestRightIr.bs2. Then from page 252 FastIrRoaming.bs2 our little BOE preformed flawlessly. Now when loading the program from page 282 I get nothing but a bot that turns very jerky to the right. I tryed readjusting the headlights to make sure the are oriented properly, I added fresh batteries because we have been using the bot alot, I check to make sure all the connections where good, screws tight etc. ReLoaded and Ran the FastIrRoaming program again, which worked perfectly again. Reloaded the shadowBot.bs2 again and still get the jerky, move to the right.
The only hardware diffrence is that we do have the crawler legs installed but I don't believe this would account for the right only turning motion. Anyone?
Thanks
Ray
' pulseRight = SetPoint -distanceLeft * Kpl + CenterPulse'<<<<<< Should be Kpr and distanceRight!
I had the same problem.
bugg
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
But I canna change the laws of physics, Captain!
I see I made that mistake AND
pulseRight = SetPoint -distanceLeft * Kpl + CenterPulse
Should Read:
pulseRight = SetPoint - distanceRight * Kpr + CenterPulse
Now it works and I am having a slap the forhead "DUH" Moment
Thanks,
Works fine now.
Ray
bugg
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
But I canna change the laws of physics, Captain!