]> git.llucax.com Git - z.facultad/75.68/celdas.git/blobdiff - trunk/src/breve/Demo.tz
(no commit message)
[z.facultad/75.68/celdas.git] / trunk / src / breve / Demo.tz
index 8b9a3e50c069537d2b80d9c9932128fd9ffbc23c..7794c3de2917e71bb161c62596df8b0593afd51e 100644 (file)
@@ -20,8 +20,9 @@ CeldasControl : DemoController {
 
                vehicle move to (10, 2, 5).
 
-               leftWheel = (vehicle add-wheel at (-.5, 0, -1.5)).
-               rightWheel = (vehicle add-wheel at (-.5, 0, 1.5)).
+               leftWheel = (vehicle add-wheel at (-2, 0, -1.5)).
+               rightWheel = (vehicle add-wheel at (-2, 0, 1.5)).
+               vehicle add-wheel at (1, 0, 0).
 
                leftWheel set-velocity to 15.0.
                rightWheel set-velocity to 15.0.
@@ -33,14 +34,12 @@ CeldasControl : DemoController {
                        
                value = sensor get-sensor-value.
 
-               if value < 5: {
-                       leftWheel set-velocity to ((leftWheel get-velocity) + 5).
-                       rightWheel set-velocity to ((rightWheel get-velocity) + 5).
-               }
-
-               if value > 5: {
-                       leftWheel set-velocity to ((leftWheel get-velocity) - 5).
-                       rightWheel set-velocity to ((rightWheel get-velocity) - 5).
+               if value < 1: {
+                       leftWheel set-velocity to ((leftWheel get-velocity) + 15).
+                       rightWheel set-velocity to ((rightWheel get-velocity) + 15).
+               } else if value > 10: {
+                       leftWheel set-velocity to ((leftWheel get-velocity) - 15).
+                       rightWheel set-velocity to ((rightWheel get-velocity) - 15).
                }
 
                print value.