tinysim 0.0.2__py3-none-any.whl → 0.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tinysim/frogger/tk.py +6 -0
- tinysim/topdown_driving/widget.py +3 -4
- tinysim-0.0.4.dist-info/METADATA +80 -0
- tinysim-0.0.4.dist-info/RECORD +119 -0
- {tinysim-0.0.2.dist-info → tinysim-0.0.4.dist-info}/top_level.txt +1 -0
- tinysim_mujoco/__init__.py +0 -0
- tinysim_mujoco/gl_viewer.py +88 -0
- tinysim_mujoco/manipulation/__init__.py +38 -0
- tinysim_mujoco/manipulation/xmls/assets/d405.stl +0 -0
- tinysim_mujoco/manipulation/xmls/assets/finger_0.obj +883 -0
- tinysim_mujoco/manipulation/xmls/assets/finger_1.obj +657 -0
- tinysim_mujoco/manipulation/xmls/assets/hand.stl +0 -0
- tinysim_mujoco/manipulation/xmls/assets/hand_0.obj +116 -0
- tinysim_mujoco/manipulation/xmls/assets/hand_1.obj +1204 -0
- tinysim_mujoco/manipulation/xmls/assets/hand_2.obj +5751 -0
- tinysim_mujoco/manipulation/xmls/assets/hand_3.obj +8898 -0
- tinysim_mujoco/manipulation/xmls/assets/hand_4.obj +1574 -0
- tinysim_mujoco/manipulation/xmls/assets/link0.stl +0 -0
- tinysim_mujoco/manipulation/xmls/assets/link0_0.obj +2962 -0
- tinysim_mujoco/manipulation/xmls/assets/link0_1.obj +1084 -0
- tinysim_mujoco/manipulation/xmls/assets/link0_10.obj +3320 -0
- tinysim_mujoco/manipulation/xmls/assets/link0_11.obj +233 -0
- tinysim_mujoco/manipulation/xmls/assets/link0_2.obj +5717 -0
- tinysim_mujoco/manipulation/xmls/assets/link0_3.obj +496 -0
- tinysim_mujoco/manipulation/xmls/assets/link0_4.obj +2157 -0
- tinysim_mujoco/manipulation/xmls/assets/link0_5.obj +184 -0
- tinysim_mujoco/manipulation/xmls/assets/link0_7.obj +313 -0
- tinysim_mujoco/manipulation/xmls/assets/link0_8.obj +31361 -0
- tinysim_mujoco/manipulation/xmls/assets/link0_9.obj +1054 -0
- tinysim_mujoco/manipulation/xmls/assets/link1.obj +31140 -0
- tinysim_mujoco/manipulation/xmls/assets/link1.stl +0 -0
- tinysim_mujoco/manipulation/xmls/assets/link2.obj +31586 -0
- tinysim_mujoco/manipulation/xmls/assets/link2.stl +0 -0
- tinysim_mujoco/manipulation/xmls/assets/link3.stl +0 -0
- tinysim_mujoco/manipulation/xmls/assets/link3_0.obj +29423 -0
- tinysim_mujoco/manipulation/xmls/assets/link3_1.obj +665 -0
- tinysim_mujoco/manipulation/xmls/assets/link3_2.obj +852 -0
- tinysim_mujoco/manipulation/xmls/assets/link3_3.obj +4591 -0
- tinysim_mujoco/manipulation/xmls/assets/link4.stl +0 -0
- tinysim_mujoco/manipulation/xmls/assets/link4_0.obj +853 -0
- tinysim_mujoco/manipulation/xmls/assets/link4_1.obj +30330 -0
- tinysim_mujoco/manipulation/xmls/assets/link4_2.obj +4555 -0
- tinysim_mujoco/manipulation/xmls/assets/link4_3.obj +680 -0
- tinysim_mujoco/manipulation/xmls/assets/link5_0.obj +8222 -0
- tinysim_mujoco/manipulation/xmls/assets/link5_1.obj +763 -0
- tinysim_mujoco/manipulation/xmls/assets/link5_2.obj +36907 -0
- tinysim_mujoco/manipulation/xmls/assets/link5_collision_0.obj +189 -0
- tinysim_mujoco/manipulation/xmls/assets/link5_collision_1.obj +120 -0
- tinysim_mujoco/manipulation/xmls/assets/link5_collision_2.obj +189 -0
- tinysim_mujoco/manipulation/xmls/assets/link6.stl +0 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_0.obj +1748 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_1.obj +304 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_10.obj +3875 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_11.obj +378 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_12.obj +51 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_13.obj +51 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_14.obj +4459 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_15.obj +6967 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_16.obj +35547 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_2.obj +128 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_3.obj +133 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_4.obj +152 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_5.obj +132 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_6.obj +139 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_7.obj +57 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_8.obj +115 -0
- tinysim_mujoco/manipulation/xmls/assets/link6_9.obj +204 -0
- tinysim_mujoco/manipulation/xmls/assets/link7.stl +0 -0
- tinysim_mujoco/manipulation/xmls/assets/link7_0.obj +13541 -0
- tinysim_mujoco/manipulation/xmls/assets/link7_1.obj +1238 -0
- tinysim_mujoco/manipulation/xmls/assets/link7_2.obj +2080 -0
- tinysim_mujoco/manipulation/xmls/assets/link7_3.obj +1261 -0
- tinysim_mujoco/manipulation/xmls/assets/link7_4.obj +879 -0
- tinysim_mujoco/manipulation/xmls/assets/link7_5.obj +2279 -0
- tinysim_mujoco/manipulation/xmls/assets/link7_6.obj +1029 -0
- tinysim_mujoco/manipulation/xmls/assets/link7_7.obj +7767 -0
- tinysim_mujoco/manipulation/xmls/panda.xml +280 -0
- tinysim_mujoco/manipulation/xmls/scene.xml +23 -0
- tinysim_mujoco/manipulation/xmls/table.xml +37 -0
- tinysim_mujoco/notebook_viewer.py +33 -0
- tinysim_mujoco/unitree_a1/__init__.py +282 -0
- tinysim_mujoco/unitree_a1/unitree_a1/CHANGELOG.md +6 -0
- tinysim_mujoco/unitree_a1/unitree_a1/LICENSE +29 -0
- tinysim_mujoco/unitree_a1/unitree_a1/README.md +41 -0
- tinysim_mujoco/unitree_a1/unitree_a1/a1.xml +206 -0
- tinysim_mujoco/unitree_a1/unitree_a1/assets/calf.obj +51549 -0
- tinysim_mujoco/unitree_a1/unitree_a1/assets/hip.obj +19893 -0
- tinysim_mujoco/unitree_a1/unitree_a1/assets/thigh.obj +32857 -0
- tinysim_mujoco/unitree_a1/unitree_a1/assets/thigh_mirror.obj +34036 -0
- tinysim_mujoco/unitree_a1/unitree_a1/assets/trunk.obj +74108 -0
- tinysim_mujoco/unitree_a1/unitree_a1/scene.xml +22 -0
- tinysim_warp/cart_pole/__init__.py +2 -2
- tinysim_warp/quadruped/__init__.py +2 -2
- tinysim_warp/simple_quadruped/__init__.py +2 -2
- tinysim-0.0.2.dist-info/METADATA +0 -56
- tinysim-0.0.2.dist-info/RECORD +0 -33
- {tinysim-0.0.2.dist-info → tinysim-0.0.4.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
<mujoco model="panda">
|
|
2
|
+
<compiler angle="radian" meshdir="assets" autolimits="true"/>
|
|
3
|
+
|
|
4
|
+
<default>
|
|
5
|
+
<default class="panda">
|
|
6
|
+
<material specular="0.5" shininess="0.25"/>
|
|
7
|
+
<joint range="-2.8973 2.8973"/>
|
|
8
|
+
<default class="finger">
|
|
9
|
+
<joint axis="0 1 0" type="slide" range="0 0.04"/>
|
|
10
|
+
</default>
|
|
11
|
+
|
|
12
|
+
<default class="visual">
|
|
13
|
+
<geom type="mesh" contype="0" conaffinity="0" group="2"/>
|
|
14
|
+
</default>
|
|
15
|
+
<default class="collision">
|
|
16
|
+
<geom type="mesh" group="3"/>
|
|
17
|
+
<default class="fingertip_collision_1">
|
|
18
|
+
<geom type="box" size="0.011 0.0075 0.01" pos="0 0.0185 0.011"/>
|
|
19
|
+
</default>
|
|
20
|
+
<default class="fingertip_collision_2">
|
|
21
|
+
<geom type="box" size="0.011 0.0044 0.0019" pos="0 0.0068 0.0022"/>
|
|
22
|
+
</default>
|
|
23
|
+
<default class="fingertip_collision_3">
|
|
24
|
+
<geom type="box" size="0.00875 0.0035 0.01175" pos="0 0.0159 0.02835" quat="1 0.25 0 0"/>
|
|
25
|
+
</default>
|
|
26
|
+
<default class="fingertip_pad_collision_1">
|
|
27
|
+
<geom type="box" size="0.0085 0.004 0.0085" pos="0 0.0055 0.0445"/>
|
|
28
|
+
</default>
|
|
29
|
+
<default class="fingertip_pad_collision_2">
|
|
30
|
+
<geom type="box" size="0.003 0.002 0.003" pos="0.0055 0.002 0.05"/>
|
|
31
|
+
</default>
|
|
32
|
+
<default class="fingertip_pad_collision_3">
|
|
33
|
+
<geom type="box" size="0.003 0.002 0.003" pos="-0.0055 0.002 0.05"/>
|
|
34
|
+
</default>
|
|
35
|
+
<default class="fingertip_pad_collision_4">
|
|
36
|
+
<geom type="box" size="0.003 0.002 0.0035" pos="0.0055 0.002 0.0395"/>
|
|
37
|
+
</default>
|
|
38
|
+
<default class="fingertip_pad_collision_5">
|
|
39
|
+
<geom type="box" size="0.003 0.002 0.0035" pos="-0.0055 0.002 0.0395"/>
|
|
40
|
+
</default>
|
|
41
|
+
<default class="fingertip_pad_collision_6">
|
|
42
|
+
<geom type="box" size="0.00875 0.0076 0.00825" pos="0 0.00758 0.04525"/>
|
|
43
|
+
</default>
|
|
44
|
+
</default>
|
|
45
|
+
</default>
|
|
46
|
+
</default>
|
|
47
|
+
|
|
48
|
+
<asset>
|
|
49
|
+
<material class="panda" name="white" rgba="1 1 1 1"/>
|
|
50
|
+
<material class="panda" name="off_white" rgba="0.901961 0.921569 0.929412 1"/>
|
|
51
|
+
<material class="panda" name="black" rgba="0.25 0.25 0.25 1"/>
|
|
52
|
+
<material class="panda" name="green" rgba="0 1 0 1"/>
|
|
53
|
+
<material class="panda" name="light_blue" rgba="0.039216 0.541176 0.780392 1"/>
|
|
54
|
+
|
|
55
|
+
<!-- Collision meshes -->
|
|
56
|
+
<mesh name="link0_collision" file="link0.stl"/>
|
|
57
|
+
<mesh name="link1_collision" file="link1.stl"/>
|
|
58
|
+
<mesh name="link2_collision" file="link2.stl"/>
|
|
59
|
+
<mesh name="link3_collision" file="link3.stl"/>
|
|
60
|
+
<mesh name="link4_collision" file="link4.stl"/>
|
|
61
|
+
<mesh name="link5_collision_0" file="link5_collision_0.obj"/>
|
|
62
|
+
<mesh name="link5_collision_1" file="link5_collision_1.obj"/>
|
|
63
|
+
<mesh name="link5_collision_2" file="link5_collision_2.obj"/>
|
|
64
|
+
<mesh name="link6_collision" file="link6.stl"/>
|
|
65
|
+
<mesh name="link7_collision" file="link7.stl"/>
|
|
66
|
+
<mesh name="hand_collision" file="hand.stl"/>
|
|
67
|
+
|
|
68
|
+
<!-- Visual meshes -->
|
|
69
|
+
<mesh file="link0_0.obj"/>
|
|
70
|
+
<mesh file="link0_1.obj"/>
|
|
71
|
+
<mesh file="link0_2.obj"/>
|
|
72
|
+
<mesh file="link0_3.obj"/>
|
|
73
|
+
<mesh file="link0_4.obj"/>
|
|
74
|
+
<mesh file="link0_5.obj"/>
|
|
75
|
+
<mesh file="link0_7.obj"/>
|
|
76
|
+
<mesh file="link0_8.obj"/>
|
|
77
|
+
<mesh file="link0_9.obj"/>
|
|
78
|
+
<mesh file="link0_10.obj"/>
|
|
79
|
+
<mesh file="link0_11.obj"/>
|
|
80
|
+
<mesh file="link1.obj"/>
|
|
81
|
+
<mesh file="link2.obj"/>
|
|
82
|
+
<mesh file="link3_0.obj"/>
|
|
83
|
+
<mesh file="link3_1.obj"/>
|
|
84
|
+
<mesh file="link3_2.obj"/>
|
|
85
|
+
<mesh file="link3_3.obj"/>
|
|
86
|
+
<mesh file="link4_0.obj"/>
|
|
87
|
+
<mesh file="link4_1.obj"/>
|
|
88
|
+
<mesh file="link4_2.obj"/>
|
|
89
|
+
<mesh file="link4_3.obj"/>
|
|
90
|
+
<mesh file="link5_0.obj"/>
|
|
91
|
+
<mesh file="link5_1.obj"/>
|
|
92
|
+
<mesh file="link5_2.obj"/>
|
|
93
|
+
<mesh file="link6_0.obj"/>
|
|
94
|
+
<mesh file="link6_1.obj"/>
|
|
95
|
+
<mesh file="link6_2.obj"/>
|
|
96
|
+
<mesh file="link6_3.obj"/>
|
|
97
|
+
<mesh file="link6_4.obj"/>
|
|
98
|
+
<mesh file="link6_5.obj"/>
|
|
99
|
+
<mesh file="link6_6.obj"/>
|
|
100
|
+
<mesh file="link6_7.obj"/>
|
|
101
|
+
<mesh file="link6_8.obj"/>
|
|
102
|
+
<mesh file="link6_9.obj"/>
|
|
103
|
+
<mesh file="link6_10.obj"/>
|
|
104
|
+
<mesh file="link6_11.obj"/>
|
|
105
|
+
<mesh file="link6_12.obj"/>
|
|
106
|
+
<mesh file="link6_13.obj"/>
|
|
107
|
+
<mesh file="link6_14.obj"/>
|
|
108
|
+
<mesh file="link6_15.obj"/>
|
|
109
|
+
<mesh file="link6_16.obj"/>
|
|
110
|
+
<mesh file="link7_0.obj"/>
|
|
111
|
+
<mesh file="link7_1.obj"/>
|
|
112
|
+
<mesh file="link7_2.obj"/>
|
|
113
|
+
<mesh file="link7_3.obj"/>
|
|
114
|
+
<mesh file="link7_4.obj"/>
|
|
115
|
+
<mesh file="link7_5.obj"/>
|
|
116
|
+
<mesh file="link7_6.obj"/>
|
|
117
|
+
<mesh file="link7_7.obj"/>
|
|
118
|
+
<mesh file="hand_0.obj"/>
|
|
119
|
+
<mesh file="hand_1.obj"/>
|
|
120
|
+
<mesh file="hand_2.obj"/>
|
|
121
|
+
<mesh file="hand_3.obj"/>
|
|
122
|
+
<mesh file="hand_4.obj"/>
|
|
123
|
+
<mesh file="finger_0.obj"/>
|
|
124
|
+
<mesh file="finger_1.obj"/>
|
|
125
|
+
<mesh file="d405.stl"/>
|
|
126
|
+
</asset>
|
|
127
|
+
|
|
128
|
+
<worldbody>
|
|
129
|
+
<light name="top" pos="0 0 2" mode="trackcom"/>
|
|
130
|
+
<camera name="front_cam" pos="1.1 0 0.5" xyaxes="0 1 0 -0.4 0 0.7"/>
|
|
131
|
+
<body name="link0" childclass="panda">
|
|
132
|
+
<inertial mass="0.629769" pos="0 0 0"
|
|
133
|
+
fullinertia="0.00315 0.00388 0.004285 8.2904e-7 0.00015 8.2299e-6"/>
|
|
134
|
+
<geom mesh="link0_0" material="off_white" class="visual"/>
|
|
135
|
+
<geom mesh="link0_1" material="black" class="visual"/>
|
|
136
|
+
<geom mesh="link0_2" material="off_white" class="visual"/>
|
|
137
|
+
<geom mesh="link0_3" material="black" class="visual"/>
|
|
138
|
+
<geom mesh="link0_4" material="off_white" class="visual"/>
|
|
139
|
+
<geom mesh="link0_5" material="black" class="visual"/>
|
|
140
|
+
<geom mesh="link0_7" material="white" class="visual"/>
|
|
141
|
+
<geom mesh="link0_8" material="white" class="visual"/>
|
|
142
|
+
<geom mesh="link0_9" material="black" class="visual"/>
|
|
143
|
+
<geom mesh="link0_10" material="off_white" class="visual"/>
|
|
144
|
+
<geom mesh="link0_11" material="white" class="visual"/>
|
|
145
|
+
<geom mesh="link0_collision" class="collision"/>
|
|
146
|
+
<body name="link1" pos="0 0 0.333">
|
|
147
|
+
<inertial mass="4.970684" pos="0.003875 0.002081 -0.04762"
|
|
148
|
+
fullinertia="0.70337 0.70661 0.0091170 -0.00013900 0.0067720 0.019169"/>
|
|
149
|
+
<joint name="joint1" range="-2.8973 2.8973"/>
|
|
150
|
+
<geom material="white" mesh="link1" class="visual"/>
|
|
151
|
+
<geom mesh="link1_collision" class="collision"/>
|
|
152
|
+
<body name="link2" quat="1 -1 0 0">
|
|
153
|
+
<inertial mass="0.646926" pos="-0.003141 -0.02872 0.003495"
|
|
154
|
+
fullinertia="0.0079620 2.8110e-2 2.5995e-2 -3.925e-3 1.0254e-2 7.04e-4"/>
|
|
155
|
+
<joint name="joint2" range="-1.7628 1.7628"/>
|
|
156
|
+
<geom material="white" mesh="link2" class="visual"/>
|
|
157
|
+
<geom mesh="link2_collision" class="collision"/>
|
|
158
|
+
<body name="link3" pos="0 -0.316 0" quat="1 1 0 0">
|
|
159
|
+
<joint name="joint3" range="-2.8973 2.8973"/>
|
|
160
|
+
<inertial mass="3.228604" pos="2.7518e-2 3.9252e-2 -6.6502e-2"
|
|
161
|
+
fullinertia="3.7242e-2 3.6155e-2 1.083e-2 -4.761e-3 -1.1396e-2 -1.2805e-2"/>
|
|
162
|
+
<geom mesh="link3_0" material="white" class="visual"/>
|
|
163
|
+
<geom mesh="link3_1" material="white" class="visual"/>
|
|
164
|
+
<geom mesh="link3_2" material="white" class="visual"/>
|
|
165
|
+
<geom mesh="link3_3" material="black" class="visual"/>
|
|
166
|
+
<geom mesh="link3_collision" class="collision"/>
|
|
167
|
+
<body name="link4" pos="0.0825 0 0" quat="1 1 0 0">
|
|
168
|
+
<inertial mass="3.587895" pos="-5.317e-2 1.04419e-1 2.7454e-2"
|
|
169
|
+
fullinertia="2.5853e-2 1.9552e-2 2.8323e-2 7.796e-3 -1.332e-3 8.641e-3"/>
|
|
170
|
+
<joint name="joint4" range="-3.0718 -0.0698"/>
|
|
171
|
+
<geom mesh="link4_0" material="white" class="visual"/>
|
|
172
|
+
<geom mesh="link4_1" material="white" class="visual"/>
|
|
173
|
+
<geom mesh="link4_2" material="black" class="visual"/>
|
|
174
|
+
<geom mesh="link4_3" material="white" class="visual"/>
|
|
175
|
+
<geom mesh="link4_collision" class="collision"/>
|
|
176
|
+
<body name="link5" pos="-0.0825 0.384 0" quat="1 -1 0 0">
|
|
177
|
+
<inertial mass="1.225946" pos="-1.1953e-2 4.1065e-2 -3.8437e-2"
|
|
178
|
+
fullinertia="3.5549e-2 2.9474e-2 8.627e-3 -2.117e-3 -4.037e-3 2.29e-4"/>
|
|
179
|
+
<joint name="joint5" range="-2.8973 2.8973"/>
|
|
180
|
+
<geom mesh="link5_0" material="black" class="visual"/>
|
|
181
|
+
<geom mesh="link5_1" material="white" class="visual"/>
|
|
182
|
+
<geom mesh="link5_2" material="white" class="visual"/>
|
|
183
|
+
<geom mesh="link5_collision_0" class="collision"/>
|
|
184
|
+
<geom mesh="link5_collision_1" class="collision"/>
|
|
185
|
+
<geom mesh="link5_collision_2" class="collision"/>
|
|
186
|
+
<body name="link6" quat="1 1 0 0">
|
|
187
|
+
<inertial mass="1.666555" pos="6.0149e-2 -1.4117e-2 -1.0517e-2"
|
|
188
|
+
fullinertia="1.964e-3 4.354e-3 5.433e-3 1.09e-4 -1.158e-3 3.41e-4"/>
|
|
189
|
+
<joint name="joint6" range="-0.0175 3.7525"/>
|
|
190
|
+
<geom mesh="link6_0" material="off_white" class="visual"/>
|
|
191
|
+
<geom mesh="link6_1" material="white" class="visual"/>
|
|
192
|
+
<geom mesh="link6_2" material="black" class="visual"/>
|
|
193
|
+
<geom mesh="link6_3" material="white" class="visual"/>
|
|
194
|
+
<geom mesh="link6_4" material="white" class="visual"/>
|
|
195
|
+
<geom mesh="link6_5" material="white" class="visual"/>
|
|
196
|
+
<geom mesh="link6_6" material="white" class="visual"/>
|
|
197
|
+
<geom mesh="link6_7" material="light_blue" class="visual"/>
|
|
198
|
+
<geom mesh="link6_8" material="light_blue" class="visual"/>
|
|
199
|
+
<geom mesh="link6_9" material="black" class="visual"/>
|
|
200
|
+
<geom mesh="link6_10" material="black" class="visual"/>
|
|
201
|
+
<geom mesh="link6_11" material="white" class="visual"/>
|
|
202
|
+
<geom mesh="link6_12" material="green" class="visual"/>
|
|
203
|
+
<geom mesh="link6_13" material="white" class="visual"/>
|
|
204
|
+
<geom mesh="link6_14" material="black" class="visual"/>
|
|
205
|
+
<geom mesh="link6_15" material="black" class="visual"/>
|
|
206
|
+
<geom mesh="link6_16" material="white" class="visual"/>
|
|
207
|
+
<geom mesh="link6_collision" class="collision"/>
|
|
208
|
+
<body name="link7" pos="0.088 0 0" quat="1 1 0 0">
|
|
209
|
+
<inertial mass="7.35522e-01" pos="1.0517e-2 -4.252e-3 6.1597e-2"
|
|
210
|
+
fullinertia="1.2516e-2 1.0027e-2 4.815e-3 -4.28e-4 -1.196e-3 -7.41e-4"/>
|
|
211
|
+
<joint name="joint7" range="-2.8973 2.8973"/>
|
|
212
|
+
<geom mesh="link7_0" material="white" class="visual"/>
|
|
213
|
+
<geom mesh="link7_1" material="black" class="visual"/>
|
|
214
|
+
<geom mesh="link7_2" material="black" class="visual"/>
|
|
215
|
+
<geom mesh="link7_3" material="black" class="visual"/>
|
|
216
|
+
<geom mesh="link7_4" material="black" class="visual"/>
|
|
217
|
+
<geom mesh="link7_5" material="black" class="visual"/>
|
|
218
|
+
<geom mesh="link7_6" material="black" class="visual"/>
|
|
219
|
+
<geom mesh="link7_7" material="white" class="visual"/>
|
|
220
|
+
<geom mesh="link7_collision" class="collision"/>
|
|
221
|
+
<body name="hand" pos="0 0 0.107" quat="0.9238795 0 0 -0.3826834">
|
|
222
|
+
<inertial mass="0.73" pos="-0.01 0 0.03" diaginertia="0.001 0.0025 0.0017"/>
|
|
223
|
+
<geom mesh="hand_0" material="off_white" class="visual"/>
|
|
224
|
+
<geom mesh="hand_1" material="black" class="visual"/>
|
|
225
|
+
<geom mesh="hand_2" material="black" class="visual"/>
|
|
226
|
+
<geom mesh="hand_3" material="white" class="visual"/>
|
|
227
|
+
<geom mesh="hand_4" material="off_white" class="visual"/>
|
|
228
|
+
<geom mesh="hand_collision" class="collision"/>
|
|
229
|
+
<geom name="hand_capsule_collision" type="capsule" class="collision" size="0.04 0.06" quat="1 1 0 0" pos="0 0 0.03"/>
|
|
230
|
+
<site name="gripper" pos="0 0 0.1"/>
|
|
231
|
+
<site name="tip" pos="0 0 0.1034"/>
|
|
232
|
+
<body name="camera_d405" pos="0.05 0.0 0.066021" quat="0.6644633 0.2418451 -0.2418451 -0.6644633">
|
|
233
|
+
<geom class="visual" mesh="d405"/>
|
|
234
|
+
<geom class="collision" type="box" size=".018 .018 .01" pos="0 0 -0.01" group="4"/>
|
|
235
|
+
<body name="camera_frame" pos="0 0 0" quat="0 0 0 1">
|
|
236
|
+
<camera name="camera_d405" pos="0 0 0" quat="0 1 0 0" resolution="1280 720"
|
|
237
|
+
sensorsize="0.003896 0.00214" focal="0.00193 0.00193"/>
|
|
238
|
+
</body>
|
|
239
|
+
</body>
|
|
240
|
+
<body name="left_finger" pos="0 0 0.0584">
|
|
241
|
+
<inertial mass="0.015" pos="0 0 0" diaginertia="2.375e-6 2.375e-6 7.5e-7"/>
|
|
242
|
+
<joint name="finger_joint1" class="finger" range="0 0.04"/>
|
|
243
|
+
<geom mesh="finger_0" material="off_white" class="visual"/>
|
|
244
|
+
<geom mesh="finger_1" material="black" class="visual"/>
|
|
245
|
+
<geom name="finger_left_collision" mesh="finger_0" class="collision"/>
|
|
246
|
+
<geom name="lf1_collision" class="fingertip_collision_1"/>
|
|
247
|
+
<geom name="lf2_collision" class="fingertip_collision_2"/>
|
|
248
|
+
<geom name="lf3_collision" class="fingertip_collision_3"/>
|
|
249
|
+
<geom name="lfp_collision" class="fingertip_pad_collision_6"/>
|
|
250
|
+
</body>
|
|
251
|
+
<body name="right_finger" pos="0 0 0.0584" quat="0 0 0 1">
|
|
252
|
+
<inertial mass="0.015" pos="0 0 0" diaginertia="2.375e-6 2.375e-6 7.5e-7"/>
|
|
253
|
+
<joint name="finger_joint2" class="finger" range="0 0.04"/>
|
|
254
|
+
<geom mesh="finger_0" material="off_white" class="visual"/>
|
|
255
|
+
<geom mesh="finger_1" material="black" class="visual"/>
|
|
256
|
+
<geom name="finger_right_collision" mesh="finger_0" class="collision"/>
|
|
257
|
+
<geom name="rf1_collision" class="fingertip_collision_1"/>
|
|
258
|
+
<geom name="rf2_collision" class="fingertip_collision_2"/>
|
|
259
|
+
<geom name="rf3_collision" class="fingertip_collision_3"/>
|
|
260
|
+
<geom name="rfp_collision" class="fingertip_pad_collision_6"/>
|
|
261
|
+
</body>
|
|
262
|
+
</body>
|
|
263
|
+
</body>
|
|
264
|
+
</body>
|
|
265
|
+
</body>
|
|
266
|
+
</body>
|
|
267
|
+
</body>
|
|
268
|
+
</body>
|
|
269
|
+
</body>
|
|
270
|
+
</body>
|
|
271
|
+
</worldbody>
|
|
272
|
+
|
|
273
|
+
<equality>
|
|
274
|
+
<joint joint1="finger_joint1" joint2="finger_joint2" solimp="0.95 0.99 0.001" solref="0.005 1"/>
|
|
275
|
+
</equality>
|
|
276
|
+
|
|
277
|
+
<contact>
|
|
278
|
+
<exclude body1="link0" body2="link1"/>
|
|
279
|
+
</contact>
|
|
280
|
+
</mujoco>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<mujoco model="panda scene">
|
|
2
|
+
<include file="panda.xml"/>
|
|
3
|
+
<include file="table.xml"/>
|
|
4
|
+
<statistic center="0 0 0.1" extent="0.8"/>
|
|
5
|
+
|
|
6
|
+
<visual>
|
|
7
|
+
<headlight diffuse="0.6 0.6 0.6" ambient="0.3 0.3 0.3" specular="0 0 0"/>
|
|
8
|
+
<rgba haze="0.15 0.25 0.35 1"/>
|
|
9
|
+
<global azimuth="120" elevation="-20"/>
|
|
10
|
+
</visual>
|
|
11
|
+
|
|
12
|
+
<asset>
|
|
13
|
+
<texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="512" height="3072"/>
|
|
14
|
+
<texture type="2d" name="groundplane" builtin="checker" mark="edge" rgb1="0.2 0.3 0.4" rgb2="0.1 0.2 0.3"
|
|
15
|
+
markrgb="0.8 0.8 0.8" width="300" height="300"/>
|
|
16
|
+
<material name="groundplane" texture="groundplane" texuniform="true" texrepeat="5 5" reflectance="0.2"/>
|
|
17
|
+
</asset>
|
|
18
|
+
|
|
19
|
+
<worldbody>
|
|
20
|
+
<light pos="0 0 1.5" dir="0 0 -1" directional="true"/>
|
|
21
|
+
<geom name="floor" size="0 0 0.05" type="plane" material="groundplane" contype="1" conaffinity="1"/>
|
|
22
|
+
</worldbody>
|
|
23
|
+
</mujoco>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<mujoco model="table">
|
|
2
|
+
<asset>
|
|
3
|
+
<material name="table_wood"
|
|
4
|
+
rgba="0.6 0.45 0.3 1"
|
|
5
|
+
specular="0.2"
|
|
6
|
+
shininess="0.2"/>
|
|
7
|
+
</asset>
|
|
8
|
+
|
|
9
|
+
<worldbody>
|
|
10
|
+
<body name="table" pos="0.55 0 0">
|
|
11
|
+
|
|
12
|
+
<geom name="table_top"
|
|
13
|
+
type="box"
|
|
14
|
+
size="0.25 0.35 0.02"
|
|
15
|
+
pos="0 0 0.50"
|
|
16
|
+
material="table_wood"
|
|
17
|
+
contype="1"
|
|
18
|
+
conaffinity="1"/>
|
|
19
|
+
|
|
20
|
+
<geom name="leg_fl" type="box" size="0.025 0.025 0.25" pos=" 0.22 0.32 0.25"/>
|
|
21
|
+
<geom name="leg_fr" type="box" size="0.025 0.025 0.25" pos=" 0.22 -0.32 0.25"/>
|
|
22
|
+
<geom name="leg_bl" type="box" size="0.025 0.025 0.25" pos="-0.22 0.32 0.25"/>
|
|
23
|
+
<geom name="leg_br" type="box" size="0.025 0.025 0.25" pos="-0.22 -0.32 0.25"/>
|
|
24
|
+
</body>
|
|
25
|
+
|
|
26
|
+
<body name="box1" pos="0.35 0 0.60">
|
|
27
|
+
<freejoint/>
|
|
28
|
+
<geom name="box1_geom"
|
|
29
|
+
type="box"
|
|
30
|
+
size="0.05 0.05 0.05"
|
|
31
|
+
rgba="0.8 0.2 0.2 1"
|
|
32
|
+
density="200"
|
|
33
|
+
contype="1"
|
|
34
|
+
conaffinity="1"/>
|
|
35
|
+
</body>
|
|
36
|
+
</worldbody>
|
|
37
|
+
</mujoco>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import mujoco
|
|
3
|
+
from IPython.display import display
|
|
4
|
+
from PIL import Image as PILImage
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class NotebookViewer:
|
|
8
|
+
def __init__(self, model, data):
|
|
9
|
+
self.model = model
|
|
10
|
+
self.data = data
|
|
11
|
+
self.width = 640
|
|
12
|
+
self.height = 480
|
|
13
|
+
|
|
14
|
+
self.cam = mujoco.MjvCamera()
|
|
15
|
+
self.opt = mujoco.MjvOption()
|
|
16
|
+
self.renderer = mujoco.Renderer(model, self.height, self.width, max_geom=500)
|
|
17
|
+
|
|
18
|
+
self.cam.azimuth = 90
|
|
19
|
+
self.cam.elevation = -25
|
|
20
|
+
self.cam.distance = 4
|
|
21
|
+
self.cam.lookat[:] = np.array([0.0, 0.0, 0.0])
|
|
22
|
+
self.cam.type = mujoco.mjtCamera.mjCAMERA_FREE
|
|
23
|
+
self.renderer.update_scene(self.data, camera=self.cam)
|
|
24
|
+
pil = PILImage.fromarray(self.renderer.render())
|
|
25
|
+
self.display = display(pil, display_id=True)
|
|
26
|
+
|
|
27
|
+
def render(self):
|
|
28
|
+
self.renderer.update_scene(self.data, camera=self.cam)
|
|
29
|
+
pil = PILImage.fromarray(self.renderer.render())
|
|
30
|
+
self.display.update(pil)
|
|
31
|
+
|
|
32
|
+
def close(self):
|
|
33
|
+
self.renderer.close()
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import pathlib
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
import mujoco
|
|
7
|
+
from ..gl_viewer import GLViewer
|
|
8
|
+
from ..notebook_viewer import NotebookViewer
|
|
9
|
+
except ImportError:
|
|
10
|
+
raise ImportError(
|
|
11
|
+
"Mujoco is not properly installed. Install using `pip install tinysim[mujoco]`"
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class UnitreeA1BaseEnv:
|
|
16
|
+
|
|
17
|
+
def __init__(self, headless=False, **kwargs):
|
|
18
|
+
model_path = str(pathlib.Path(__file__).parent / "unitree_a1/scene.xml")
|
|
19
|
+
self.model = mujoco.MjModel.from_xml_path(model_path)
|
|
20
|
+
self.data = mujoco.MjData(self.model)
|
|
21
|
+
self.action_space_size = self.model.nu
|
|
22
|
+
mujoco.mj_forward(self.model, self.data)
|
|
23
|
+
|
|
24
|
+
self.default_joint_position = np.array(
|
|
25
|
+
[-0.05, 0.8, -1.5, 0.05, 0.8, -1.5, -0.03, 0.9, -1.4, 0.03, 0.9, -1.4],
|
|
26
|
+
dtype=np.float32,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
if not headless:
|
|
30
|
+
if kwargs.get("notebook", False):
|
|
31
|
+
self.viewer = NotebookViewer(self.model, self.data)
|
|
32
|
+
else:
|
|
33
|
+
self.viewer = GLViewer(self.model, self.data)
|
|
34
|
+
else:
|
|
35
|
+
self.viewer = None
|
|
36
|
+
|
|
37
|
+
def step(self, actions, n_frames=20):
|
|
38
|
+
self.render()
|
|
39
|
+
|
|
40
|
+
if len(actions) != self.action_space_size:
|
|
41
|
+
raise ValueError(
|
|
42
|
+
f"Expected {self.action_space_size} actions, but got {len(actions)}"
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
self.data.ctrl[:] = actions
|
|
46
|
+
mujoco.mj_step(self.model, self.data, nstep=n_frames)
|
|
47
|
+
mujoco.mj_rnePostConstraint(self.model, self.data)
|
|
48
|
+
|
|
49
|
+
def render(self):
|
|
50
|
+
if self.viewer:
|
|
51
|
+
self.viewer.render()
|
|
52
|
+
|
|
53
|
+
def close(self):
|
|
54
|
+
self.viewer.close()
|
|
55
|
+
|
|
56
|
+
def reset(self):
|
|
57
|
+
mujoco.mj_resetData(self.model, self.data)
|
|
58
|
+
self.data.qpos[0:3] = [0.0, 0.0, 0.3]
|
|
59
|
+
self.data.qpos[7:19] = self.default_joint_position.copy()
|
|
60
|
+
self.data.qvel[:] = 0
|
|
61
|
+
self.data.ctrl[:] = 0
|
|
62
|
+
mujoco.mj_forward(self.model, self.data)
|
|
63
|
+
|
|
64
|
+
def get_position_data(self):
|
|
65
|
+
return self.data.qpos[0:3].copy()
|
|
66
|
+
|
|
67
|
+
def get_joint_data(self):
|
|
68
|
+
return self.data.qpos[7:19].copy()
|
|
69
|
+
|
|
70
|
+
def get_joint_effort(self):
|
|
71
|
+
return self.data.ctrl[:12].copy()
|
|
72
|
+
|
|
73
|
+
def get_velocity_data(self):
|
|
74
|
+
return self.data.qvel.copy()
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class UnitreeA1WalkEnv:
|
|
78
|
+
def __init__(self, reward_weights, cost_weights, **kwargs):
|
|
79
|
+
self.env = UnitreeA1BaseEnv(**kwargs)
|
|
80
|
+
self.frame_skip = 20
|
|
81
|
+
self.obs_dim = 45
|
|
82
|
+
self._previous_observation = np.zeros(self.obs_dim, dtype=np.float32)
|
|
83
|
+
self.joint_limits_low = np.array(
|
|
84
|
+
[-0.1, 0.25, -2.0, -0.1, 0.25, -2.0, -0.03, 0.25, -1.6, 0.03, 0.25, -1.6],
|
|
85
|
+
dtype=np.float32,
|
|
86
|
+
)
|
|
87
|
+
self.joint_limits_high = np.array(
|
|
88
|
+
[0.1, 1.2, -0.5, 0.1, 1.2, -0.5, 0.03, 1.2, -1.1, 0.03, 1.2, -1.1],
|
|
89
|
+
dtype=np.float32,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
self._feet_air_time = np.zeros(4)
|
|
93
|
+
self._last_contacts = np.zeros(4)
|
|
94
|
+
self.step_counter = 0
|
|
95
|
+
self.tracking_sigma = 0.25
|
|
96
|
+
self.maximum_episode_steps = 1024
|
|
97
|
+
self.prev_action = np.zeros_like(self.env.default_joint_position)
|
|
98
|
+
self.target_lin_vel = np.array([0.5, 0.0])
|
|
99
|
+
self.target_ang_vel = 0.0
|
|
100
|
+
self._healthy_z_range = (0.3, 0.335)
|
|
101
|
+
self._healthy_rotation = np.array(
|
|
102
|
+
[np.deg2rad(6), np.deg2rad(6), np.deg2rad(10)]
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
self._cfrc_ext_feet_indices = [4, 7, 10, 13]
|
|
106
|
+
self.reward_weights = reward_weights
|
|
107
|
+
self.cost_weights = cost_weights
|
|
108
|
+
# TODO: requires keys
|
|
109
|
+
|
|
110
|
+
def reset(self, **kwargs):
|
|
111
|
+
self.env.reset()
|
|
112
|
+
self.step_counter = 0
|
|
113
|
+
self._feet_air_time = np.zeros(4)
|
|
114
|
+
self._last_contacts = np.zeros(4)
|
|
115
|
+
self.prev_action = self.env.default_joint_position.copy()
|
|
116
|
+
self.target_lin_vel = np.array([0.5, 0.0])
|
|
117
|
+
current_obs = self._get_obs()
|
|
118
|
+
self._previous_observation = np.zeros_like(current_obs)
|
|
119
|
+
full_obs = np.concatenate([current_obs, self._previous_observation])
|
|
120
|
+
self._previous_observation = current_obs.copy()
|
|
121
|
+
return full_obs, {}
|
|
122
|
+
|
|
123
|
+
def step(self, action):
|
|
124
|
+
self.step_counter += 1
|
|
125
|
+
a = 0.7
|
|
126
|
+
action_filtered = a * self.prev_action + (1 - a) * action
|
|
127
|
+
if self.step_counter < 1:
|
|
128
|
+
action_filtered = self.env.default_joint_position.copy()
|
|
129
|
+
self.env.step(action_filtered, self.frame_skip)
|
|
130
|
+
|
|
131
|
+
current_obs = self._get_obs()
|
|
132
|
+
obs = np.concatenate([current_obs, self._previous_observation])
|
|
133
|
+
reward = self._compute_reward(action)
|
|
134
|
+
terminated = not self.is_healthy
|
|
135
|
+
truncated = self.step_counter >= self.maximum_episode_steps
|
|
136
|
+
self.prev_action = action_filtered
|
|
137
|
+
self._previous_observation = current_obs.copy()
|
|
138
|
+
return obs, reward, terminated, truncated, {}
|
|
139
|
+
|
|
140
|
+
def _get_obs(self):
|
|
141
|
+
base_ang_vel = self.euler_from_quaternion(*self.env.data.qpos[3:7])
|
|
142
|
+
joint_positions = self.env.get_joint_data()
|
|
143
|
+
joint_velocities = self.env.get_velocity_data()[6:]
|
|
144
|
+
curr_contact = self.feet_contact_forces > 1.0
|
|
145
|
+
return np.concatenate(
|
|
146
|
+
(
|
|
147
|
+
base_ang_vel,
|
|
148
|
+
joint_positions,
|
|
149
|
+
joint_velocities,
|
|
150
|
+
curr_contact,
|
|
151
|
+
self.target_lin_vel,
|
|
152
|
+
self.prev_action,
|
|
153
|
+
),
|
|
154
|
+
dtype=np.float32,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
def _compute_reward(self, action):
|
|
158
|
+
vel = self.env.get_velocity_data()
|
|
159
|
+
lin_vel = np.array(vel[:3])
|
|
160
|
+
ang_vel = np.array(vel[3:6])
|
|
161
|
+
|
|
162
|
+
tracking_lin_vel_reward, tracking_ang_vel_reward, lin_vel_z_penalty = (
|
|
163
|
+
self._tracking_velocity_penalty(lin_vel, ang_vel)
|
|
164
|
+
)
|
|
165
|
+
action_diff_penalty = np.sum(np.abs(action - self.prev_action))
|
|
166
|
+
action_sym = self.action_sym()
|
|
167
|
+
|
|
168
|
+
Positive_rewards = (
|
|
169
|
+
tracking_lin_vel_reward * self.reward_weights["linear_vel_tracking"]
|
|
170
|
+
+ tracking_ang_vel_reward * self.reward_weights["angular_vel_tracking"]
|
|
171
|
+
+ self.is_healthy * self.reward_weights["healthy"]
|
|
172
|
+
+ self.feet_air_time_reward * self.reward_weights["feet_airtime"]
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
Negative_rewards = (
|
|
176
|
+
self.torque_cost * self.cost_weights["torque"]
|
|
177
|
+
+ action_diff_penalty * self.cost_weights["action_rate"]
|
|
178
|
+
+ lin_vel_z_penalty * self.cost_weights["vertical_vel"]
|
|
179
|
+
+ self.xy_angular_velocity_cost * self.cost_weights["xy_angular_vel"]
|
|
180
|
+
+ action_sym * self.cost_weights["action_sym"]
|
|
181
|
+
+ self.acceleration_cost * self.cost_weights["joint_acceleration"]
|
|
182
|
+
+ self.orientation_cost * self.cost_weights["orientation"]
|
|
183
|
+
+ self.default_joint_position_cost
|
|
184
|
+
* self.cost_weights["default_joint_position"]
|
|
185
|
+
)
|
|
186
|
+
reward = Positive_rewards - Negative_rewards
|
|
187
|
+
return reward
|
|
188
|
+
|
|
189
|
+
def _tracking_velocity_penalty(self, lin_vel, ang_vel):
|
|
190
|
+
lin_vel_error = np.sum(np.abs(self.target_lin_vel[0] - lin_vel[0]))
|
|
191
|
+
tracking_lin_vel_reward = np.exp(-lin_vel_error / self.tracking_sigma)
|
|
192
|
+
ang_vel_error = np.sum(np.square(self.target_ang_vel - ang_vel[2]))
|
|
193
|
+
tracking_ang_vel_reward = np.exp(-ang_vel_error / self.tracking_sigma)
|
|
194
|
+
lin_vel_z_penalty = np.square((lin_vel[2]))
|
|
195
|
+
return tracking_lin_vel_reward, tracking_ang_vel_reward, lin_vel_z_penalty
|
|
196
|
+
|
|
197
|
+
@property
|
|
198
|
+
def feet_air_time_reward(self):
|
|
199
|
+
curr_contact = self.feet_contact_forces > 1.0
|
|
200
|
+
contact_filter = np.logical_or(curr_contact, self._last_contacts)
|
|
201
|
+
self._last_contacts = curr_contact
|
|
202
|
+
first_contact = (self._feet_air_time > 0.0) * contact_filter
|
|
203
|
+
self._feet_air_time += self.env.model.opt.timestep * self.frame_skip
|
|
204
|
+
air_time_reward = np.sum((self._feet_air_time) * first_contact)
|
|
205
|
+
air_time_reward *= np.linalg.norm(self.target_lin_vel) > 0.1
|
|
206
|
+
self._feet_air_time *= ~contact_filter
|
|
207
|
+
return air_time_reward
|
|
208
|
+
|
|
209
|
+
@property
|
|
210
|
+
def torque_cost(self):
|
|
211
|
+
return np.sum(np.abs(self.env.get_joint_effort()))
|
|
212
|
+
|
|
213
|
+
@property
|
|
214
|
+
def xy_angular_velocity_cost(self):
|
|
215
|
+
return np.sum(np.square(self.env.data.qvel[5]))
|
|
216
|
+
|
|
217
|
+
@property
|
|
218
|
+
def is_healthy(self):
|
|
219
|
+
_, _, z = self.env.get_position_data()
|
|
220
|
+
min_z, max_z = self._healthy_z_range
|
|
221
|
+
if not (min_z <= z <= max_z):
|
|
222
|
+
return False
|
|
223
|
+
|
|
224
|
+
r = self.euler_from_quaternion(*self.env.data.qpos[3:7])
|
|
225
|
+
return np.all(np.abs(r) <= self._healthy_rotation)
|
|
226
|
+
|
|
227
|
+
@property
|
|
228
|
+
def feet_contact_forces(self):
|
|
229
|
+
contact_forces = self.env.data.cfrc_ext[self._cfrc_ext_feet_indices].copy()
|
|
230
|
+
return np.linalg.norm(contact_forces, axis=1)
|
|
231
|
+
|
|
232
|
+
@property
|
|
233
|
+
def orientation_cost(self):
|
|
234
|
+
roll, pitch, _ = self.euler_from_quaternion(*self.env.data.qpos[3:7])
|
|
235
|
+
return np.square(roll) + np.square(pitch)
|
|
236
|
+
|
|
237
|
+
@property
|
|
238
|
+
def default_joint_position_cost(self):
|
|
239
|
+
joint_pos = self.env.get_joint_data()
|
|
240
|
+
soft_joint_limits_low = self.joint_limits_low * 0.9
|
|
241
|
+
soft_joint_limits_high = self.joint_limits_high * 0.9
|
|
242
|
+
|
|
243
|
+
lower_violation = np.maximum(soft_joint_limits_low - joint_pos, 0)
|
|
244
|
+
upper_violation = np.maximum(joint_pos - soft_joint_limits_high, 0)
|
|
245
|
+
return np.sum(np.square(lower_violation + upper_violation))
|
|
246
|
+
|
|
247
|
+
def action_sym(self):
|
|
248
|
+
in_phase_pairs_thigh = [(1, 7), (4, 10)]
|
|
249
|
+
out_of_phase_pairs_thigh = [(1, 4), (7, 10)]
|
|
250
|
+
out_of_phase_pairs_calf = [(2, 5), (8, 11)]
|
|
251
|
+
in_phase_pairs_calf = [(2, 8), (5, 11)]
|
|
252
|
+
|
|
253
|
+
jointpositions = self.env.get_joint_data()
|
|
254
|
+
loss_in_thigh = sum(
|
|
255
|
+
(jointpositions[i] - jointpositions[j]) ** 2
|
|
256
|
+
for i, j in in_phase_pairs_thigh
|
|
257
|
+
)
|
|
258
|
+
loss_out_thigh = sum(
|
|
259
|
+
(jointpositions[i] + jointpositions[j] - 1.5) ** 2
|
|
260
|
+
for i, j in out_of_phase_pairs_thigh
|
|
261
|
+
)
|
|
262
|
+
loss_in_calf = sum(
|
|
263
|
+
(jointpositions[i] - jointpositions[j]) ** 2 for i, j in in_phase_pairs_calf
|
|
264
|
+
)
|
|
265
|
+
loss_out_calf = sum(
|
|
266
|
+
(jointpositions[i] + jointpositions[j] + 3.6) ** 2
|
|
267
|
+
for i, j in out_of_phase_pairs_calf
|
|
268
|
+
)
|
|
269
|
+
loss_in = loss_in_thigh + 0.1 * loss_in_calf
|
|
270
|
+
loss_out = loss_out_thigh + 0.1 * loss_out_calf
|
|
271
|
+
return loss_in + loss_out
|
|
272
|
+
|
|
273
|
+
@property
|
|
274
|
+
def acceleration_cost(self):
|
|
275
|
+
return np.sum(np.square(self.env.data.qacc[6:]))
|
|
276
|
+
|
|
277
|
+
@staticmethod
|
|
278
|
+
def euler_from_quaternion(w, x, y, z):
|
|
279
|
+
roll = np.arctan2(2 * (w * x + y * z), 1 - 2 * (x * x + y * y))
|
|
280
|
+
pitch = np.arcsin(np.clip(2 * (w * y - z * x), -1.0, 1.0))
|
|
281
|
+
yaw = np.arctan2(2 * (w * z + x * y), 1 - 2 * (y * y + z * z))
|
|
282
|
+
return roll, pitch, yaw
|