diff --git a/legged_gym/envs/__init__.py b/legged_gym/envs/__init__.py index de30e23..f87d9b2 100644 --- a/legged_gym/envs/__init__.py +++ b/legged_gym/envs/__init__.py @@ -2,8 +2,11 @@ from legged_gym import LEGGED_GYM_ROOT_DIR, LEGGED_GYM_ENVS_DIR from legged_gym.envs.go2.go2_config import GO2RoughCfg, GO2RoughCfgPPO +from legged_gym.envs.h1.h1_config import H1RoughCfg, H1RoughCfgPPO from .base.legged_robot import LeggedRobot from legged_gym.utils.task_registry import task_registry -task_registry.register( "go2", LeggedRobot, GO2RoughCfg(), GO2RoughCfgPPO() ) +task_registry.register( "go2", LeggedRobot, GO2RoughCfg(), GO2RoughCfgPPO()) +task_registry.register( "h1", LeggedRobot, H1RoughCfg(), H1RoughCfgPPO()) + diff --git a/legged_gym/envs/go2/go2_config.py b/legged_gym/envs/go2/go2_config.py index af9cd6d..235360a 100644 --- a/legged_gym/envs/go2/go2_config.py +++ b/legged_gym/envs/go2/go2_config.py @@ -1,33 +1,3 @@ -# SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: BSD-3-Clause -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# Copyright (c) 2021 ETH Zurich, Nikita Rudin - from legged_gym.envs.base.legged_robot_config import LeggedRobotCfg, LeggedRobotCfgPPO class GO2RoughCfg( LeggedRobotCfg ): @@ -49,6 +19,9 @@ class GO2RoughCfg( LeggedRobotCfg ): 'FR_calf_joint': -1.5, # [rad] 'RR_calf_joint': -1.5, # [rad] } + class env(LeggedRobotCfg.env): + num_observations = 105 + num_actions = 10 class control( LeggedRobotCfg.control ): # PD Drive parameters: diff --git a/legged_gym/envs/h1/__pycache__/h1_config.cpython-38.pyc b/legged_gym/envs/h1/__pycache__/h1_config.cpython-38.pyc new file mode 100644 index 0000000..a8ed8ab Binary files /dev/null and b/legged_gym/envs/h1/__pycache__/h1_config.cpython-38.pyc differ diff --git a/legged_gym/envs/h1/h1_config.py b/legged_gym/envs/h1/h1_config.py new file mode 100644 index 0000000..28b277b --- /dev/null +++ b/legged_gym/envs/h1/h1_config.py @@ -0,0 +1,60 @@ +from legged_gym.envs.base.legged_robot_config import LeggedRobotCfg, LeggedRobotCfgPPO + +class H1RoughCfg( LeggedRobotCfg ): + class init_state( LeggedRobotCfg.init_state ): + pos = [0.0, 0.0, 1.0] # x,y,z [m] + default_joint_angles = { # = target angles [rad] when action = 0.0 + 'left_hip_yaw_joint' : 0. , + 'left_hip_roll_joint' : 0, + 'left_hip_pitch_joint' : -0.4, + 'left_knee_joint' : 0.8, + 'left_ankle_joint' : -0.4, + 'right_hip_yaw_joint' : 0., + 'right_hip_roll_joint' : 0, + 'right_hip_pitch_joint' : -0.4, + 'right_knee_joint' : 0.8, + 'right_ankle_joint' : -0.4, + 'torso_joint' : 0., + 'left_shoulder_pitch_joint' : 0., + 'left_shoulder_roll_joint' : 0, + 'left_shoulder_yaw_joint' : 0., + 'left_elbow_joint' : 0., + 'right_shoulder_pitch_joint' : 0., + 'right_shoulder_roll_joint' : 0.0, + 'right_shoulder_yaw_joint' : 0., + 'right_elbow_joint' : 0., + } + + class control( LeggedRobotCfg.control ): + # PD Drive parameters: + control_type = 'P' + stiffness = {'joint': 20.} # [N*m/rad] + damping = {'joint': 0.5} # [N*m*s/rad] + # action scale: target angle = actionScale * action + defaultAngle + action_scale = 0.25 + # decimation: Number of control action updates @ sim DT per policy DT + decimation = 4 + + class asset( LeggedRobotCfg.asset ): + file = '{LEGGED_GYM_ROOT_DIR}/resources/robots/h1/urdf/h1.urdf' + name = "h1" + foot_name = "ankle" + penalize_contacts_on = ["thigh", "calf"] + terminate_after_contacts_on = ["base"] + self_collisions = 1 # 1 to disable, 0 to enable...bitwise filter + + class rewards( LeggedRobotCfg.rewards ): + soft_dof_pos_limit = 0.9 + base_height_target = 0.98 + class scales( LeggedRobotCfg.rewards.scales ): + torques = -0.0002 + dof_pos_limits = -10.0 + +class H1RoughCfgPPO( LeggedRobotCfgPPO ): + class algorithm( LeggedRobotCfgPPO.algorithm ): + entropy_coef = 0.01 + class runner( LeggedRobotCfgPPO.runner ): + run_name = '' + experiment_name = 'rough_go2' + + diff --git a/resources/robots/h1/meshes/left_ankle_link.STL b/resources/robots/h1/meshes/left_ankle_link.STL new file mode 100644 index 0000000..e6714d2 Binary files /dev/null and b/resources/robots/h1/meshes/left_ankle_link.STL differ diff --git a/resources/robots/h1/meshes/left_elbow_link.STL b/resources/robots/h1/meshes/left_elbow_link.STL new file mode 100644 index 0000000..5f798ca Binary files /dev/null and b/resources/robots/h1/meshes/left_elbow_link.STL differ diff --git a/resources/robots/h1/meshes/left_hip_pitch_link.STL b/resources/robots/h1/meshes/left_hip_pitch_link.STL new file mode 100644 index 0000000..e5898ab Binary files /dev/null and b/resources/robots/h1/meshes/left_hip_pitch_link.STL differ diff --git a/resources/robots/h1/meshes/left_hip_roll_link.STL b/resources/robots/h1/meshes/left_hip_roll_link.STL new file mode 100644 index 0000000..5ade02b Binary files /dev/null and b/resources/robots/h1/meshes/left_hip_roll_link.STL differ diff --git a/resources/robots/h1/meshes/left_hip_yaw_link.STL b/resources/robots/h1/meshes/left_hip_yaw_link.STL new file mode 100644 index 0000000..3bcc4b8 Binary files /dev/null and b/resources/robots/h1/meshes/left_hip_yaw_link.STL differ diff --git a/resources/robots/h1/meshes/left_knee_link.STL b/resources/robots/h1/meshes/left_knee_link.STL new file mode 100644 index 0000000..18174ee Binary files /dev/null and b/resources/robots/h1/meshes/left_knee_link.STL differ diff --git a/resources/robots/h1/meshes/left_shoulder_pitch_link.STL b/resources/robots/h1/meshes/left_shoulder_pitch_link.STL new file mode 100644 index 0000000..be81370 Binary files /dev/null and b/resources/robots/h1/meshes/left_shoulder_pitch_link.STL differ diff --git a/resources/robots/h1/meshes/left_shoulder_roll_link.STL b/resources/robots/h1/meshes/left_shoulder_roll_link.STL new file mode 100644 index 0000000..a59bb64 Binary files /dev/null and b/resources/robots/h1/meshes/left_shoulder_roll_link.STL differ diff --git a/resources/robots/h1/meshes/left_shoulder_yaw_link.STL b/resources/robots/h1/meshes/left_shoulder_yaw_link.STL new file mode 100644 index 0000000..01d3c75 Binary files /dev/null and b/resources/robots/h1/meshes/left_shoulder_yaw_link.STL differ diff --git a/resources/robots/h1/meshes/logo_link.STL b/resources/robots/h1/meshes/logo_link.STL new file mode 100644 index 0000000..c396d51 Binary files /dev/null and b/resources/robots/h1/meshes/logo_link.STL differ diff --git a/resources/robots/h1/meshes/pelvis.STL b/resources/robots/h1/meshes/pelvis.STL new file mode 100644 index 0000000..05e5512 Binary files /dev/null and b/resources/robots/h1/meshes/pelvis.STL differ diff --git a/resources/robots/h1/meshes/right_ankle_link.STL b/resources/robots/h1/meshes/right_ankle_link.STL new file mode 100644 index 0000000..3e52a9c Binary files /dev/null and b/resources/robots/h1/meshes/right_ankle_link.STL differ diff --git a/resources/robots/h1/meshes/right_elbow_link.STL b/resources/robots/h1/meshes/right_elbow_link.STL new file mode 100644 index 0000000..f4c03e3 Binary files /dev/null and b/resources/robots/h1/meshes/right_elbow_link.STL differ diff --git a/resources/robots/h1/meshes/right_hip_pitch_link.STL b/resources/robots/h1/meshes/right_hip_pitch_link.STL new file mode 100644 index 0000000..1d4e515 Binary files /dev/null and b/resources/robots/h1/meshes/right_hip_pitch_link.STL differ diff --git a/resources/robots/h1/meshes/right_hip_roll_link.STL b/resources/robots/h1/meshes/right_hip_roll_link.STL new file mode 100644 index 0000000..d2a0af9 Binary files /dev/null and b/resources/robots/h1/meshes/right_hip_roll_link.STL differ diff --git a/resources/robots/h1/meshes/right_hip_yaw_link.STL b/resources/robots/h1/meshes/right_hip_yaw_link.STL new file mode 100644 index 0000000..6c8ffd5 Binary files /dev/null and b/resources/robots/h1/meshes/right_hip_yaw_link.STL differ diff --git a/resources/robots/h1/meshes/right_knee_link.STL b/resources/robots/h1/meshes/right_knee_link.STL new file mode 100644 index 0000000..1ed90cc Binary files /dev/null and b/resources/robots/h1/meshes/right_knee_link.STL differ diff --git a/resources/robots/h1/meshes/right_shoulder_pitch_link.STL b/resources/robots/h1/meshes/right_shoulder_pitch_link.STL new file mode 100644 index 0000000..f77ab2b Binary files /dev/null and b/resources/robots/h1/meshes/right_shoulder_pitch_link.STL differ diff --git a/resources/robots/h1/meshes/right_shoulder_roll_link.STL b/resources/robots/h1/meshes/right_shoulder_roll_link.STL new file mode 100644 index 0000000..a98398f Binary files /dev/null and b/resources/robots/h1/meshes/right_shoulder_roll_link.STL differ diff --git a/resources/robots/h1/meshes/right_shoulder_yaw_link.STL b/resources/robots/h1/meshes/right_shoulder_yaw_link.STL new file mode 100644 index 0000000..7943bab Binary files /dev/null and b/resources/robots/h1/meshes/right_shoulder_yaw_link.STL differ diff --git a/resources/robots/h1/meshes/torso_link.STL b/resources/robots/h1/meshes/torso_link.STL new file mode 100644 index 0000000..335b2f1 Binary files /dev/null and b/resources/robots/h1/meshes/torso_link.STL differ diff --git a/resources/robots/h1/urdf/h1.urdf b/resources/robots/h1/urdf/h1.urdf new file mode 100644 index 0000000..0adba67 --- /dev/null +++ b/resources/robots/h1/urdf/h1.urdf @@ -0,0 +1,1205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file