Skip to content

Commit

Permalink
add zeroth (#127)
Browse files Browse the repository at this point in the history
add zeroth
  • Loading branch information
budzianowski authored Dec 6, 2024
1 parent ba66414 commit cca588a
Show file tree
Hide file tree
Showing 23 changed files with 854 additions and 1,676 deletions.
6 changes: 3 additions & 3 deletions sim/envs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
from sim.envs.humanoids.grp_config import GprCfg, GprCfgPPO, GprStandingCfg
from sim.envs.humanoids.h1_config import H1Cfg, H1CfgPPO
from sim.envs.humanoids.h1_env import H1FreeEnv
from sim.envs.humanoids.stompymicro_config import StompyMicroCfg, StompyMicroCfgPPO
from sim.envs.humanoids.stompymicro_env import StompyMicroEnv
from sim.envs.humanoids.xbot_config import XBotCfg, XBotCfgPPO
from sim.envs.humanoids.xbot_env import XBotLFreeEnv
from sim.envs.humanoids.zeroth_config import ZerothCfg, ZerothCfgPPO
from sim.envs.humanoids.zeroth_env import ZerothEnv
from sim.utils.task_registry import TaskRegistry # noqa: E402

task_registry = TaskRegistry()
Expand All @@ -29,4 +29,4 @@
task_registry.register("h1", H1FreeEnv, H1Cfg(), H1CfgPPO())
task_registry.register("g1", G1FreeEnv, G1Cfg(), G1CfgPPO())
task_registry.register("XBotL_free", XBotLFreeEnv, XBotCfg(), XBotCfgPPO())
task_registry.register("stompymicro", StompyMicroEnv, StompyMicroCfg(), StompyMicroCfgPPO())
task_registry.register("zeroth", ZerothEnv, ZerothCfg(), ZerothCfgPPO())
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
LeggedRobotCfg,
LeggedRobotCfgPPO,
)
from sim.resources.stompymicro.joints import Robot
from sim.resources.zeroth.joints import Robot

NUM_JOINTS = len(Robot.all_joints()) # 20


class StompyMicroCfg(LeggedRobotCfg):
class ZerothCfg(LeggedRobotCfg):
"""Configuration class for the Legs humanoid robot."""

class env(LeggedRobotCfg.env):
Expand All @@ -34,11 +34,11 @@ class safety:
terminate_after_contacts_on = []

class asset(LeggedRobotCfg.asset):
name = "stompymicro"
name = "zeroth"
file = str(robot_urdf_path(name))

foot_name = ["foot_left", "foot_right"]
knee_name = ["ankle_pitch_left", "ankle_pitch_right"]
foot_name = ["foot_bracket_for_5dof_leg_v9", "foot_bracket_for_5dof_leg_v9_2"]
knee_name = ["leg_top_bracket_v8_1", "leg_top_bracket_v8_1_2"]

termination_height = 0.05
default_feet_height = 0.01
Expand Down Expand Up @@ -97,7 +97,7 @@ class control(LeggedRobotCfg.control):
# action scale: target angle = actionScale * action + defaultAngle
action_scale = 0.25
# decimation: Number of control action updates @ sim DT per policy DT
decimation = 20 # 100hz
decimation = 10 # 100hz

class sim(LeggedRobotCfg.sim):
dt = 0.001 # 1000 Hz
Expand All @@ -123,7 +123,7 @@ class domain_rand(LeggedRobotCfg.domain_rand):
randomize_friction = True
friction_range = [0.1, 2.0]
randomize_base_mass = True # True
added_mass_range = [-0.5, 0.5]
added_mass_range = [-0.25, 0.25]
push_robots = True # True
push_interval_s = 4
max_push_vel_xy = 0.05
Expand Down Expand Up @@ -157,30 +157,25 @@ class rewards:
only_positive_rewards = True
# tracking reward = exp(error*sigma)
tracking_sigma = 5.0
max_contact_force = 50 # forces above this value are penalized
max_contact_force = 400 # forces above this value are penalized

class scales:

# TODO: add an argument
walking = False

if walking == True:
# reference motion tracking
joint_pos = 1.6
feet_clearance = 1.2
feet_contact_number = 1.2
feet_air_time = 1.2
foot_slip = -0.05
feet_distance = 0.2
knee_distance = 0.2
# contact
feet_contact_forces = -0.01
# vel tracking
tracking_lin_vel = 1.2
tracking_ang_vel = 1.1
vel_mismatch_exp = 0.5 # lin_z; ang x,y
low_speed = 0.4
track_vel_hard = 0.5
# reference motion tracking
joint_pos = 1.6
feet_clearance = 1.2
feet_contact_number = 1.2
feet_air_time = 1.2
foot_slip = -0.05
feet_distance = 0.2
knee_distance = 0.2
# contact
feet_contact_forces = -0.01
# vel tracking
tracking_lin_vel = 1.2
tracking_ang_vel = 1.1
vel_mismatch_exp = 0.5 # lin_z; ang x,y
low_speed = 0.4
track_vel_hard = 0.5

# base pos
default_joint_pos = 1.0
Expand Down Expand Up @@ -212,7 +207,7 @@ class viewer:
lookat = [0, -2, 0]


class StompyMicroCfgPPO(LeggedRobotCfgPPO):
class ZerothCfgPPO(LeggedRobotCfgPPO):
seed = 5
runner_class_name = "OnPolicyRunner" # DWLOnPolicyRunner

Expand All @@ -237,7 +232,7 @@ class runner:

# logging
save_interval = 300 # check for potential saves every this many iterations
experiment_name = "StompyMicro"
experiment_name = "zeroth"
run_name = ""
# load and resume
resume = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Defines the environment for training the humanoid."""

from sim.envs.base.legged_robot import LeggedRobot
from sim.resources.stompymicro.joints import Robot
from sim.resources.zeroth.joints import Robot
from sim.utils.terrain import HumanoidTerrain

from isaacgym import gymtorch # isort:skip
Expand All @@ -12,8 +12,8 @@
import torch # isort:skip


class StompyMicroEnv(LeggedRobot):
"""StompyFreeEnv is a class that represents a custom environment for a legged robot.
class ZerothEnv(LeggedRobot):
"""ZerothFreeEnv is a class that represents a custom environment for a legged robot.
Args:
cfg: Configuration object for the legged robot.
Expand Down
Loading

0 comments on commit cca588a

Please sign in to comment.