yxK commited on
Commit
a203f2d
·
verified ·
1 Parent(s): c4c2acb

Upload 8 files

Browse files
skill_policies/h1_reaching/0000_best/h1_reaching_config.py ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: BSD-3-Clause
2
+ #
3
+ # Redistribution and use in source and binary forms, with or without
4
+ # modification, are permitted provided that the following conditions are met:
5
+ #
6
+ # 1. Redistributions of source code must retain the above copyright notice, this
7
+ # list of conditions and the following disclaimer.
8
+ #
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ #
13
+ # 3. Neither the name of the copyright holder nor the names of its
14
+ # contributors may be used to endorse or promote products derived from
15
+ # this software without specific prior written permission.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ #
28
+ # Copyright (c) 2024 Beijing RobotEra TECHNOLOGY CO.,LTD. All rights reserved.
29
+
30
+
31
+ from legged_gym.envs.base.legged_robot_config import LeggedRobotCfg, LeggedRobotCfgPPO
32
+
33
+
34
+ class H1ReachingCfg(LeggedRobotCfg):
35
+ """
36
+ Configuration class for the H1 humanoid robot.
37
+ """
38
+ class human:
39
+ delay = 0.0 # delay in seconds
40
+ freq = 10
41
+ resample_on_env_reset = True
42
+ filename = 'CMU.npy'
43
+ rng = None # None for no range, default None
44
+
45
+ class env(LeggedRobotCfg.env):
46
+ # change the observation dim
47
+ num_actions = 19
48
+ frame_stack = 1
49
+ c_frame_stack = 3
50
+ command_dim = 14
51
+ num_single_obs = 3 * num_actions + 6 + command_dim # see `obs_buf = torch.cat(...)` for details
52
+ num_observations = int(frame_stack * num_single_obs)
53
+ single_num_privileged_obs = 3 * num_actions + 60
54
+ num_privileged_obs = int(c_frame_stack * single_num_privileged_obs)
55
+
56
+ num_envs = 4096
57
+ episode_length_s = 24 # episode length in seconds
58
+ use_ref_actions = False
59
+
60
+ class safety:
61
+ # safety factors
62
+ pos_limit = 1.0
63
+ vel_limit = 1.0
64
+ torque_limit = 0.85
65
+
66
+ class asset(LeggedRobotCfg.asset):
67
+ file = '{LEGGED_GYM_ROOT_DIR}/resources/robots/h1/urdf/h1_wrist.urdf'
68
+
69
+ name = "h1"
70
+ foot_name = "ankle"
71
+ knee_name = "knee"
72
+ elbow_name = "elbow"
73
+ torso_name = "torso"
74
+ wrist_name = "wrist"
75
+
76
+ terminate_after_contacts_on = ['pelvis', 'torso', 'shoulder', 'elbow']
77
+ penalize_contacts_on = ["hip", 'knee', 'pelvis', 'torso', 'shoulder', 'elbow']
78
+ self_collisions = 0 # 1 to disable, 0 to enable...bitwise filter
79
+ flip_visual_attachments = False
80
+ replace_cylinder_with_capsule = False # replace collision cylinders with capsules, leads to faster/more stable simulation
81
+ fix_base_link = False
82
+ collapse_fixed_joints = False
83
+
84
+ class terrain(LeggedRobotCfg.terrain):
85
+ mesh_type = 'plane'
86
+ curriculum = False
87
+ # mesh_type = 'trimesh'
88
+ # curriculum = True
89
+
90
+ # rough terrain only:
91
+ measure_heights = False
92
+ static_friction = 0.6
93
+ dynamic_friction = 0.6
94
+ terrain_length = 8.
95
+ terrain_width = 8.
96
+ num_rows = 20 # number of terrain rows (levels)
97
+ num_cols = 20 # number of terrain cols (types)
98
+ max_init_terrain_level = 10 # starting curriculum state
99
+ # plane; obstacles; uniform; slope_up; slope_down, stair_up, stair_down
100
+ terrain_proportions = [0.2, 0.2, 0.4, 0.1, 0.1, 0, 0]
101
+ restitution = 0.
102
+
103
+ class noise:
104
+ add_noise = True
105
+ noise_level = 0.6 # scales other values
106
+
107
+ class noise_scales:
108
+ dof_pos = 0.05
109
+ dof_vel = 0.5
110
+ ang_vel = 0.1
111
+ lin_vel = 0.05
112
+ quat = 0.03
113
+ height_measurements = 0.1
114
+
115
+ class init_state(LeggedRobotCfg.init_state):
116
+ pos = [0.0, 0.0, 1.0] # x,y,z [m]
117
+
118
+ default_joint_angles = { # = target angles [rad] when action = 0.0
119
+ 'left_hip_yaw_joint' : 0. ,
120
+ 'left_hip_roll_joint' : 0,
121
+ 'left_hip_pitch_joint' : -0.4,
122
+ 'left_knee_joint' : 0.8,
123
+ 'left_ankle_joint' : -0.4,
124
+ 'right_hip_yaw_joint' : 0.,
125
+ 'right_hip_roll_joint' : 0,
126
+ 'right_hip_pitch_joint' : -0.4,
127
+ 'right_knee_joint' : 0.8,
128
+ 'right_ankle_joint' : -0.4,
129
+ 'torso_joint' : 0.,
130
+ 'left_shoulder_pitch_joint' : 0.,
131
+ 'left_shoulder_roll_joint' : 0,
132
+ 'left_shoulder_yaw_joint' : 0.,
133
+ 'left_elbow_joint' : 0.,
134
+ 'right_shoulder_pitch_joint' : 0.,
135
+ 'right_shoulder_roll_joint' : 0.0,
136
+ 'right_shoulder_yaw_joint' : 0.,
137
+ 'right_elbow_joint' : 0.,
138
+ }
139
+
140
+ class control(LeggedRobotCfg.control):
141
+ control_type = 'P'
142
+ # PD Drive parameters:
143
+ stiffness = {'hip_yaw': 200,
144
+ 'hip_roll': 200,
145
+ 'hip_pitch': 200,
146
+ 'knee': 300,
147
+ 'ankle': 40,
148
+ 'torso': 300,
149
+ 'shoulder': 100,
150
+ "elbow":100,
151
+ } # [N*m/rad]
152
+ damping = { 'hip_yaw': 5,
153
+ 'hip_roll': 5,
154
+ 'hip_pitch': 5,
155
+ 'knee': 6,
156
+ 'ankle': 2,
157
+ 'torso': 6,
158
+ 'shoulder': 2,
159
+ "elbow":2,
160
+ } # [N*m/rad] # [N*m*s/rad]
161
+ # action scale: target angle = actionScale * action + defaultAngle
162
+ action_scale = 0.25
163
+ # decimation: Number of control action updates @ sim DT per policy DT
164
+ decimation = 10 # 100hz
165
+
166
+ class sim(LeggedRobotCfg.sim):
167
+ dt = 0.001 # 1000 Hz
168
+ substeps = 1 # 2
169
+ up_axis = 1 # 0 is y, 1 is z
170
+
171
+ class physx(LeggedRobotCfg.sim.physx):
172
+ num_threads = 10
173
+ solver_type = 1 # 0: pgs, 1: tgs
174
+ num_position_iterations = 4
175
+ num_velocity_iterations = 0
176
+ contact_offset = 0.01 # [m]
177
+ rest_offset = 0.0 # [m]
178
+ bounce_threshold_velocity = 0.1 # [m/s]
179
+ max_depenetration_velocity = 1.0
180
+ max_gpu_contact_pairs = 2**23 # 2**24 -> needed for 8000 envs and more
181
+ default_buffer_size_multiplier = 5
182
+ # 0: never, 1: last sub-step, 2: all sub-steps (default=2)
183
+ contact_collection = 2
184
+
185
+ class domain_rand:
186
+ randomize_friction = True
187
+ friction_range = [0.1, 2.0]
188
+ randomize_base_mass = True
189
+ added_mass_range = [-5., 5.]
190
+ push_robots = True
191
+ push_interval_s = 4
192
+ max_push_vel_xy = 0.2
193
+ max_push_ang_vel = 0.4
194
+ dynamic_randomization = 0.02
195
+
196
+ class commands(LeggedRobotCfg.commands):
197
+ # Vers: lin_vel_x, lin_vel_y, ang_vel_yaw, heading (in heading mode ang_vel_yaw is recomputed from heading error)
198
+ num_commands = 4
199
+ resampling_time = 8. # time before command are changed[s]
200
+ heading_command = True # if true: compute ang vel command from heading error
201
+ curriculum = False # if true: curriculum update of commands
202
+
203
+ class ranges:
204
+ lin_vel_x = [-0, 0] # min max [m/s]
205
+ lin_vel_y = [-0, 0] # min max [m/s]
206
+ ang_vel_yaw = [-0, 0] # min max [rad/s]
207
+ heading = [-0, 0]
208
+ # wrist pos command ranges
209
+ wrist_max_radius = 0.25
210
+ l_wrist_pos_x = [-0.10, 0.25]
211
+ l_wrist_pos_y = [-0.10, 0.25]
212
+ l_wrist_pos_z = [-0.25, 0.25]
213
+ r_wrist_pos_x = [-0.10, 0.25]
214
+ r_wrist_pos_y = [-0.25, 0.10]
215
+ r_wrist_pos_z = [-0.25, 0.25]
216
+
217
+ class rewards:
218
+ base_height_target = 0.89
219
+ min_dist = 0.2
220
+ max_dist = 0.5
221
+ # put some settings here for LLM parameter tuning
222
+ target_joint_pos_scale = 0.17 # rad
223
+ target_feet_height = 0.06 # m
224
+ cycle_time = 0.64 # sec
225
+ # if true negative total rewards are clipped at zero (avoids early termination problems)
226
+ only_positive_rewards = True
227
+ # tracking reward = exp(error*sigma)
228
+ tracking_sigma = 5
229
+ max_contact_force = 700 # forces above this value are penalized
230
+
231
+ class scales:
232
+ # TODO: 1. stand_still 2. joint_pos*2 3. add command input
233
+ # reference motion tracking
234
+ # joint_pos = 5
235
+ wrist_pos = 5
236
+ # feet_clearance = 0
237
+ # feet_contact_number = 0
238
+ # # gait
239
+ # feet_air_time = 0
240
+ # foot_slip = -0.05
241
+ feet_distance = 0.5
242
+ # knee_distance = 0.2
243
+ # # elbow_distance = 0.4
244
+ # # elbow_torso_distance = 0.4
245
+ # # contact
246
+ # feet_contact_forces = -0.01
247
+ # # vel tracking
248
+ # tracking_lin_vel = 0.
249
+ # tracking_ang_vel = 0.
250
+ # vel_mismatch_exp = 0.5 # lin_z; ang x,y
251
+ # low_speed = 0.2
252
+ # track_vel_hard = 0.5 * 2
253
+ # # base pos
254
+ default_joint_pos = 0.5
255
+ upper_body_pos = 0.5
256
+ orientation = 1.
257
+ # base_height = 0.2
258
+ # base_acc = 0.2
259
+ # energy
260
+ # action_smoothness = -0.002
261
+ torques = -1e-5
262
+ dof_vel = -5e-4
263
+ dof_acc = -1e-7
264
+ # collision = -0.2
265
+ #### humanplus ####
266
+ # lin_vel_z = -0.1
267
+ # ang_vel_xy = -0.1
268
+
269
+ class normalization:
270
+ class obs_scales:
271
+ lin_vel = 2.
272
+ ang_vel = 1.
273
+ dof_pos = 1.
274
+ dof_vel = 0.05
275
+ quat = 1.
276
+ height_measurements = 5.0
277
+ clip_observations = 18.
278
+ clip_actions = 18.
279
+
280
+
281
+ class H1ReachingCfgPPO(LeggedRobotCfgPPO):
282
+ seed = 5
283
+ runner_class_name = 'OnPolicyRunner' # DWLOnPolicyRunner
284
+
285
+ class policy:
286
+ init_noise_std = 1.0
287
+ actor_hidden_dims = [512, 256, 128]
288
+ critic_hidden_dims = [768, 256, 128]
289
+
290
+ class algorithm(LeggedRobotCfgPPO.algorithm):
291
+ entropy_coef = 0.001
292
+ learning_rate = 1e-5
293
+ num_learning_epochs = 2
294
+ gamma = 0.994
295
+ lam = 0.9
296
+ num_mini_batches = 4
297
+
298
+ class runner:
299
+ policy_class_name = 'ActorCritic'
300
+ algorithm_class_name = 'PPO'
301
+ num_steps_per_env = 60 # per iteration
302
+ max_iterations = 15001 # 3001 # number of policy updates
303
+
304
+ # logging
305
+ save_interval = 100 # check for potential saves every this many iterations
306
+ experiment_name = 'h1_reaching'
307
+ run_name = ''
308
+ # load and resume
309
+ resume = False
310
+ load_run = -1 # -1 = last run
311
+ checkpoint = -1 # -1 = last saved model
312
+ resume_path = None # updated from load_run and ckpt
skill_policies/h1_reaching/0000_best/model_15001.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0097e7783bd73669aaa37f49cf2fcf2c3caf5328a473f12e264ae34b2e96e47f
3
+ size 8502257
skill_policies/h1_squatting/0000_best/h1_squatting_config.py ADDED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: BSD-3-Clause
2
+ #
3
+ # Redistribution and use in source and binary forms, with or without
4
+ # modification, are permitted provided that the following conditions are met:
5
+ #
6
+ # 1. Redistributions of source code must retain the above copyright notice, this
7
+ # list of conditions and the following disclaimer.
8
+ #
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ #
13
+ # 3. Neither the name of the copyright holder nor the names of its
14
+ # contributors may be used to endorse or promote products derived from
15
+ # this software without specific prior written permission.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ #
28
+ # Copyright (c) 2024 Beijing RobotEra TECHNOLOGY CO.,LTD. All rights reserved.
29
+
30
+
31
+ from legged_gym.envs.base.legged_robot_config import LeggedRobotCfg, LeggedRobotCfgPPO
32
+
33
+
34
+ class H1SquattingCfg(LeggedRobotCfg):
35
+ """
36
+ Configuration class for the H1 humanoid robot.
37
+ """
38
+ class human:
39
+ delay = 0.0 # delay in seconds
40
+ freq = 10
41
+ resample_on_env_reset = True
42
+ filename = 'CMU.npy'
43
+ rng = None # None for no range, default None
44
+
45
+ class env(LeggedRobotCfg.env):
46
+ # change the observation dim
47
+ num_actions = 19
48
+ frame_stack = 1
49
+ c_frame_stack = 3
50
+ command_dim = 1
51
+ num_single_obs = 3 * num_actions + 6 + command_dim # see `obs_buf = torch.cat(...)` for details
52
+ num_observations = int(frame_stack * num_single_obs)
53
+ single_num_privileged_obs = 3 * num_actions + 18 + 3
54
+ num_privileged_obs = int(c_frame_stack * single_num_privileged_obs)
55
+
56
+ num_envs = 4096
57
+ episode_length_s = 24 # episode length in seconds
58
+ use_ref_actions = False
59
+
60
+ class safety:
61
+ # safety factors
62
+ pos_limit = 1.0
63
+ vel_limit = 1.0
64
+ torque_limit = 0.85
65
+
66
+ class asset(LeggedRobotCfg.asset):
67
+ file = '{LEGGED_GYM_ROOT_DIR}/resources/robots/h1/urdf/h1_wrist.urdf'
68
+
69
+ name = "h1"
70
+ foot_name = "ankle"
71
+ knee_name = "knee"
72
+ elbow_name = "elbow"
73
+ torso_name = "torso"
74
+ wrist_name = "wrist"
75
+
76
+ terminate_after_contacts_on = ['pelvis', 'torso', 'shoulder', 'elbow',
77
+ 'hip', 'knee']
78
+ penalize_contacts_on = ["hip", 'knee', 'pelvis', 'torso', 'shoulder', 'elbow']
79
+ self_collisions = 0 # 1 to disable, 0 to enable...bitwise filter
80
+ flip_visual_attachments = False
81
+ replace_cylinder_with_capsule = False # replace collision cylinders with capsules, leads to faster/more stable simulation
82
+ fix_base_link = False
83
+ collapse_fixed_joints = False
84
+
85
+ class terrain(LeggedRobotCfg.terrain):
86
+ mesh_type = 'plane'
87
+ curriculum = False
88
+ # mesh_type = 'trimesh'
89
+ # curriculum = True
90
+
91
+ # rough terrain only:
92
+ measure_heights = False
93
+ static_friction = 0.6
94
+ dynamic_friction = 0.6
95
+ terrain_length = 8.
96
+ terrain_width = 8.
97
+ num_rows = 20 # number of terrain rows (levels)
98
+ num_cols = 20 # number of terrain cols (types)
99
+ max_init_terrain_level = 10 # starting curriculum state
100
+ # plane; obstacles; uniform; slope_up; slope_down, stair_up, stair_down
101
+ terrain_proportions = [0.2, 0.2, 0.4, 0.1, 0.1, 0, 0]
102
+ restitution = 0.
103
+
104
+ class noise:
105
+ add_noise = True
106
+ noise_level = 0.6 # scales other values
107
+
108
+ class noise_scales:
109
+ dof_pos = 0.05
110
+ dof_vel = 0.5
111
+ ang_vel = 0.1
112
+ lin_vel = 0.05
113
+ quat = 0.03
114
+ height_measurements = 0.1
115
+
116
+ class init_state(LeggedRobotCfg.init_state):
117
+ pos = [0.0, 0.0, 1.0] # x,y,z [m]
118
+
119
+ default_joint_angles = { # = target angles [rad] when action = 0.0
120
+ 'left_hip_yaw_joint' : 0. ,
121
+ 'left_hip_roll_joint' : 0,
122
+ 'left_hip_pitch_joint' : -0.4,
123
+ 'left_knee_joint' : 0.8,
124
+ 'left_ankle_joint' : -0.4,
125
+ 'right_hip_yaw_joint' : 0.,
126
+ 'right_hip_roll_joint' : 0,
127
+ 'right_hip_pitch_joint' : -0.4,
128
+ 'right_knee_joint' : 0.8,
129
+ 'right_ankle_joint' : -0.4,
130
+ 'torso_joint' : 0.,
131
+ 'left_shoulder_pitch_joint' : 0.,
132
+ 'left_shoulder_roll_joint' : 0,
133
+ 'left_shoulder_yaw_joint' : 0.,
134
+ 'left_elbow_joint' : 0.,
135
+ 'right_shoulder_pitch_joint' : 0.,
136
+ 'right_shoulder_roll_joint' : 0.0,
137
+ 'right_shoulder_yaw_joint' : 0.,
138
+ 'right_elbow_joint' : 0.,
139
+ }
140
+
141
+ class control(LeggedRobotCfg.control):
142
+ control_type = 'P'
143
+ # PD Drive parameters:
144
+ stiffness = {'hip_yaw': 200,
145
+ 'hip_roll': 200,
146
+ 'hip_pitch': 200,
147
+ 'knee': 300,
148
+ 'ankle': 40,
149
+ 'torso': 300,
150
+ 'shoulder': 100,
151
+ "elbow":100,
152
+ } # [N*m/rad]
153
+ damping = { 'hip_yaw': 5,
154
+ 'hip_roll': 5,
155
+ 'hip_pitch': 5,
156
+ 'knee': 6,
157
+ 'ankle': 2,
158
+ 'torso': 6,
159
+ 'shoulder': 2,
160
+ "elbow":2,
161
+ } # [N*m/rad] # [N*m*s/rad]
162
+ # action scale: target angle = actionScale * action + defaultAngle
163
+ action_scale = 0.25
164
+ # decimation: Number of control action updates @ sim DT per policy DT
165
+ decimation = 10 # 100hz
166
+
167
+ class sim(LeggedRobotCfg.sim):
168
+ dt = 0.001 # 1000 Hz
169
+ substeps = 1 # 2
170
+ up_axis = 1 # 0 is y, 1 is z
171
+
172
+ class physx(LeggedRobotCfg.sim.physx):
173
+ num_threads = 10
174
+ solver_type = 1 # 0: pgs, 1: tgs
175
+ num_position_iterations = 4
176
+ num_velocity_iterations = 0
177
+ contact_offset = 0.01 # [m]
178
+ rest_offset = 0.0 # [m]
179
+ bounce_threshold_velocity = 0.1 # [m/s]
180
+ max_depenetration_velocity = 1.0
181
+ max_gpu_contact_pairs = 2**23 # 2**24 -> needed for 8000 envs and more
182
+ default_buffer_size_multiplier = 5
183
+ # 0: never, 1: last sub-step, 2: all sub-steps (default=2)
184
+ contact_collection = 2
185
+
186
+ class domain_rand:
187
+ randomize_friction = True
188
+ friction_range = [0.1, 2.0]
189
+ randomize_base_mass = True
190
+ added_mass_range = [-5., 5.]
191
+ push_robots = True
192
+ push_interval_s = 4
193
+ max_push_vel_xy = 0.2
194
+ max_push_ang_vel = 0.4
195
+ dynamic_randomization = 0.02
196
+
197
+ class commands(LeggedRobotCfg.commands):
198
+ # Vers: lin_vel_x, lin_vel_y, ang_vel_yaw, heading (in heading mode ang_vel_yaw is recomputed from heading error)
199
+ num_commands = 4
200
+ resampling_time = 8. # time before command are changed[s]
201
+ heading_command = True # if true: compute ang vel command from heading error
202
+ curriculum = False # if true: curriculum update of commands
203
+
204
+ class ranges:
205
+ lin_vel_x = [-0, 0] # min max [m/s]
206
+ lin_vel_y = [-0, 0] # min max [m/s]
207
+ ang_vel_yaw = [-0, 0] # min max [rad/s]
208
+ heading = [-0, 0]
209
+ # root height [m]
210
+ root_height_std = 0.1
211
+ min_root_height = 0.5
212
+ max_root_height = 1.1
213
+
214
+ class rewards:
215
+ base_height_target = 0.89
216
+ min_dist = 0.2
217
+ max_dist = 0.5
218
+ # put some settings here for LLM parameter tuning
219
+ target_joint_pos_scale = 0.17 # rad
220
+ target_feet_height = 0.06 # m
221
+ cycle_time = 0.64 # sec
222
+ # if true negative total rewards are clipped at zero (avoids early termination problems)
223
+ only_positive_rewards = True
224
+ # tracking reward = exp(error*sigma)
225
+ tracking_sigma = 5
226
+ max_contact_force = 700 # forces above this value are penalized
227
+
228
+ class scales:
229
+ # TODO: 1. stand_still 2. joint_pos*2 3. add command input
230
+ # reference motion tracking
231
+ # joint_pos = 5
232
+ squatting = 5
233
+ # feet_clearance = 0
234
+ # feet_contact_number = 0
235
+ # # gait
236
+ # feet_air_time = 0
237
+ # foot_slip = -0.05
238
+ feet_distance = 0.5
239
+ # knee_distance = 0.2
240
+ # # elbow_distance = 0.4
241
+ # # elbow_torso_distance = 0.4
242
+ # # contact
243
+ # feet_contact_forces = -0.01
244
+ # # vel tracking
245
+ # tracking_lin_vel = 0.
246
+ # tracking_ang_vel = 0.
247
+ # vel_mismatch_exp = 0.5 # lin_z; ang x,y
248
+ # low_speed = 0.2
249
+ # track_vel_hard = 0.5 * 2
250
+ # # base pos
251
+ default_joint_pos = 0.5
252
+ upper_body_pos = 0.5
253
+ orientation = 1.
254
+ # base_height = 0.2
255
+ # base_acc = 0.2
256
+ # energy
257
+ # action_smoothness = -0.002
258
+ torques = -1e-5
259
+ dof_vel = -5e-4
260
+ dof_acc = -1e-7
261
+ # collision = -0.2
262
+ #### humanplus ####
263
+ # lin_vel_z = -0.1
264
+ # ang_vel_xy = -0.1
265
+
266
+ class normalization:
267
+ class obs_scales:
268
+ lin_vel = 2.
269
+ ang_vel = 1.
270
+ dof_pos = 1.
271
+ dof_vel = 0.05
272
+ quat = 1.
273
+ height_measurements = 5.0
274
+ clip_observations = 18.
275
+ clip_actions = 18.
276
+
277
+
278
+ class H1SquattingCfgPPO(LeggedRobotCfgPPO):
279
+ seed = 5
280
+ runner_class_name = 'OnPolicyRunner' # DWLOnPolicyRunner
281
+
282
+ class policy:
283
+ init_noise_std = 1.0
284
+ actor_hidden_dims = [512, 256, 128]
285
+ critic_hidden_dims = [768, 256, 128]
286
+
287
+ class algorithm(LeggedRobotCfgPPO.algorithm):
288
+ entropy_coef = 0.001
289
+ learning_rate = 1e-5
290
+ num_learning_epochs = 2
291
+ gamma = 0.994
292
+ lam = 0.9
293
+ num_mini_batches = 4
294
+
295
+ class runner:
296
+ policy_class_name = 'ActorCritic'
297
+ algorithm_class_name = 'PPO'
298
+ num_steps_per_env = 60 # per iteration
299
+ max_iterations = 15001 # 3001 # number of policy updates
300
+
301
+ # logging
302
+ save_interval = 100 # check for potential saves every this many iterations
303
+ experiment_name = 'h1_squatting'
304
+ run_name = ''
305
+ # load and resume
306
+ resume = False
307
+ load_run = -1 # -1 = last run
308
+ checkpoint = -1 # -1 = last saved model
309
+ resume_path = None # updated from load_run and ckpt
skill_policies/h1_squatting/0000_best/model_15001.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab45fa5311536001fa5a077d1ddb441a4bab425bfa83271c91d888368d94e368
3
+ size 7344113
skill_policies/h1_stepping/0000_best/h1_stepping_config.py ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: BSD-3-Clause
2
+ #
3
+ # Redistribution and use in source and binary forms, with or without
4
+ # modification, are permitted provided that the following conditions are met:
5
+ #
6
+ # 1. Redistributions of source code must retain the above copyright notice, this
7
+ # list of conditions and the following disclaimer.
8
+ #
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ #
13
+ # 3. Neither the name of the copyright holder nor the names of its
14
+ # contributors may be used to endorse or promote products derived from
15
+ # this software without specific prior written permission.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ #
28
+ # Copyright (c) 2024 Beijing RobotEra TECHNOLOGY CO.,LTD. All rights reserved.
29
+
30
+
31
+ from legged_gym.envs.base.legged_robot_config import LeggedRobotCfg, LeggedRobotCfgPPO
32
+
33
+
34
+ class H1SteppingCfg(LeggedRobotCfg):
35
+ """
36
+ Configuration class for the H1 humanoid robot.
37
+ """
38
+ class human:
39
+ delay = 0.0 # delay in seconds
40
+ freq = 10
41
+ resample_on_env_reset = True
42
+ filename = 'CMU.npy'
43
+ rng = None # None for no range, default None
44
+
45
+ class env(LeggedRobotCfg.env):
46
+ # change the observation dim
47
+ num_actions = 19
48
+ frame_stack = 1
49
+ c_frame_stack = 3
50
+ command_dim = 4
51
+ num_single_obs = 3 * num_actions + 6 + command_dim # see `obs_buf = torch.cat(...)` for details
52
+ num_observations = int(frame_stack * num_single_obs)
53
+ single_num_privileged_obs = 3 * num_actions + 18 + 12
54
+ num_privileged_obs = int(c_frame_stack * single_num_privileged_obs)
55
+
56
+ num_envs = 4096
57
+ episode_length_s = 24 # episode length in seconds
58
+ use_ref_actions = False
59
+
60
+ class safety:
61
+ # safety factors
62
+ pos_limit = 1.0
63
+ vel_limit = 1.0
64
+ torque_limit = 0.85
65
+
66
+ class asset(LeggedRobotCfg.asset):
67
+ file = '{LEGGED_GYM_ROOT_DIR}/resources/robots/h1/urdf/h1_wrist.urdf'
68
+
69
+ name = "h1"
70
+ foot_name = "ankle"
71
+ knee_name = "knee"
72
+ elbow_name = "elbow"
73
+ torso_name = "torso"
74
+ wrist_name = "wrist"
75
+
76
+ terminate_after_contacts_on = ['pelvis', 'torso', 'shoulder', 'elbow',
77
+ 'hip', 'knee']
78
+ penalize_contacts_on = ["hip", 'knee', 'pelvis', 'torso', 'shoulder', 'elbow']
79
+ self_collisions = 0 # 1 to disable, 0 to enable...bitwise filter
80
+ flip_visual_attachments = False
81
+ replace_cylinder_with_capsule = False # replace collision cylinders with capsules, leads to faster/more stable simulation
82
+ fix_base_link = False
83
+ collapse_fixed_joints = False
84
+
85
+ class terrain(LeggedRobotCfg.terrain):
86
+ mesh_type = 'plane'
87
+ curriculum = False
88
+ # mesh_type = 'trimesh'
89
+ # curriculum = True
90
+
91
+ # rough terrain only:
92
+ measure_heights = False
93
+ static_friction = 0.6
94
+ dynamic_friction = 0.6
95
+ terrain_length = 8.
96
+ terrain_width = 8.
97
+ num_rows = 20 # number of terrain rows (levels)
98
+ num_cols = 20 # number of terrain cols (types)
99
+ max_init_terrain_level = 10 # starting curriculum state
100
+ # plane; obstacles; uniform; slope_up; slope_down, stair_up, stair_down
101
+ terrain_proportions = [0.2, 0.2, 0.4, 0.1, 0.1, 0, 0]
102
+ restitution = 0.
103
+
104
+ class noise:
105
+ add_noise = True
106
+ noise_level = 0.6 # scales other values
107
+
108
+ class noise_scales:
109
+ dof_pos = 0.05
110
+ dof_vel = 0.5
111
+ ang_vel = 0.1
112
+ lin_vel = 0.05
113
+ quat = 0.03
114
+ height_measurements = 0.1
115
+
116
+ class init_state(LeggedRobotCfg.init_state):
117
+ pos = [0.0, 0.0, 1.0] # x,y,z [m]
118
+
119
+ default_joint_angles = { # = target angles [rad] when action = 0.0
120
+ 'left_hip_yaw_joint' : 0. ,
121
+ 'left_hip_roll_joint' : 0,
122
+ 'left_hip_pitch_joint' : -0.4,
123
+ 'left_knee_joint' : 0.8,
124
+ 'left_ankle_joint' : -0.4,
125
+ 'right_hip_yaw_joint' : 0.,
126
+ 'right_hip_roll_joint' : 0,
127
+ 'right_hip_pitch_joint' : -0.4,
128
+ 'right_knee_joint' : 0.8,
129
+ 'right_ankle_joint' : -0.4,
130
+ 'torso_joint' : 0.,
131
+ 'left_shoulder_pitch_joint' : 0.,
132
+ 'left_shoulder_roll_joint' : 0,
133
+ 'left_shoulder_yaw_joint' : 0.,
134
+ 'left_elbow_joint' : 0.,
135
+ 'right_shoulder_pitch_joint' : 0.,
136
+ 'right_shoulder_roll_joint' : 0.0,
137
+ 'right_shoulder_yaw_joint' : 0.,
138
+ 'right_elbow_joint' : 0.,
139
+ }
140
+
141
+ class control(LeggedRobotCfg.control):
142
+ control_type = 'P'
143
+ # PD Drive parameters:
144
+ stiffness = {'hip_yaw': 200,
145
+ 'hip_roll': 200,
146
+ 'hip_pitch': 200,
147
+ 'knee': 300,
148
+ 'ankle': 40,
149
+ 'torso': 300,
150
+ 'shoulder': 100,
151
+ "elbow":100,
152
+ } # [N*m/rad]
153
+ damping = { 'hip_yaw': 5,
154
+ 'hip_roll': 5,
155
+ 'hip_pitch': 5,
156
+ 'knee': 6,
157
+ 'ankle': 2,
158
+ 'torso': 6,
159
+ 'shoulder': 2,
160
+ "elbow":2,
161
+ } # [N*m/rad] # [N*m*s/rad]
162
+ # action scale: target angle = actionScale * action + defaultAngle
163
+ action_scale = 0.25
164
+ # decimation: Number of control action updates @ sim DT per policy DT
165
+ decimation = 10 # 100hz
166
+
167
+ class sim(LeggedRobotCfg.sim):
168
+ dt = 0.001 # 1000 Hz
169
+ substeps = 1 # 2
170
+ up_axis = 1 # 0 is y, 1 is z
171
+
172
+ class physx(LeggedRobotCfg.sim.physx):
173
+ num_threads = 10
174
+ solver_type = 1 # 0: pgs, 1: tgs
175
+ num_position_iterations = 4
176
+ num_velocity_iterations = 0
177
+ contact_offset = 0.01 # [m]
178
+ rest_offset = 0.0 # [m]
179
+ bounce_threshold_velocity = 0.1 # [m/s]
180
+ max_depenetration_velocity = 1.0
181
+ max_gpu_contact_pairs = 2**23 # 2**24 -> needed for 8000 envs and more
182
+ default_buffer_size_multiplier = 5
183
+ # 0: never, 1: last sub-step, 2: all sub-steps (default=2)
184
+ contact_collection = 2
185
+
186
+ class domain_rand:
187
+ randomize_friction = True
188
+ friction_range = [0.1, 2.0]
189
+ randomize_base_mass = True
190
+ added_mass_range = [-5., 5.]
191
+ push_robots = True
192
+ push_interval_s = 4
193
+ max_push_vel_xy = 0.2
194
+ max_push_ang_vel = 0.4
195
+ dynamic_randomization = 0.02
196
+
197
+ class commands(LeggedRobotCfg.commands):
198
+ # Vers: lin_vel_x, lin_vel_y, ang_vel_yaw, heading (in heading mode ang_vel_yaw is recomputed from heading error)
199
+ num_commands = 4
200
+ resampling_time = 8. # time before command are changed[s]
201
+ heading_command = True # if true: compute ang vel command from heading error
202
+ curriculum = False # if true: curriculum update of commands
203
+
204
+ class ranges:
205
+ lin_vel_x = [-0, 0] # min max [m/s]
206
+ lin_vel_y = [-0, 0] # min max [m/s]
207
+ ang_vel_yaw = [-0, 0] # min max [rad/s]
208
+ heading = [-0, 0]
209
+ # feet pos command ranges
210
+ feet_max_radius = 0.25
211
+
212
+ class rewards:
213
+ base_height_target = 0.89
214
+ min_dist = 0.2
215
+ max_dist = 0.5
216
+ # put some settings here for LLM parameter tuning
217
+ target_joint_pos_scale = 0.17 # rad
218
+ target_feet_height = 0.06 # m
219
+ cycle_time = 0.64 # sec
220
+ # if true negative total rewards are clipped at zero (avoids early termination problems)
221
+ only_positive_rewards = True
222
+ # tracking reward = exp(error*sigma)
223
+ tracking_sigma = 5
224
+ max_contact_force = 700 # forces above this value are penalized
225
+
226
+ class scales:
227
+ # TODO: 1. stand_still 2. joint_pos*2 3. add command input
228
+ # reference motion tracking
229
+ # joint_pos = 5
230
+ feet_pos = 5
231
+ # feet_clearance = 0
232
+ # feet_contact_number = 0
233
+ # # gait
234
+ # feet_air_time = 0
235
+ # foot_slip = -0.05
236
+ # feet_distance = 0.5
237
+ # knee_distance = 0.2
238
+ # # elbow_distance = 0.4
239
+ # # elbow_torso_distance = 0.4
240
+ # # contact
241
+ # feet_contact_forces = -0.01
242
+ # # vel tracking
243
+ # tracking_lin_vel = 0.
244
+ # tracking_ang_vel = 0.
245
+ # vel_mismatch_exp = 0.5 # lin_z; ang x,y
246
+ # low_speed = 0.2
247
+ # track_vel_hard = 0.5 * 2
248
+ # # base pos
249
+ # default_joint_pos = 0.5
250
+ upper_body_pos = 0.5
251
+ orientation = 1.
252
+ # base_height = 0.2
253
+ # base_acc = 0.2
254
+ # energy
255
+ # action_smoothness = -0.002
256
+ torques = -1e-5
257
+ dof_vel = -5e-4
258
+ dof_acc = -1e-7
259
+ # collision = -0.2
260
+ #### humanplus ####
261
+ # lin_vel_z = -0.1
262
+ # ang_vel_xy = -0.1
263
+
264
+ class normalization:
265
+ class obs_scales:
266
+ lin_vel = 2.
267
+ ang_vel = 1.
268
+ dof_pos = 1.
269
+ dof_vel = 0.05
270
+ quat = 1.
271
+ height_measurements = 5.0
272
+ clip_observations = 18.
273
+ clip_actions = 18.
274
+
275
+
276
+ class H1SteppingCfgPPO(LeggedRobotCfgPPO):
277
+ seed = 5
278
+ runner_class_name = 'OnPolicyRunner' # DWLOnPolicyRunner
279
+
280
+ class policy:
281
+ init_noise_std = 1.0
282
+ actor_hidden_dims = [512, 256, 128]
283
+ critic_hidden_dims = [768, 256, 128]
284
+
285
+ class algorithm(LeggedRobotCfgPPO.algorithm):
286
+ entropy_coef = 0.001
287
+ learning_rate = 1e-5
288
+ num_learning_epochs = 2
289
+ gamma = 0.994
290
+ lam = 0.9
291
+ num_mini_batches = 4
292
+
293
+ class runner:
294
+ policy_class_name = 'ActorCritic'
295
+ algorithm_class_name = 'PPO'
296
+ num_steps_per_env = 60 # per iteration
297
+ max_iterations = 15001 # 3001 # number of policy updates
298
+
299
+ # logging
300
+ save_interval = 100 # check for potential saves every this many iterations
301
+ experiment_name = 'h1_stepping'
302
+ run_name = ''
303
+ # load and resume
304
+ resume = False
305
+ load_run = -1 # -1 = last run
306
+ checkpoint = -1 # -1 = last saved model
307
+ resume_path = None # updated from load_run and ckpt
skill_policies/h1_stepping/0000_best/model_15001.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3fc8906af0901a5c0f6722f5fdbba12cdea69b3b9095af14f33502949378035
3
+ size 7611377
skill_policies/h1_walking/0000_best/h1_walking_config.py ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: BSD-3-Clause
2
+ #
3
+ # Redistribution and use in source and binary forms, with or without
4
+ # modification, are permitted provided that the following conditions are met:
5
+ #
6
+ # 1. Redistributions of source code must retain the above copyright notice, this
7
+ # list of conditions and the following disclaimer.
8
+ #
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+ #
13
+ # 3. Neither the name of the copyright holder nor the names of its
14
+ # contributors may be used to endorse or promote products derived from
15
+ # this software without specific prior written permission.
16
+ #
17
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ #
28
+ # Copyright (c) 2024 Beijing RobotEra TECHNOLOGY CO.,LTD. All rights reserved.
29
+
30
+
31
+ from legged_gym.envs.base.legged_robot_config import LeggedRobotCfg, LeggedRobotCfgPPO
32
+
33
+
34
+ class H1WalkingCfg(LeggedRobotCfg):
35
+ """
36
+ Configuration class for the H1 humanoid robot.
37
+ """
38
+ class env(LeggedRobotCfg.env):
39
+ # change the observation dim
40
+ num_actions = 19
41
+ frame_stack = 1
42
+ c_frame_stack = 3
43
+ command_dim = 3
44
+ num_single_obs = 3 * num_actions + 6 + command_dim # see `obs_buf = torch.cat(...)` for details
45
+ num_observations = int(frame_stack * num_single_obs)
46
+ single_num_privileged_obs = 4 * num_actions + 25
47
+ num_privileged_obs = int(c_frame_stack * single_num_privileged_obs)
48
+ # num_actions = 12
49
+
50
+ num_envs = 4096
51
+ episode_length_s = 24 # episode length in seconds
52
+ use_ref_actions = False
53
+
54
+ class safety:
55
+ # safety factors
56
+ pos_limit = 1.0
57
+ vel_limit = 1.0
58
+ torque_limit = 0.85
59
+
60
+ class asset(LeggedRobotCfg.asset):
61
+ file = '{LEGGED_GYM_ROOT_DIR}/resources/robots/h1/urdf/h1_wrist.urdf'
62
+
63
+ name = "h1"
64
+ foot_name = "ankle"
65
+ knee_name = "knee"
66
+ elbow_name = "elbow"
67
+ torso_name = "torso"
68
+
69
+ terminate_after_contacts_on = ['pelvis', 'torso', 'shoulder', 'elbow']
70
+ penalize_contacts_on = ["hip", 'knee']
71
+ self_collisions = 0 # 1 to disable, 0 to enable...bitwise filter
72
+ flip_visual_attachments = False
73
+ replace_cylinder_with_capsule = False # replace collision cylinders with capsules, leads to faster/more stable simulation
74
+ fix_base_link = False
75
+
76
+ class terrain(LeggedRobotCfg.terrain):
77
+ # mesh_type = 'plane'
78
+ # curriculum = False
79
+ mesh_type = 'trimesh'
80
+ curriculum = True
81
+
82
+ # rough terrain only:
83
+ measure_heights = False
84
+ static_friction = 0.6
85
+ dynamic_friction = 0.6
86
+ terrain_length = 8.
87
+ terrain_width = 8.
88
+ num_rows = 20 # number of terrain rows (levels)
89
+ num_cols = 20 # number of terrain cols (types)
90
+ max_init_terrain_level = 10 # starting curriculum state
91
+ # plane; obstacles; uniform; slope_up; slope_down, stair_up, stair_down
92
+ terrain_proportions = [0.2, 0.2, 0.4, 0.1, 0.1, 0, 0]
93
+ restitution = 0.
94
+
95
+ class noise:
96
+ add_noise = True
97
+ noise_level = 0.6 # scales other values
98
+
99
+ class noise_scales:
100
+ dof_pos = 0.05
101
+ dof_vel = 0.5
102
+ ang_vel = 0.1
103
+ lin_vel = 0.05
104
+ quat = 0.03
105
+ height_measurements = 0.1
106
+
107
+ class init_state(LeggedRobotCfg.init_state):
108
+ pos = [0.0, 0.0, 1.0] # x,y,z [m]
109
+
110
+ default_joint_angles = { # = target angles [rad] when action = 0.0
111
+ 'left_hip_yaw_joint' : 0. ,
112
+ 'left_hip_roll_joint' : 0,
113
+ 'left_hip_pitch_joint' : -0.4,
114
+ 'left_knee_joint' : 0.8,
115
+ 'left_ankle_joint' : -0.4,
116
+ 'right_hip_yaw_joint' : 0.,
117
+ 'right_hip_roll_joint' : 0,
118
+ 'right_hip_pitch_joint' : -0.4,
119
+ 'right_knee_joint' : 0.8,
120
+ 'right_ankle_joint' : -0.4,
121
+ 'torso_joint' : 0.,
122
+ 'left_shoulder_pitch_joint' : 0.,
123
+ 'left_shoulder_roll_joint' : 0,
124
+ 'left_shoulder_yaw_joint' : 0.,
125
+ 'left_elbow_joint' : 0.,
126
+ 'right_shoulder_pitch_joint' : 0.,
127
+ 'right_shoulder_roll_joint' : 0.0,
128
+ 'right_shoulder_yaw_joint' : 0.,
129
+ 'right_elbow_joint' : 0.,
130
+ }
131
+
132
+ class control(LeggedRobotCfg.control):
133
+ control_type = 'P'
134
+ # PD Drive parameters:
135
+ stiffness = {'hip_yaw': 200,
136
+ 'hip_roll': 200,
137
+ 'hip_pitch': 200,
138
+ 'knee': 300,
139
+ 'ankle': 40,
140
+ 'torso': 300,
141
+ 'shoulder': 100,
142
+ "elbow":100,
143
+ } # [N*m/rad]
144
+ damping = { 'hip_yaw': 5,
145
+ 'hip_roll': 5,
146
+ 'hip_pitch': 5,
147
+ 'knee': 6,
148
+ 'ankle': 2,
149
+ 'torso': 6,
150
+ 'shoulder': 2,
151
+ "elbow":2,
152
+ } # [N*m/rad] # [N*m*s/rad]
153
+ # action scale: target angle = actionScale * action + defaultAngle
154
+ action_scale = 0.25
155
+ # decimation: Number of control action updates @ sim DT per policy DT
156
+ decimation = 10 # 100hz
157
+
158
+ class sim(LeggedRobotCfg.sim):
159
+ dt = 0.001 # 1000 Hz
160
+ substeps = 1 # 2
161
+ up_axis = 1 # 0 is y, 1 is z
162
+
163
+ class physx(LeggedRobotCfg.sim.physx):
164
+ num_threads = 10
165
+ solver_type = 1 # 0: pgs, 1: tgs
166
+ num_position_iterations = 4
167
+ num_velocity_iterations = 0
168
+ contact_offset = 0.01 # [m]
169
+ rest_offset = 0.0 # [m]
170
+ bounce_threshold_velocity = 0.1 # [m/s]
171
+ max_depenetration_velocity = 1.0
172
+ max_gpu_contact_pairs = 2**23 # 2**24 -> needed for 8000 envs and more
173
+ default_buffer_size_multiplier = 5
174
+ # 0: never, 1: last sub-step, 2: all sub-steps (default=2)
175
+ contact_collection = 2
176
+
177
+ class domain_rand:
178
+ randomize_friction = True
179
+ friction_range = [0.1, 2.0]
180
+ randomize_base_mass = True
181
+ added_mass_range = [-5., 5.]
182
+ push_robots = True
183
+ push_interval_s = 4
184
+ max_push_vel_xy = 0.2
185
+ max_push_ang_vel = 0.4
186
+ dynamic_randomization = 0.02
187
+
188
+ class commands(LeggedRobotCfg.commands):
189
+ # Vers: lin_vel_x, lin_vel_y, ang_vel_yaw, heading (in heading mode ang_vel_yaw is recomputed from heading error)
190
+ num_commands = 4
191
+ resampling_time = 8. # time before command are changed[s]
192
+ heading_command = True # if true: compute ang vel command from heading error
193
+ curriculum = True # if true: curriculum update of commands
194
+
195
+ class ranges:
196
+ lin_vel_x = [-1.0, 2.0] # min max [m/s]
197
+ lin_vel_y = [-1.0, 1.0] # min max [m/s]
198
+ ang_vel_yaw = [-1.0, 1.0] # min max [rad/s]
199
+ heading = [-3.14, 3.14]
200
+
201
+ class rewards:
202
+ base_height_target = 0.89
203
+ min_dist = 0.2
204
+ max_dist = 0.5
205
+ # put some settings here for LLM parameter tuning
206
+ target_joint_pos_scale = 0.17 # rad
207
+ target_feet_height = 0.06 # m
208
+ cycle_time = 0.64 # sec
209
+ # if true negative total rewards are clipped at zero (avoids early termination problems)
210
+ only_positive_rewards = True
211
+ # tracking reward = exp(error*sigma)
212
+ tracking_sigma = 5
213
+ max_contact_force = 700 # forces above this value are penalized
214
+
215
+ class scales:
216
+ # reference motion tracking
217
+ joint_pos = 1.6
218
+ feet_clearance = 1. * 2
219
+ feet_contact_number = 1.2 * 2
220
+ # gait
221
+ feet_air_time = 1.
222
+ foot_slip = -0.05
223
+ feet_distance = 0.2
224
+ knee_distance = 0.2
225
+ # elbow_distance = 0.4
226
+ # elbow_torso_distance = 0.4
227
+ # contact
228
+ feet_contact_forces = -0.01
229
+ # vel tracking
230
+ tracking_lin_vel = 1.2 * 2
231
+ tracking_ang_vel = 1.1 * 2
232
+ vel_mismatch_exp = 0.5 # lin_z; ang x,y
233
+ low_speed = 0.2
234
+ track_vel_hard = 0.5 * 2
235
+ # stand_still = -0.5
236
+ # base pos
237
+ default_joint_pos = 0.5
238
+ upper_body_pos = 0.5
239
+ orientation = 1.
240
+ base_height = 0.2
241
+ base_acc = 0.2
242
+ # energy
243
+ action_smoothness = -0.002
244
+ torques = -1e-5
245
+ dof_vel = -5e-4
246
+ dof_acc = -1e-7
247
+ collision = -1.
248
+
249
+ class normalization:
250
+ class obs_scales:
251
+ lin_vel = 2.
252
+ ang_vel = 1.
253
+ dof_pos = 1.
254
+ dof_vel = 0.05
255
+ quat = 1.
256
+ height_measurements = 5.0
257
+ clip_observations = 18.
258
+ clip_actions = 18.
259
+
260
+
261
+ class H1WalkingCfgPPO(LeggedRobotCfgPPO):
262
+ seed = 5
263
+ runner_class_name = 'OnPolicyRunner' # DWLOnPolicyRunner
264
+
265
+ class policy:
266
+ init_noise_std = 1.0
267
+ actor_hidden_dims = [512, 256, 128]
268
+ critic_hidden_dims = [768, 256, 128]
269
+
270
+ class algorithm(LeggedRobotCfgPPO.algorithm):
271
+ entropy_coef = 0.001
272
+ learning_rate = 1e-5
273
+ num_learning_epochs = 2
274
+ gamma = 0.994
275
+ lam = 0.9
276
+ num_mini_batches = 4
277
+
278
+ class runner:
279
+ policy_class_name = 'ActorCritic'
280
+ algorithm_class_name = 'PPO'
281
+ num_steps_per_env = 60 # per iteration
282
+ max_iterations = 15001 # 3001 # number of policy updates
283
+
284
+ # logging
285
+ save_interval = 100 # check for potential saves every this many iterations
286
+ experiment_name = 'h1_walking'
287
+ run_name = ''
288
+ # load and resume
289
+ resume = False
290
+ load_run = -1 # -1 = last run
291
+ checkpoint = -1 # -1 = last saved model
292
+ resume_path = None # updated from load_run and ckpt
skill_policies/h1_walking/0000_best/model_15001.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c530e2b51d7e7da5af74dc1c96ba8afd9c9649a5fe4c5a2622fe4a9b5dac2349
3
+ size 7992305