Skip to content

Commit

Permalink
trainable
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas committed Apr 2, 2024
1 parent f8e1655 commit be44161
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ train-many-vis:
@python -m sim.humanoid_gym.train --task humanoid_ppo --run_name v1 --num_envs 16

train:
@python -m sim.humanoid_gym.train --task humanoid_ppo --run_name v1 --num_envs 2048 --headless
@python -m sim.humanoid_gym.train --task humanoid_ppo --run_name v1 --num_envs 6144 --headless

play:
@python -m sim.humanoid_gym.play --task humanoid_ppo --run_name v1
Expand Down
22 changes: 10 additions & 12 deletions sim/humanoid_gym/envs/humanoid_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,20 @@ class init_state(LeggedRobotCfg.init_state): # noqa: N801

class sim(LeggedRobotCfg.sim): # noqa: N801
dt = 0.005
substeps = 1
substeps = 2

class physx(LeggedRobotCfg.sim.physx): # noqa: N801
num_threads = 10
solver_type = 1
num_position_iterations = 4
num_velocity_iterations = 1
contact_offset = -0.01
# contact_offset = -0.01
# rest_offset = -0.015
contact_offset = 0.01
rest_offset = -0.015
bounce_threshold_velocity = 0.5
max_depenetration_velocity = 10.0
max_gpu_contact_pairs = 2**23
max_depenetration_velocity = 1.0
max_gpu_contact_pairs = 2**24
default_buffer_size_multiplier = 5
contact_collection = 2 # gymapi.CC_ALL_SUBSTEPS

Expand Down Expand Up @@ -157,14 +159,10 @@ class scales: # noqa: N801
base_acc = 0.0

# Energy
# torques = -1e-6
# dof_vel = -5e-5
# dof_acc = -1e-8
# collision = -1e-2
torques = 0.0
dof_vel = 0.0
dof_acc = 0.0
collision = 0.0
torques = -1e-6
dof_vel = -5e-5
dof_acc = -1e-8
collision = -1e-2

class normalization: # noqa: N801
class obs_scales: # noqa: N801
Expand Down
3 changes: 2 additions & 1 deletion sim/humanoid_gym/envs/humanoid_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ def reset_idx(self, env_ids: Tensor) -> None:
def _compute_torques(self, actions: Tensor) -> Tensor:
# Need to override this so we can just use the motor torques directly.
# return torch.clip(actions * self.cfg.control.action_scale, -self.torque_limits, self.torque_limits)
return torch.tanh(actions * self.cfg.control.action_scale) * self.torque_limits
torques = torch.tanh(actions * self.cfg.control.action_scale) * self.torque_limits
return torques

def check_termination(self) -> None:
self.reset_buf = self.episode_length_buf > self.max_episode_length
Expand Down

0 comments on commit be44161

Please sign in to comment.