in gym-compete/gym_compete/new_envs/agents/agent.py [0:0]
def set_action_space(self):
acts = self.xml.find('actuator')
self.action_dim = len(list(acts))
default = self.xml.find('default')
range_set = False
if default is not None:
motor = default.find('motor')
if motor is not None:
ctrl = motor.get('ctrlrange')
if ctrl:
clow, chigh = list(map(float, ctrl.split()))
high = chigh * np.ones(self.action_dim)
low = clow * np.ones(self.action_dim)
range_set = True
if not range_set:
high = np.inf * np.ones(self.action_dim)
low = - high
for i, motor in enumerate(list(acts)):
ctrl = motor.get('ctrlrange')
if ctrl:
clow, chigh = list(map(float, ctrl.split()))
high[i] = chigh
low[i] = clow
self._low = low
self._high = high
self.action_space = Box(low, high)