forked from Genesis-Embodied-AI/genesis-world
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwater_wheel.py
More file actions
82 lines (71 loc) · 2.25 KB
/
Copy pathwater_wheel.py
File metadata and controls
82 lines (71 loc) · 2.25 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
import argparse
import os
import numpy as np
import genesis as gs
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--solver", type=str, default="sph", choices=("sph", "mpm"))
parser.add_argument("--recon", action="store_true", default=False)
parser.add_argument("-v", "--vis", action="store_true", default=False)
args = parser.parse_args()
########################## init ##########################
gs.init(precision="32", logging_level="info")
########################## create a scene ##########################
scene = gs.Scene(
sim_options=gs.options.SimOptions(
dt=4e-3,
substeps=10,
),
mpm_options=gs.options.MPMOptions(
lower_bound=(0.0, -1.5, 0.0),
upper_bound=(1.0, 1.5, 4.0),
),
sph_options=gs.options.SPHOptions(
particle_size=0.02,
),
pbd_options=gs.options.PBDOptions(
particle_size=0.02,
),
viewer_options=gs.options.ViewerOptions(
camera_pos=(5.5, 6.5, 3.2),
camera_lookat=(0.5, 1.5, 1.5),
camera_fov=35,
),
vis_options=gs.options.VisOptions(
rendered_envs_idx=[0],
),
show_viewer=args.vis,
)
plane = scene.add_entity(gs.morphs.Plane())
wheel = scene.add_entity(
morph=gs.morphs.URDF(
file="urdf/wheel/fancy_wheel.urdf",
pos=(0.5, 0.25, 1.6),
euler=(0, 0, 0),
fixed=True,
convexify=False,
),
)
emitter = scene.add_emitter(
material=getattr(gs.materials, args.solver.upper()).Liquid(
sampler="regular",
),
max_particles=100000,
surface=gs.surfaces.Glass(
color=(0.7, 0.85, 1.0, 0.7),
vis_mode="recon" if args.recon else "particle",
),
)
scene.build(n_envs=0)
horizon = 500 if "PYTEST_VERSION" not in os.environ else 5
for i in range(horizon):
emitter.emit(
pos=np.array([0.5, 1.0, 3.5]),
direction=np.array([0.0, 0, -1.0]),
speed=5.0,
droplet_shape="circle",
droplet_size=0.22,
)
scene.step()
if __name__ == "__main__":
main()