X-Git-Url: https://git.llucax.com/z.facultad/75.68/celdas.git/blobdiff_plain/f3c411b92e7877dbbad3a3af2a1399f47a6d7977..556e0d28d297b2abb2fcee9f8470cb69e3061137:/trunk/src/breve/Celdas.tz?ds=sidebyside diff --git a/trunk/src/breve/Celdas.tz b/trunk/src/breve/Celdas.tz index 79b2cc8..b9a63fb 100644 --- a/trunk/src/breve/Celdas.tz +++ b/trunk/src/breve/Celdas.tz @@ -4,8 +4,6 @@ @use Link. @use MultiBody. -@define CELDAS_MAX_VELOCITY 30. - PhysicalControl : CeldasControl { % This class is used for building simple vehicle % simulations. To create a vehicle simulation, @@ -188,10 +186,6 @@ Link : CeldasWheel (aka CeldasWheels) { + variables: joint (object). - velocity (float). - - + to init: - velocity = 0. - to set-joint to j (object): % Used internally. @@ -203,15 +197,12 @@ Link : CeldasWheel (aka CeldasWheels) { + to set-velocity to n (float): % Sets the velocity of this wheel. - if n > CELDAS_MAX_VELOCITY: n = CELDAS_MAX_VELOCITY. - velocity = n. - - joint set-joint-velocity to velocity. + joint set-joint-velocity to n. + to get-velocity: % Gets the velocity of this wheel. - return velocity. + return (joint get-joint-velocity). } @@ -265,9 +256,7 @@ Link : CeldasSensor (aka CeldasSensors) { if angle < sensorAngle: { strength = | (self get-location) - (i get-location) |. - strength = 1.0 / (strength * strength) . - - if strength > 10: strength = 10. + strength = 100.0 / (strength * strength) . if strength > value: value = strength. }