Tuesday, February 1, 2011

Exercise 1, Task 4

"Make a program  that  makes   the  robot   run 0.75m  forward and  the  run  in a  square with  round
corners. The side lengths should be 0.3m and the turning radius should be 0.3 m."

 The code for task 4 is:
drive @v 0.3 :($drivendist > 0.75)
drive @v 0.3 :($drivendist > 0.3)
turnr 0.3 90 @v 0.3
drive @v 0.3 :($drivendist > 0.3)
turnr 0.3 90 @v 0.3
drive @v 0.3 :($drivendist > 0.3)
turnr 0.3 90 @v 0.3
drive @v 0.3 :($drivendist > 0.3)
turnr 0.3 90 @v 0.3
stop

And here is the movie of the robot:

No comments:

Post a Comment