Skip to content

Commit

Permalink
add standing config
Browse files Browse the repository at this point in the history
  • Loading branch information
alik-git committed Jan 4, 2025
1 parent 03e16c6 commit 396e435
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sim/envs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from sim.envs.humanoids.h1_env import H1FreeEnv
from sim.envs.humanoids.xbot_config import XBotCfg, XBotCfgPPO
from sim.envs.humanoids.xbot_env import XBotLFreeEnv
from sim.envs.humanoids.zbot2_config import ZBot2Cfg, ZBot2CfgPPO
from sim.envs.humanoids.zbot2_config import ZBot2Cfg, ZBot2CfgPPO, ZBot2StandingCfg
from sim.envs.humanoids.zbot2_env import ZBot2Env
from sim.envs.humanoids.zeroth_config import ZerothCfg, ZerothCfgPPO
from sim.envs.humanoids.zeroth_env import ZerothEnv
Expand All @@ -32,4 +32,5 @@
task_registry.register("g1", G1FreeEnv, G1Cfg(), G1CfgPPO())
task_registry.register("XBotL_free", XBotLFreeEnv, XBotCfg(), XBotCfgPPO())
task_registry.register("zbot2", ZBot2Env, ZBot2Cfg(), ZBot2CfgPPO())
task_registry.register("zbot2_standing", ZBot2Env, ZBot2StandingCfg(), ZBot2CfgPPO())
task_registry.register("zeroth", ZerothEnv, ZerothCfg(), ZerothCfgPPO())
42 changes: 41 additions & 1 deletion sim/envs/humanoids/zbot2_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class asset(LeggedRobotCfg.asset):
foot_name = ["FOOT", "FOOT_1"]
knee_name = ["WJ-DP00-0002-FK-AP-020_7_8", "SJ-WK00-0023BOTTOMCASE_12_13"]

termination_height = 0.05
termination_height = 0.1
default_feet_height = 0.01

penalize_contacts_on = []
Expand Down Expand Up @@ -205,6 +205,46 @@ class viewer:
lookat = [0, -2, 0]


class ZBot2StandingCfg(ZBot2Cfg):
"""Standing configuration for the ZBot2 humanoid robot."""

class init_state(LeggedRobotCfg.init_state):
# Use the same or slightly higher base position if you'd like a different "standing" height
pos = [0.0, 0.0, Robot.height]
rot = Robot.rotation

# Start with all zeros
default_joint_angles = {k: 0.0 for k in Robot.all_joints()}

# Overwrite with the default standing angles from Robot
default_positions = Robot.default_standing()
for joint in default_positions:
default_joint_angles[joint] = default_positions[joint]

class rewards:
base_height_target = Robot.height
min_dist = 0.2
max_dist = 0.5
target_joint_pos_scale = 0.17 # rad
target_feet_height = 0.05 # m
cycle_time = 0.5 # sec
only_positive_rewards = False
tracking_sigma = 5
max_contact_force = 200

class scales:
# You can keep or change these from ZBot2Cfg
default_joint_pos = 1.0
orientation = 1
base_height = 0.2
base_acc = 0.2
action_smoothness = -0.002
torques = -1e-5
dof_vel = -1e-3
dof_acc = -2.5e-7
collision = -1.0


class ZBot2CfgPPO(LeggedRobotCfgPPO):
seed = 5
runner_class_name = "OnPolicyRunner" # DWLOnPolicyRunner
Expand Down

0 comments on commit 396e435

Please sign in to comment.