Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ZhengyiLuo/PerpetualHumanoidControl
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhengyiLuo committed Jan 2, 2025
2 parents 08b0016 + 562b90f commit f53bac0
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion phc/data/cfg/sim/default_sim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use_flex: False

substeps: 2
physx:
sim_time_step: 1/60
step_dt: 1/60
num_threads: 4
solver_type: 1 # 0: pgs, 1: tgs
num_position_iterations: 4
Expand Down
2 changes: 1 addition & 1 deletion phc/data/cfg/sim/robot_sim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ slices: 0 # Number of client threads that process env slices
use_flex: False

physx:
sim_time_step: 1/200
step_dt: 1/200
num_threads: 4
solver_type: 1 # 0: pgs, 1: tgs
num_position_iterations: 4
Expand Down
2 changes: 2 additions & 0 deletions phc/env/tasks/humanoid_amp.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ def _load_motion(self, motion_train_file, motion_test_file=[]):
"randomrize_heading": True,
"device": self.device,
"min_length": self._min_motion_len,
"step_dt": self.dt,
})
self._motion_lib = MotionLibSMPL(motion_lib_cfg=motion_lib_cfg)
self._motion_lib.load_motions(skeleton_trees=self.skeleton_trees, gender_betas=self.humanoid_shapes.cpu(), limb_weights=self.humanoid_limb_and_weights.cpu(), random_sample=not HACK_MOTION_SYNC)
Expand All @@ -359,6 +360,7 @@ def _load_motion(self, motion_train_file, motion_test_file=[]):
"randomrize_heading": True,
"device": self.device,
"robot": self.cfg.robot,
"step_dt": self.dt,
})
motion_eval_file = motion_train_file
self._motion_train_lib = MotionLibReal(motion_lib_cfg)
Expand Down
2 changes: 2 additions & 0 deletions phc/env/tasks/humanoid_im.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ def _load_motion(self, motion_train_file, motion_test_file=[]):
"smpl_type": self.humanoid_type,
"randomrize_heading": True,
"device": self.device,
"step_dt": self.dt,
})
motion_eval_file = motion_train_file
self._motion_train_lib = MotionLibSMPL(motion_lib_cfg)
Expand All @@ -351,6 +352,7 @@ def _load_motion(self, motion_train_file, motion_test_file=[]):
"randomrize_heading": True,
"device": self.device,
"robot": self.cfg.robot,
"step_dt": self.dt,
})
motion_eval_file = motion_train_file
self._motion_train_lib = MotionLibReal(motion_lib_cfg)
Expand Down
2 changes: 1 addition & 1 deletion phc/run_hydra.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
def parse_sim_params(cfg):
# initialize sim
sim_params = gymapi.SimParams()
sim_params.dt = eval(cfg.sim.physx.sim_time_step)
sim_params.dt = eval(cfg.sim.physx.step_dt)
sim_params.num_client_threads = cfg.sim.slices

if cfg.sim.use_flex:
Expand Down
2 changes: 1 addition & 1 deletion phc/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def load_cfg(args):
def parse_sim_params(args, cfg, cfg_train):
# initialize sim
sim_params = gymapi.SimParams()
sim_params.dt = eval(cfg.sim.physx.sim_time_step)
sim_params.dt = eval(cfg.sim.physx.step_dt)
sim_params.num_client_threads = args.slices

if args.physics_engine == gymapi.SIM_FLEX:
Expand Down
6 changes: 4 additions & 2 deletions phc/utils/motion_lib_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class MotionLibBase():

def __init__(self, motion_lib_cfg):
self.m_cfg = motion_lib_cfg
self._sim_fps = 1/self.m_cfg.get("step_dt", 1/30)
print("SIM FPS:", self._sim_fps)
self._device = self.m_cfg.device

self.mesh_parsers = None
Expand Down Expand Up @@ -428,9 +430,9 @@ def get_motion_length(self, motion_ids=None):

def get_motion_num_steps(self, motion_ids=None):
if motion_ids is None:
return (self._motion_num_frames * 30 / self._motion_fps).int()
return (self._motion_num_frames * self._sim_fps / self._motion_fps).ceil().int()
else:
return (self._motion_num_frames[motion_ids] * 30 / self._motion_fps).int()
return (self._motion_num_frames[motion_ids] * self._sim_fps / self._motion_fps).ceil().int()

def get_motion_state(self, motion_ids, motion_times, offset=None):
n = len(motion_ids)
Expand Down

0 comments on commit f53bac0

Please sign in to comment.