@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,
+ variables:
joint (object).
- velocity (float).
-
- + to init:
- velocity = 0.
- to set-joint to j (object):
% Used internally.
+ 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).
}
% if not, the sensor reading correspond to the previous
% iteration.
+ return value.
+
+ to iterate:
i (object).
strength, angle (float).
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.
}