Tuesday, February 1, 2011

Exercise 1, Task 3

In this exercise, the robot has to move in a rectangle with the side lengths 1m and 0.3m.


The program has the following commands:


drive @v 0.3 :($drivendist > 0.5)
turnr 0.1 90 @v 0.3
drive @v 0.3 :($drivendist > 0.5)
turnr 0.1 90 @v 0.3
drive @v 0.3 :($drivendist > 0.5)
turnr 0.1 90 @v 0.3
drive @v 0.3 :($drivendist > 0.5)
turnr 0.1 90 @v 0.3
stop
The SMR will go straight, with the velocity 0.3. When the expression in the parenthesis is true, (the driven distance is greater than 0.5), the program will continue with the next line (the robot will not stop unless told so by the next command).

No comments:

Post a Comment