forked from NVlabs/ProtoMotions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathg1.py
More file actions
208 lines (196 loc) · 7.35 KB
/
Copy pathg1.py
File metadata and controls
208 lines (196 loc) · 7.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# SPDX-FileCopyrightText: Copyright (c) 2025 The ProtoMotions Developers
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from protomotions.robot_configs.base import (
RobotConfig,
RobotAssetConfig,
ControlConfig,
ControlType,
SimulatorParams,
)
from protomotions.simulator.isaacgym.config import (
IsaacGymSimParams,
IsaacGymPhysXParams,
)
from protomotions.simulator.isaaclab.config import (
IsaacLabSimParams,
IsaacLabPhysXParams,
)
from protomotions.simulator.genesis.config import GenesisSimParams
from protomotions.simulator.newton.config import NewtonSimParams
from protomotions.components.pose_lib import ControlInfo
from typing import List, Dict
from dataclasses import dataclass, field
# Parameters from BeyondMimic (https://github.com/HybridRobotics/whole_body_tracking/blob/main/source/whole_body_tracking/whole_body_tracking/robots/g1.py)
ARMATURE_5020 = 0.003609725
ARMATURE_7520_14 = 0.010177520
ARMATURE_7520_22 = 0.025101925
ARMATURE_4010 = 0.00425
NATURAL_FREQ = 10 * 2.0 * 3.1415926535 # 10Hz
DAMPING_RATIO = 2.0
STIFFNESS_5020 = ARMATURE_5020 * NATURAL_FREQ**2
STIFFNESS_7520_14 = ARMATURE_7520_14 * NATURAL_FREQ**2
STIFFNESS_7520_22 = ARMATURE_7520_22 * NATURAL_FREQ**2
STIFFNESS_4010 = ARMATURE_4010 * NATURAL_FREQ**2
DAMPING_5020 = 2.0 * DAMPING_RATIO * ARMATURE_5020 * NATURAL_FREQ
DAMPING_7520_14 = 2.0 * DAMPING_RATIO * ARMATURE_7520_14 * NATURAL_FREQ
DAMPING_7520_22 = 2.0 * DAMPING_RATIO * ARMATURE_7520_22 * NATURAL_FREQ
DAMPING_4010 = 2.0 * DAMPING_RATIO * ARMATURE_4010 * NATURAL_FREQ
@dataclass
class G1RobotConfig(RobotConfig):
common_naming_to_robot_body_names: Dict[str, List[str]] = field(
default_factory=lambda: {
"all_left_foot_bodies": ["left_ankle_roll_link"],
"all_right_foot_bodies": ["right_ankle_roll_link"],
"all_left_hand_bodies": ["left_rubber_hand"],
"all_right_hand_bodies": ["right_rubber_hand"],
"head_body_name": ["head"],
"torso_body_name": ["torso_link"],
}
)
trackable_bodies_subset: List[str] = field(
default_factory=lambda: [
"torso_link",
"head",
"right_ankle_roll_link",
"left_ankle_roll_link",
"left_rubber_hand",
"right_rubber_hand",
]
)
default_root_height: float = 0.8
asset: RobotAssetConfig = field(
default_factory=lambda: RobotAssetConfig(
asset_file_name="mjcf/g1_bm_box_feet.xml",
usd_asset_file_name="usd/g1_bm_box_feet/g1_bm_box_feet.usda",
usd_bodies_root_prim_path="/World/envs/env_.*/Robot/pelvis/",
replace_cylinder_with_capsule=True,
thickness=0.01,
max_angular_velocity=1000.0,
max_linear_velocity=1000.0,
density=0.001,
angular_damping=0.0,
linear_damping=0.0,
)
)
control: ControlConfig = field(
default_factory=lambda: ControlConfig(
control_type=ControlType.BUILT_IN_PD,
override_control_info={
".*_hip_(pitch|yaw)_joint": ControlInfo(
stiffness=STIFFNESS_7520_14,
damping=DAMPING_7520_14,
effort_limit=88,
velocity_limit=32,
armature=ARMATURE_7520_14,
),
".*_hip_roll_joint": ControlInfo(
stiffness=STIFFNESS_7520_22,
damping=DAMPING_7520_22,
effort_limit=139,
velocity_limit=20,
armature=ARMATURE_7520_22,
),
".*_knee_joint": ControlInfo(
stiffness=STIFFNESS_7520_22,
damping=DAMPING_7520_22,
effort_limit=139,
velocity_limit=20,
armature=ARMATURE_7520_22,
),
".*_ankle_.*": ControlInfo(
stiffness=2 * STIFFNESS_5020,
damping=2 * DAMPING_5020,
effort_limit=50,
velocity_limit=37,
armature=2 * ARMATURE_5020,
),
"waist_yaw_joint": ControlInfo(
stiffness=STIFFNESS_7520_14,
damping=DAMPING_7520_14,
effort_limit=88,
velocity_limit=32,
armature=ARMATURE_7520_14,
),
"waist_(roll|pitch)_joint": ControlInfo(
stiffness=2.0 * STIFFNESS_5020,
damping=2.0 * DAMPING_5020,
effort_limit=50,
velocity_limit=37,
armature=2.0 * ARMATURE_5020,
),
".*_(shoulder|elbow)_.*": ControlInfo(
stiffness=STIFFNESS_5020,
damping=DAMPING_5020,
effort_limit=25,
velocity_limit=37,
armature=ARMATURE_5020,
),
".*_wrist_roll_joint": ControlInfo(
stiffness=STIFFNESS_5020,
damping=DAMPING_5020,
effort_limit=25,
velocity_limit=37,
armature=ARMATURE_5020,
),
".*_wrist_pitch_joint": ControlInfo(
stiffness=STIFFNESS_4010,
damping=DAMPING_4010,
effort_limit=5,
velocity_limit=22,
armature=ARMATURE_4010,
),
".*_wrist_yaw_joint": ControlInfo(
stiffness=STIFFNESS_4010,
damping=DAMPING_4010,
effort_limit=5,
velocity_limit=22,
armature=ARMATURE_4010,
),
},
)
)
simulation_params: SimulatorParams = field(
default_factory=lambda: SimulatorParams(
isaacgym=IsaacGymSimParams(
fps=100,
decimation=2,
substeps=2,
physx=IsaacGymPhysXParams(
num_position_iterations=8,
num_velocity_iterations=4,
max_depenetration_velocity=1,
),
),
isaaclab=IsaacLabSimParams(
fps=200,
decimation=4,
physx=IsaacLabPhysXParams(
num_position_iterations=8,
num_velocity_iterations=4,
max_depenetration_velocity=1,
),
),
genesis=GenesisSimParams(
fps=100,
decimation=2,
substeps=2,
),
newton=NewtonSimParams(
fps=200,
decimation=4,
),
)
)