Repository navigation
Expand file tree
/
Copy pathmpm.py
More file actions
71 lines (61 loc) · 1.43 KB
/
Copy pathmpm.py
File metadata and controls
71 lines (61 loc) · 1.43 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
import os
import genesis as gs
gs.init(backend=gs.cpu)
scene = gs.Scene(
sim_options=gs.options.SimOptions(
dt=4e-3,
substeps=10,
),
mpm_options=gs.options.MPMOptions(
lower_bound=(-0.5, -1.0, 0.0),
upper_bound=(0.5, 1.0, 1),
),
vis_options=gs.options.VisOptions(
visualize_mpm_boundary=True,
),
viewer_options=gs.options.ViewerOptions(
res=(960, 640),
camera_fov=30,
),
show_viewer=True,
)
plane = scene.add_entity(
morph=gs.morphs.Plane(),
)
obj_elastic = scene.add_entity(
material=gs.materials.MPM.Elastic(),
morph=gs.morphs.Box(
pos=(0.0, -0.5, 0.25),
size=(0.2, 0.2, 0.2),
),
surface=gs.surfaces.Default(
color=(1.0, 0.4, 0.4),
vis_mode="visual",
),
)
obj_sand = scene.add_entity(
material=gs.materials.MPM.Liquid(),
morph=gs.morphs.Box(
pos=(0.0, 0.0, 0.25),
size=(0.3, 0.3, 0.3),
),
surface=gs.surfaces.Default(
color=(0.3, 0.3, 1.0),
vis_mode="particle",
),
)
obj_plastic = scene.add_entity(
material=gs.materials.MPM.ElastoPlastic(),
morph=gs.morphs.Sphere(
pos=(0.0, 0.5, 0.35),
radius=0.1,
),
surface=gs.surfaces.Default(
color=(0.4, 1.0, 0.4),
vis_mode="particle",
),
)
scene.build()
horizon = 1000 if "PYTEST_VERSION" not in os.environ else 5
for i in range(horizon):
scene.step()