Shop OBEX P1 Docs P2 Docs Learn Events
Boe-bot shortest route — Parallax Forums

Boe-bot shortest route

kingbpkingbp Posts: 22
edited 2011-04-05 18:43 in Robotics
Hello I have a project with the Boe-bot where i want to make it drive through an entire line following maze with dead ends and continue until it reaches the end of the maze on the first run. Then It will make a 2nd run this time memorizing the entire maze and taking the shortest route to the end of the maze avoiding dead ends. I am using parallax's infrared line follower kit. Can any of you guys help me with the p-basic coding. I'm new to basic coding and am having trouble with this. Thanks
here is my code so far, for now it just followers the maze.

' {$STAMP BS2}
' {$PBASIC 2.5}

DO
SELECT INL ' Select line follower states
CASE %11000000, %11100000 ' Pivot right
PULSOUT 13, 650
PULSOUT 12, 650
CASE %01100000, %01110000 ' Curve right
PULSOUT 13, 700
PULSOUT 12, 650
CASE %00110000 ' Slight right
PULSOUT 13, 750
PULSOUT 12, 650
CASE %00111000 ' Adjust right
PULSOUT 13, 800
PULSOUT 12, 650
CASE %00011000 ' Straight
PULSOUT 13, 850
PULSOUT 12, 650
CASE %00011100 ' Adjust left
PULSOUT 13, 850
PULSOUT 12, 700
CASE %00001100 ' Slight left
PULSOUT 13, 850
PULSOUT 12, 750
CASE %00000110, %00001110 ' Curve left
PULSOUT 13, 850
PULSOUT 12, 800
CASE %00000011, %00000111 ' Pivot left
PULSOUT 13, 850
PULSOUT 12, 850
ENDSELECT
LOOP

Comments

  • Martin_HMartin_H Posts: 4,051
    edited 2011-04-05 18:43
    In the first thread you started I posted some links which can help you solve this problem. The code above just follows the line, to solve it you'll need to track the previous line values to determine if you are at a junction, left, or right turn.
Sign In or Register to comment.