Skip to content

Commit 0643af8

Browse files
committed
Merge origin/main into ipc-coupling-squashed
Resolved conflicts: - genesis/engine/solvers/rigid/rigid_solver_decomp.py * Updated substep() calls to include 'f' parameter (from origin/main) * Kept IPC coupling strategy dispatch logic (from HEAD) * Combined both changes for proper IPC two_way_soft_constraint support
2 parents d70d942 + 2ed3cd0 commit 0643af8

File tree

107 files changed

+7990
-4250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+7990
-4250
lines changed

.github/workflows/alarm.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,8 @@ jobs:
474474
}
475475
476476
const title = (process.env.HAS_REGRESSIONS || '0') === '1'
477-
? 'Benchmark Regression Detected' : 'Abnormal Benchmark Result Detected';
478-
const comment = `:warning: **${title}**
479-
➡️ **[Report](${process.env.REPORT_URL})**`;
477+
? '🔴 Benchmark Regression Detected' : '⚠️ Abnormal Benchmark Result Detected';
478+
const comment = `**${title} ➡️ [Report](${process.env.REPORT_URL})**`;
480479
481480
await github.rest.issues.createComment({
482481
owner: context.repo.owner,

.github/workflows/generic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
pip3 install torch --index-url https://download.pytorch.org/whl/cpu
131131
132132
- name: Black Format Check
133-
if: matrix.OS == 'ubuntu-24.04' && matrix.PYTHON_VERSION == '3.12'
133+
if: ${{ matrix.OS == 'ubuntu-24.04' && matrix.PYTHON_VERSION == '3.12' && matrix.GS_BACKEND == 'cpu' && matrix.GS_ENABLE_NDARRAY == '1' }}
134134
run: |
135135
pip install black
136136
black --line-length 120 --check .

examples/collision/tower.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import argparse
2+
import os
23

34
import genesis as gs
45

@@ -9,12 +10,13 @@ def main():
910
parser.add_argument("-v", "--vis", action="store_true", default=False)
1011
args = parser.parse_args()
1112
object_type = args.object
13+
horizon = 50 if "PYTEST_VERSION" in os.environ else 1000
1214

1315
gs.init(backend=gs.cpu, precision="32")
1416

1517
scene = gs.Scene(
1618
sim_options=gs.options.SimOptions(
17-
dt=0.005,
19+
dt=0.004,
1820
),
1921
rigid_options=gs.options.RigidOptions(
2022
max_collision_pairs=200,
@@ -27,7 +29,7 @@ def main():
2729
show_viewer=args.vis,
2830
)
2931

30-
plane = scene.add_entity(gs.morphs.Plane())
32+
scene.add_entity(gs.morphs.Plane())
3133

3234
# create pyramid of boxes
3335
box_width, box_length, box_height = 0.25, 2.0, 0.1
@@ -51,12 +53,12 @@ def main():
5153

5254
# Drop a huge mesh
5355
if object_type == "duck":
54-
duck_scale = 1.0
55-
duck = scene.add_entity(
56+
duck_scale = 0.8
57+
scene.add_entity(
5658
morph=gs.morphs.Mesh(
5759
file="meshes/duck.obj",
5860
scale=duck_scale,
59-
pos=(0, 0, num_stacks * box_height + 10 * duck_scale),
61+
pos=(0, -0.1, num_stacks * box_height + 10 * duck_scale),
6062
),
6163
)
6264
elif object_type == "sphere":
@@ -78,7 +80,7 @@ def main():
7880
)
7981

8082
scene.build()
81-
for i in range(600):
83+
for i in range(horizon):
8284
scene.step()
8385

8486

examples/coupling/cut_dragon.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1+
import os
12
import argparse
2-
3-
import numpy as np
4-
53
import genesis as gs
64

75

@@ -32,45 +30,45 @@ def main():
3230
camera_fov=35,
3331
max_FPS=120,
3432
),
35-
show_viewer=args.vis,
3633
vis_options=gs.options.VisOptions(
3734
visualize_mpm_boundary=True,
3835
# rendered_envs_idx=[2],
3936
),
37+
show_viewer=args.vis,
4038
)
4139

4240
plane = scene.add_entity(
43-
material=gs.materials.Rigid(),
4441
morph=gs.morphs.URDF(file="urdf/plane/plane.urdf", fixed=True),
42+
material=gs.materials.Rigid(),
4543
)
4644
cutter = scene.add_entity(
4745
morph=gs.morphs.Mesh(
4846
file="meshes/cross_cutter.obj",
49-
euler=(90, 0, 0),
5047
scale=0.8,
5148
pos=(0.0, 0.0, 0.3),
49+
euler=(90, 0, 0),
5250
fixed=True,
5351
convexify=False,
5452
),
5553
surface=gs.surfaces.Iron(),
5654
)
5755
dragon = scene.add_entity(
58-
material=gs.materials.MPM.Elastic(sampler="pbs-64"),
5956
morph=gs.morphs.Mesh(
6057
file="meshes/dragon/dragon.obj",
6158
scale=0.007,
6259
euler=(0, 0, 90),
6360
pos=(0.3, -0.0, 1.3),
6461
),
62+
material=gs.materials.MPM.Elastic(sampler="pbs-64"),
6563
surface=gs.surfaces.Rough(
6664
color=(0.6, 1.0, 0.8, 1.0),
6765
vis_mode="particle",
6866
),
6967
)
7068
scene.build(n_envs=2)
7169

72-
horizon = 400
73-
for i in range(horizon):
70+
horizon = 400 if "PYTEST_VERSION" not in os.environ else 5
71+
for _ in range(horizon):
7472
scene.step()
7573

7674

examples/coupling/fem_cube_linked_with_arm.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ def main():
1717
"--substeps", type=int, help="Number of substeps (auto-selected based on solver if not specified)"
1818
)
1919
parser.add_argument("--vis", "-v", action="store_true", help="Show visualization GUI")
20-
parser.add_argument("-c", "--cpu", action="store_true", default=False)
20+
parser.add_argument("-c", "--cpu", action="store_true", default="PYTEST_VERSION" in os.environ)
2121
args = parser.parse_args()
2222

23-
args.cpu = args.cpu if "PYTEST_VERSION" not in os.environ else True
24-
2523
gs.init(backend=gs.cpu if args.cpu else gs.gpu, logging_level=None)
2624

2725
if args.solver == "explicit":
@@ -115,10 +113,7 @@ def main():
115113

116114
print("cube init pos", cube.init_positions)
117115
pin_idx = [1, 5]
118-
cube.set_vertex_constraints(
119-
verts_idx=pin_idx,
120-
link=end_joint.link,
121-
)
116+
cube.set_vertex_constraints(verts_idx_local=pin_idx, link=end_joint.link)
122117
print("Cube initial positions:", cube.init_positions[pin_idx])
123118
scene.draw_debug_spheres(poss=cube.init_positions[pin_idx], radius=0.02, color=(1.0, 0.0, 1.0, 0.8))
124119

examples/coupling/flush_cubes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
import os
12
import argparse
2-
33
import numpy as np
4-
54
import genesis as gs
65

76

@@ -91,7 +90,7 @@ def main():
9190
)
9291
scene.build(n_envs=2)
9392

94-
horizon = 100
93+
horizon = 100 if "PYTEST_VERSION" not in os.environ else 5
9594
for i in range(horizon):
9695
emitter1.emit(
9796
pos=np.array([0.16, -0.4, 0.5]),

examples/differentiable_push.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import argparse
2+
import os
23

34
import torch
45

@@ -89,7 +90,7 @@ def main():
8990
scene.build(n_envs=2)
9091

9192
########################## forward + backward twice ##########################
92-
horizon = 150
93+
horizon = 150 if "PYTEST_VERSION" not in os.environ else 5
9394
v_list = [gs.tensor([[0.0, 1.0, 0.0], [0.0, 1.0, 0.0]], requires_grad=True) for _ in range(horizon)]
9495
for _ in range(2):
9596
scene.reset()

examples/fem_hard_and_soft_constraint.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,30 +106,19 @@ def get_next_circle_position():
106106
try:
107107
target_positions = blob.init_positions[pinned_idx]
108108
scene.draw_debug_spheres(poss=target_positions, radius=0.02, color=(1, 0, 1, 0.8))
109-
blob.set_vertex_constraints(
110-
verts_idx=pinned_idx,
111-
target_poss=target_positions,
112-
is_soft_constraint=True,
113-
stiffness=1e4,
114-
)
109+
blob.set_vertex_constraints(pinned_idx, target_positions, is_soft_constraint=True, stiffness=1e4)
115110

116111
target_positions = get_next_circle_position()
117112
debug_circle = scene.draw_debug_spheres(poss=target_positions, radius=0.02, color=(0, 1, 0, 0.8))
118-
cube.set_vertex_constraints(
119-
verts_idx=pinned_idx,
120-
target_poss=target_positions,
121-
)
113+
cube.set_vertex_constraints(pinned_idx, target_positions)
122114

123115
for step in tqdm(range(total_steps), total=total_steps):
124116
if debug_circle is not None:
125117
scene.clear_debug_object(debug_circle)
126118

127119
new_pos = get_next_circle_position()
128120
debug_circle = scene.draw_debug_spheres(poss=new_pos, radius=0.02, color=(0, 1, 0, 0.8))
129-
cube.update_constraint_targets(
130-
verts_idx=pinned_idx,
131-
target_poss=new_pos,
132-
)
121+
cube.update_constraint_targets(pinned_idx, new_pos)
133122

134123
scene.step()
135124

examples/rendering/demo.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,8 @@ def main():
151151
spp=512,
152152
)
153153
scene.build()
154-
155-
########################## forward + backward twice ##########################
156154
scene.reset()
157-
horizon = 2000
155+
horizon = 10
158156

159157
for i in range(horizon):
160158
scene.step()
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import argparse
2+
3+
import genesis as gs
4+
5+
6+
def main():
7+
parser = argparse.ArgumentParser()
8+
parser.add_argument("-f", "--fix", action="store_true", default=False)
9+
args = parser.parse_args()
10+
11+
gs.init()
12+
13+
scene = gs.Scene(
14+
vis_options=gs.options.VisOptions(
15+
rendered_envs_idx=(0,),
16+
),
17+
profiling_options=gs.options.ProfilingOptions(
18+
show_FPS=False,
19+
),
20+
show_viewer=False,
21+
)
22+
scene.add_entity(morph=gs.morphs.Plane())
23+
cube = scene.add_entity(
24+
gs.morphs.Box(
25+
size=(0.1, 0.1, 0.1),
26+
pos=(0.0, -0.9, 1.0),
27+
euler=(15.0, 30.0, 60.0),
28+
)
29+
)
30+
31+
cam = scene.add_camera(
32+
res=(640, 480),
33+
pos=(2.0, 0.0, 1.5),
34+
lookat=(0, 0, 0.7),
35+
fov=40,
36+
GUI=True,
37+
)
38+
cam.follow_entity(cube, fix_orientation=args.fix)
39+
40+
scene.build()
41+
42+
cube.set_dofs_velocity([0.0, 5.0, 0.0, 0.0, 0.0, 1.0])
43+
for _ in range(100):
44+
scene.step()
45+
cam.render()
46+
47+
48+
if __name__ == "__main__":
49+
main()

0 commit comments

Comments
 (0)