Skip to content

Commit 33321c6

Browse files
authored
Merge pull request #35 from vakker/actuator-minmax
Actuator min/max added
2 parents e5c817f + dcf1786 commit 33321c6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

simple_playgrounds/agents/parts/actuators.py

+26
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ def _check_value(self, value):
4747
def apply_action(self, value):
4848
pass
4949

50+
@abstractmethod
51+
def min(self):
52+
pass
53+
54+
@abstractmethod
55+
def max(self):
56+
pass
57+
5058

5159
class InteractionActuator(Actuator, ABC):
5260

@@ -55,6 +63,14 @@ class InteractionActuator(Actuator, ABC):
5563
def _check_value(self, value):
5664
assert value in [0, 1]
5765

66+
@property
67+
def min(self):
68+
return 0
69+
70+
@property
71+
def max(self):
72+
return 1
73+
5874

5975
class Activate(InteractionActuator):
6076

@@ -106,6 +122,16 @@ def _check_value(self, value):
106122
else:
107123
assert 0 <= value <= 1
108124

125+
@property
126+
def min(self):
127+
if self.centered:
128+
return -1
129+
return 0
130+
131+
@property
132+
def max(self):
133+
return 1
134+
109135

110136
class LongitudinalForce(PhysicalActuator):
111137

0 commit comments

Comments
 (0)