Tuesday, February 8, 2011
Exercise 1, Task 10
The following code was used:
fwd 0.3
followline "bl" :($irdistleft < 0.2)|($irdistright < 0.2)|($drivendist > 1)
switch($condition)
case 1
followline "bl" :($drivendist > 0.5)
case 2
followline "br" :($drivendist > 0.5)
case 3
turn 180
followline "br" :($drivendist > 1)
endswitch
stop
The robot follows a line until it sees an obstacle on the left or on the right side and then goes on the left side or the right side of the line. If it moves forward 1m and doesn't find any object it will turn 180 degrees and go back the same distance.
Labels:
exercise 1
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment