in env_humanoid_tracking.py [0:0]
def __init__(self,
fps_sim,
fps_act,
char_info_module,
sim_char_file,
ref_motion_scale,
actuation,
self_collision=None,
contactable_body=None,
verbose=False,
):
self._num_agent = len(sim_char_file)
assert self._num_agent > 0
assert self._num_agent == len(char_info_module)
assert self._num_agent == len(ref_motion_scale)
self._char_info = []
for i in range(self._num_agent):
''' Load Character Info Moudle '''
spec = importlib.util.spec_from_file_location(
"char_info%d"%(i), char_info_module[i])
char_info = importlib.util.module_from_spec(spec)
spec.loader.exec_module(char_info)
self._char_info.append(char_info)
''' Modfiy Contactable Body Parts '''
if contactable_body:
contact_allow_all = True if 'all' in contactable_body else False
for joint in list(char_info.contact_allow_map.keys()):
char_info.contact_allow_map[joint] = \
contact_allow_all or char_info.joint_name[joint] in contactable_body
self._v_up = self._char_info[0].v_up_env
''' Define PyBullet Client '''
self._pb_client = bullet_client.BulletClient(
connection_mode=pb.DIRECT, options=' --opengl2')
self._pb_client.setAdditionalSearchPath(pybullet_data.getDataPath())
''' timestep for physics simulation '''
self._dt_sim = 1.0/fps_sim
''' timestep for control of dynamic controller '''
self._dt_act = 1.0/fps_act
if fps_sim%fps_act != 0:
raise Exception('FPS_SIM should be a multiples of FPS_ACT')
self._num_substep = fps_sim//fps_act
self._verbose = verbose
self.setup_physics_scene(sim_char_file,
self._char_info,
ref_motion_scale,
self_collision,
actuation)
''' Elapsed time after the environment starts '''
self._elapsed_time = 0.0
''' For tracking the length of current episode '''
self._episode_len = 0.0
''' Create a Manager for Handling Obstacles '''
self._obs_manager = sim_obstacle.ObstacleManager(
self._pb_client, self._dt_act, self._char_info[0].v_up_env)
''' Save the initial pybullet state to clear all thing before calling reset '''
self._init_state = None
self.reset()
self._init_state = self._pb_client.saveState()