Skip to content

Commit d0c6c31

Browse files
authored
Add ball to mujoco (#2144)
* start with bouncy ball * add ball texture * make ball smooth and separate file * address review comment * review comments * move joint
1 parent 3bda6f0 commit d0c6c31

6 files changed

Lines changed: 2112 additions & 14 deletions

File tree

tools/mujoco-simulator/mujoco-simulator/K1/K1.xml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<mujoco model="K1">
2-
<compiler angle="radian" meshdir="meshes/" />
2+
<compiler angle="radian" meshdir="meshes/" texturedir="textures/" />
33

44
<asset>
55
<texture
@@ -21,6 +21,7 @@
2121
mark="cross"
2222
markrgb=".8 .8 .8"
2323
/>
24+
2425
<material
2526
name="matplane"
2627
reflectance="0.3"
@@ -54,6 +55,8 @@
5455
<mesh name="Right_Foot" file="Right_Foot.STL" />
5556
</asset>
5657

58+
<include file="ball.xml" />
59+
5760
<worldbody>
5861
<light
5962
directional="true"
@@ -79,15 +82,9 @@
7982
condim="1"
8083
/>
8184

82-
<geom name="static_box"
83-
type="box"
84-
size="0.2 0.2 1" pos="2 1 0" rgba="0.8 0.2 0.2 1"/>
85-
86-
<geom type="sphere"
87-
size="0.2"
88-
pos="2 -1 0.2"
89-
rgba="0.2 0.8 0.2 1"
90-
mass="1"/>
85+
<geom name="static_box"
86+
type="box"
87+
size="0.2 0.2 1" pos="2 1 0" rgba="0.8 0.2 0.2 1" />
9188

9289
<body name="Trunk" pos="0 0 0.6">
9390
<site name='imu' size='0.01' pos='0.0 0.0 0.0' />
@@ -174,8 +171,8 @@
174171
/>
175172
<geom type="mesh" rgba="0.75294 0.75294 0.75294 1" mesh="Head_2" />
176173
<body name="camera_body" pos="0.05868 0.00002 0.09849" euler="0 -1.5707963267 0">
177-
<camera euler="0.0 -0.2125811028 -1.5707963267"
178-
ipd="0.064" resolution="1936 1216" name="camera" />
174+
<camera euler="0.0 -0.2125811028 -1.5707963267"
175+
ipd="0.064" resolution="1936 1216" name="camera" />
179176
</body>
180177
</body>
181178
</body>
@@ -872,4 +869,4 @@
872869
<accelerometer name="accelerometer" site="imu" noise="0.005" />
873870
</sensor>
874871

875-
</mujoco>
872+
</mujoco>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<mujoco model="ball">
2+
<compiler angle="radian" meshdir="meshes/" />
3+
4+
<asset>
5+
<texture
6+
name="ball_rgb"
7+
type="2d"
8+
file="football_base_color.png"
9+
/>
10+
<texture
11+
name="ball_normal"
12+
type="2d"
13+
file="football_normal.png"
14+
/>
15+
16+
<material name="ball">
17+
<layer texture="ball_rgb" role="rgb" />
18+
<layer texture="ball_normal" role="normal" />
19+
</material>
20+
21+
<mesh name="ball" file="ball.obj" scale="0.095 0.095 0.095" />
22+
</asset>
23+
24+
<worldbody>
25+
<body pos="2 -1 2.0">
26+
<joint
27+
name="ball_free_joint"
28+
type="free"
29+
limited="false"
30+
actuatorfrclimited="false"
31+
/>
32+
33+
<geom name="ball"
34+
type="sphere"
35+
size="0.095"
36+
mass="0.450"
37+
solref="0.08 0.25"
38+
priority="1"
39+
rgba="1 1 1 0"
40+
/>
41+
42+
<geom name="ball_visual"
43+
type="mesh"
44+
size="0.095"
45+
mesh="ball"
46+
mass="0"
47+
contype="0"
48+
conaffinity="0"
49+
material="ball"
50+
/>
51+
</body>
52+
</worldbody>
53+
54+
</mujoco>

0 commit comments

Comments
 (0)