X-Git-Url: https://git.llucax.com/z.facultad/75.68/celdas.git/blobdiff_plain/d605ed0d8da75888ee78a87cd817d5227668867a..c9cb3e583513966985082cae8b556411ab5f4eb5:/trunk/src/breve/Demo.tz?ds=sidebyside diff --git a/trunk/src/breve/Demo.tz b/trunk/src/breve/Demo.tz index 8b9a3e5..7794c3d 100644 --- a/trunk/src/breve/Demo.tz +++ b/trunk/src/breve/Demo.tz @@ -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.