Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions robohive/robot/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,13 +555,12 @@ def remap_space(self, input_vec, input_type:str, input_space:str, output_space:s


# Normalize actions from absolute space to unit space
def normalize_actions(self, controls, out_space='sim', unnormalize=False):
def normalize_actions(self, controls, unnormalize=False):
"""
Normalize actions from absolute space to unit space
Recover actions from unit space to absolute space; if unnormalize==True
in_space for controls has to be 'sim'
"""
act_id = -1
controls_out = controls.copy()
for name, device in self.robot_config.items():
if name == "default_robot":
Expand All @@ -573,10 +572,8 @@ def normalize_actions(self, controls, out_space='sim', unnormalize=False):
raise TypeError("only pos act supported")
else:
for actuator in device['actuator']:
act_id += 1
in_id = actuator['sim_id']
# output ordering is as per the config order for hdr
out_id = actuator['sim_id'] if out_space == 'sim' else act_id
out_id = actuator['sim_id']

if self._act_mode == "pos":
act_mid = (actuator['pos_range'][1]+actuator['pos_range'][0])/2.0
Expand Down Expand Up @@ -606,15 +603,14 @@ def process_actuator(self, controls, step_duration,
normalized=True,
position_limits=True,
velocity_limits=True,
out_space='sim'):
out_space='sim'): # out_space kept for API compatibility; output is always sim_id-indexed
"""
Process the actuation demands to
(1) Remap provided controls to actuation space,
(2) Enforces hardware position and velocity limits on the controls
"""
# last_obs = self.get_sensor_from_cache(-1)
processed_controls = controls.copy()
act_id = -1
for name, device in self.robot_config.items():
if name == "default_robot":
if self._act_mode == "pos":
Expand All @@ -625,10 +621,8 @@ def process_actuator(self, controls, step_duration,
raise TypeError("only pos act supported")
else:
for actuator in device['actuator']:
act_id += 1
in_id = actuator['sim_id']
# output ordering is as per the config order for hdr
out_id = actuator['sim_id'] if out_space == 'sim' else act_id
out_id = actuator['sim_id']

control = controls[in_id]
if self._act_mode == "pos":
Expand Down
Loading