warp-lang 0.11.0__py3-none-manylinux2014_x86_64.whl → 1.0.0__py3-none-manylinux2014_x86_64.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.
Potentially problematic release.
This version of warp-lang might be problematic. Click here for more details.
- warp/__init__.py +8 -0
- warp/bin/warp-clang.so +0 -0
- warp/bin/warp.so +0 -0
- warp/build.py +7 -6
- warp/build_dll.py +70 -79
- warp/builtins.py +10 -6
- warp/codegen.py +51 -19
- warp/config.py +7 -8
- warp/constants.py +3 -0
- warp/context.py +948 -245
- warp/dlpack.py +198 -113
- warp/examples/assets/bunny.usd +0 -0
- warp/examples/assets/cartpole.urdf +110 -0
- warp/examples/assets/crazyflie.usd +0 -0
- warp/examples/assets/cube.usda +42 -0
- warp/examples/assets/nv_ant.xml +92 -0
- warp/examples/assets/nv_humanoid.xml +183 -0
- warp/examples/assets/quadruped.urdf +268 -0
- warp/examples/assets/rocks.nvdb +0 -0
- warp/examples/assets/rocks.usd +0 -0
- warp/examples/assets/sphere.usda +56 -0
- warp/examples/assets/torus.usda +105 -0
- warp/examples/benchmarks/benchmark_api.py +383 -0
- warp/examples/benchmarks/benchmark_cloth.py +279 -0
- warp/examples/benchmarks/benchmark_cloth_cupy.py +88 -0
- warp/examples/benchmarks/benchmark_cloth_jax.py +100 -0
- warp/examples/benchmarks/benchmark_cloth_numba.py +142 -0
- warp/examples/benchmarks/benchmark_cloth_numpy.py +77 -0
- warp/examples/benchmarks/benchmark_cloth_pytorch.py +86 -0
- warp/examples/benchmarks/benchmark_cloth_taichi.py +112 -0
- warp/examples/benchmarks/benchmark_cloth_warp.py +146 -0
- warp/examples/benchmarks/benchmark_launches.py +295 -0
- warp/examples/core/example_dem.py +221 -0
- warp/examples/core/example_fluid.py +267 -0
- warp/examples/core/example_graph_capture.py +129 -0
- warp/examples/core/example_marching_cubes.py +177 -0
- warp/examples/core/example_mesh.py +154 -0
- warp/examples/core/example_mesh_intersect.py +193 -0
- warp/examples/core/example_nvdb.py +169 -0
- warp/examples/core/example_raycast.py +89 -0
- warp/examples/core/example_raymarch.py +178 -0
- warp/examples/core/example_render_opengl.py +141 -0
- warp/examples/core/example_sph.py +389 -0
- warp/examples/core/example_torch.py +181 -0
- warp/examples/core/example_wave.py +249 -0
- warp/examples/fem/bsr_utils.py +380 -0
- warp/examples/fem/example_apic_fluid.py +391 -0
- warp/examples/fem/example_convection_diffusion.py +168 -0
- warp/examples/fem/example_convection_diffusion_dg.py +209 -0
- warp/examples/fem/example_convection_diffusion_dg0.py +194 -0
- warp/examples/fem/example_deformed_geometry.py +159 -0
- warp/examples/fem/example_diffusion.py +173 -0
- warp/examples/fem/example_diffusion_3d.py +152 -0
- warp/examples/fem/example_diffusion_mgpu.py +214 -0
- warp/examples/fem/example_mixed_elasticity.py +222 -0
- warp/examples/fem/example_navier_stokes.py +243 -0
- warp/examples/fem/example_stokes.py +192 -0
- warp/examples/fem/example_stokes_transfer.py +249 -0
- warp/examples/fem/mesh_utils.py +109 -0
- warp/examples/fem/plot_utils.py +287 -0
- warp/examples/optim/example_bounce.py +248 -0
- warp/examples/optim/example_cloth_throw.py +210 -0
- warp/examples/optim/example_diffray.py +535 -0
- warp/examples/optim/example_drone.py +850 -0
- warp/examples/optim/example_inverse_kinematics.py +169 -0
- warp/examples/optim/example_inverse_kinematics_torch.py +170 -0
- warp/examples/optim/example_spring_cage.py +234 -0
- warp/examples/optim/example_trajectory.py +201 -0
- warp/examples/sim/example_cartpole.py +128 -0
- warp/examples/sim/example_cloth.py +184 -0
- warp/examples/sim/example_granular.py +113 -0
- warp/examples/sim/example_granular_collision_sdf.py +185 -0
- warp/examples/sim/example_jacobian_ik.py +213 -0
- warp/examples/sim/example_particle_chain.py +106 -0
- warp/examples/sim/example_quadruped.py +179 -0
- warp/examples/sim/example_rigid_chain.py +191 -0
- warp/examples/sim/example_rigid_contact.py +176 -0
- warp/examples/sim/example_rigid_force.py +126 -0
- warp/examples/sim/example_rigid_gyroscopic.py +97 -0
- warp/examples/sim/example_rigid_soft_contact.py +124 -0
- warp/examples/sim/example_soft_body.py +178 -0
- warp/fabric.py +29 -20
- warp/fem/cache.py +0 -1
- warp/fem/dirichlet.py +0 -2
- warp/fem/integrate.py +0 -1
- warp/jax.py +45 -0
- warp/jax_experimental.py +339 -0
- warp/native/builtin.h +12 -0
- warp/native/bvh.cu +18 -18
- warp/native/clang/clang.cpp +8 -3
- warp/native/cuda_util.cpp +94 -5
- warp/native/cuda_util.h +35 -6
- warp/native/cutlass_gemm.cpp +1 -1
- warp/native/cutlass_gemm.cu +4 -1
- warp/native/error.cpp +66 -0
- warp/native/error.h +27 -0
- warp/native/mesh.cu +2 -2
- warp/native/reduce.cu +4 -4
- warp/native/runlength_encode.cu +2 -2
- warp/native/scan.cu +2 -2
- warp/native/sparse.cu +0 -1
- warp/native/temp_buffer.h +2 -2
- warp/native/warp.cpp +95 -60
- warp/native/warp.cu +1053 -218
- warp/native/warp.h +49 -32
- warp/optim/linear.py +33 -16
- warp/render/render_opengl.py +202 -101
- warp/render/render_usd.py +82 -40
- warp/sim/__init__.py +13 -4
- warp/sim/articulation.py +4 -5
- warp/sim/collide.py +320 -175
- warp/sim/import_mjcf.py +25 -30
- warp/sim/import_urdf.py +94 -63
- warp/sim/import_usd.py +51 -36
- warp/sim/inertia.py +3 -2
- warp/sim/integrator.py +233 -0
- warp/sim/integrator_euler.py +447 -469
- warp/sim/integrator_featherstone.py +1991 -0
- warp/sim/integrator_xpbd.py +1420 -640
- warp/sim/model.py +765 -487
- warp/sim/particles.py +2 -1
- warp/sim/render.py +35 -13
- warp/sim/utils.py +222 -11
- warp/stubs.py +8 -0
- warp/tape.py +16 -1
- warp/tests/aux_test_grad_customs.py +23 -0
- warp/tests/test_array.py +190 -1
- warp/tests/test_async.py +656 -0
- warp/tests/test_bool.py +50 -0
- warp/tests/test_dlpack.py +164 -11
- warp/tests/test_examples.py +166 -74
- warp/tests/test_fem.py +8 -1
- warp/tests/test_generics.py +15 -5
- warp/tests/test_grad.py +1 -1
- warp/tests/test_grad_customs.py +172 -12
- warp/tests/test_jax.py +254 -0
- warp/tests/test_large.py +29 -6
- warp/tests/test_launch.py +25 -0
- warp/tests/test_linear_solvers.py +20 -3
- warp/tests/test_matmul.py +61 -16
- warp/tests/test_matmul_lite.py +13 -13
- warp/tests/test_mempool.py +186 -0
- warp/tests/test_multigpu.py +3 -0
- warp/tests/test_options.py +16 -2
- warp/tests/test_peer.py +137 -0
- warp/tests/test_print.py +3 -1
- warp/tests/test_quat.py +23 -0
- warp/tests/test_sim_kinematics.py +97 -0
- warp/tests/test_snippet.py +126 -3
- warp/tests/test_streams.py +108 -79
- warp/tests/test_torch.py +16 -8
- warp/tests/test_utils.py +32 -27
- warp/tests/test_verify_fp.py +65 -0
- warp/tests/test_volume.py +1 -1
- warp/tests/unittest_serial.py +2 -0
- warp/tests/unittest_suites.py +12 -0
- warp/tests/unittest_utils.py +14 -7
- warp/thirdparty/unittest_parallel.py +15 -3
- warp/torch.py +10 -8
- warp/types.py +363 -246
- warp/utils.py +143 -19
- warp_lang-1.0.0.dist-info/LICENSE.md +126 -0
- warp_lang-1.0.0.dist-info/METADATA +394 -0
- {warp_lang-0.11.0.dist-info → warp_lang-1.0.0.dist-info}/RECORD +167 -86
- warp/sim/optimizer.py +0 -138
- warp_lang-0.11.0.dist-info/LICENSE.md +0 -36
- warp_lang-0.11.0.dist-info/METADATA +0 -238
- /warp/tests/{walkthough_debug.py → walkthrough_debug.py} +0 -0
- {warp_lang-0.11.0.dist-info → warp_lang-1.0.0.dist-info}/WHEEL +0 -0
- {warp_lang-0.11.0.dist-info → warp_lang-1.0.0.dist-info}/top_level.txt +0 -0
warp/render/render_usd.py
CHANGED
|
@@ -28,9 +28,12 @@ def _usd_set_xform(xform, pos: tuple, rot: tuple, scale: tuple, time):
|
|
|
28
28
|
|
|
29
29
|
xform_ops = xform.GetOrderedXformOps()
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
if pos is not None:
|
|
32
|
+
xform_ops[0].Set(Gf.Vec3d(float(pos[0]), float(pos[1]), float(pos[2])), time)
|
|
33
|
+
if rot is not None:
|
|
34
|
+
xform_ops[1].Set(Gf.Quatf(float(rot[3]), float(rot[0]), float(rot[1]), float(rot[2])), time)
|
|
35
|
+
if scale is not None:
|
|
36
|
+
xform_ops[2].Set(Gf.Vec3d(float(scale[0]), float(scale[1]), float(scale[2])), time)
|
|
34
37
|
|
|
35
38
|
|
|
36
39
|
# transforms a cylinder such that it connects the two points pos0, pos1
|
|
@@ -104,24 +107,20 @@ class UsdRenderer:
|
|
|
104
107
|
elif up_axis == "Z":
|
|
105
108
|
UsdGeom.SetStageUpAxis(self.stage, UsdGeom.Tokens.z)
|
|
106
109
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
UsdGeom.Xform(light_1.GetPrim()).AddRotateYOp().Set(value=(-70.0))
|
|
124
|
-
UsdGeom.Xform(light_1.GetPrim()).AddRotateXOp().Set(value=(-45.0))
|
|
110
|
+
dome_light = UsdLux.DomeLight.Define(stage, "/dome_light")
|
|
111
|
+
dome_light.AddRotateXYZOp().Set((-90.0, -30.0, 0.0))
|
|
112
|
+
dome_light.GetEnableColorTemperatureAttr().Set(True)
|
|
113
|
+
dome_light.GetColorTemperatureAttr().Set(6150.0)
|
|
114
|
+
dome_light.GetIntensityAttr().Set(1.0)
|
|
115
|
+
dome_light.GetExposureAttr().Set(9.0)
|
|
116
|
+
dome_light.GetPrim().CreateAttribute("visibleInPrimaryRay", Sdf.ValueTypeNames.Bool).Set(False)
|
|
117
|
+
|
|
118
|
+
distant_light = UsdLux.DistantLight.Define(stage, "/distant_light")
|
|
119
|
+
distant_light.AddRotateXYZOp().Set((-35.0, 45.0, 0.0))
|
|
120
|
+
distant_light.GetEnableColorTemperatureAttr().Set(True)
|
|
121
|
+
distant_light.GetColorTemperatureAttr().Set(7250.0)
|
|
122
|
+
distant_light.GetIntensityAttr().Set(1.0)
|
|
123
|
+
distant_light.GetExposureAttr().Set(10.0)
|
|
125
124
|
|
|
126
125
|
def begin_frame(self, time):
|
|
127
126
|
self.time = round(time * self.fps)
|
|
@@ -155,7 +154,11 @@ class UsdRenderer:
|
|
|
155
154
|
rot: tuple,
|
|
156
155
|
scale: tuple = (1.0, 1.0, 1.0),
|
|
157
156
|
color: tuple = (1.0, 1.0, 1.0),
|
|
157
|
+
custom_index: int = -1,
|
|
158
|
+
visible: bool = True,
|
|
158
159
|
):
|
|
160
|
+
if not visible:
|
|
161
|
+
return
|
|
159
162
|
sdf_path = self._resolve_path(name, body)
|
|
160
163
|
instance = self._shape_constructors[shape.name].Define(self.stage, sdf_path)
|
|
161
164
|
instance.GetPrim().GetReferences().AddInternalReference(shape)
|
|
@@ -228,7 +231,7 @@ class UsdRenderer:
|
|
|
228
231
|
|
|
229
232
|
return prim_path
|
|
230
233
|
|
|
231
|
-
def render_ground(self, size: float = 100.0):
|
|
234
|
+
def render_ground(self, size: float = 100.0, plane=None):
|
|
232
235
|
from pxr import UsdGeom
|
|
233
236
|
|
|
234
237
|
mesh = UsdGeom.Mesh.Define(self.stage, self.root.GetPath().AppendChild("ground"))
|
|
@@ -243,6 +246,23 @@ class UsdRenderer:
|
|
|
243
246
|
elif self.up_axis == "Z":
|
|
244
247
|
points = ((-size, -size, 0.0), (size, -size, 0.0), (size, size, 0.0), (-size, size, 0.0))
|
|
245
248
|
normals = ((0.0, 0.0, 1.0), (0.0, 0.0, 1.0), (0.0, 0.0, 1.0), (0.0, 0.0, 1.0))
|
|
249
|
+
if plane is not None:
|
|
250
|
+
normal = np.array(plane[:3])
|
|
251
|
+
normal /= np.linalg.norm(normal)
|
|
252
|
+
pos = plane[3] * normal
|
|
253
|
+
axis_up = [0.0, 0.0, 0.0]
|
|
254
|
+
axis_up["XYZ".index(self.up_axis)] = 1.0
|
|
255
|
+
if np.allclose(normal, axis_up):
|
|
256
|
+
# no rotation necessary
|
|
257
|
+
q = (0.0, 0.0, 0.0, 1.0)
|
|
258
|
+
else:
|
|
259
|
+
c = np.cross(normal, axis_up)
|
|
260
|
+
angle = np.arcsin(np.linalg.norm(c))
|
|
261
|
+
axis = np.abs(c) / np.linalg.norm(c)
|
|
262
|
+
q = wp.quat_from_axis_angle(axis, angle)
|
|
263
|
+
tf = wp.transform(pos, q)
|
|
264
|
+
points = [wp.transform_point(tf, p) for p in points]
|
|
265
|
+
normals = [wp.transform_vector(tf, n) for n in normals]
|
|
246
266
|
counts = (4,)
|
|
247
267
|
indices = [0, 1, 2, 3]
|
|
248
268
|
|
|
@@ -252,7 +272,7 @@ class UsdRenderer:
|
|
|
252
272
|
mesh.GetFaceVertexIndicesAttr().Set(indices)
|
|
253
273
|
|
|
254
274
|
def render_sphere(
|
|
255
|
-
self, name: str, pos: tuple, rot: tuple, radius: float, parent_body: str = None, is_template: bool = False
|
|
275
|
+
self, name: str, pos: tuple, rot: tuple, radius: float, parent_body: str = None, is_template: bool = False, color: tuple = None
|
|
256
276
|
):
|
|
257
277
|
"""Debug helper to add a sphere for visualization
|
|
258
278
|
|
|
@@ -260,9 +280,10 @@ class UsdRenderer:
|
|
|
260
280
|
pos: The position of the sphere
|
|
261
281
|
radius: The radius of the sphere
|
|
262
282
|
name: A name for the USD prim on the stage
|
|
283
|
+
color: The color of the sphere
|
|
263
284
|
"""
|
|
264
285
|
|
|
265
|
-
from pxr import UsdGeom, Sdf
|
|
286
|
+
from pxr import Gf, UsdGeom, Sdf
|
|
266
287
|
|
|
267
288
|
if is_template:
|
|
268
289
|
prim_path = self._resolve_path(name, parent_body, is_template)
|
|
@@ -282,6 +303,9 @@ class UsdRenderer:
|
|
|
282
303
|
|
|
283
304
|
sphere.GetRadiusAttr().Set(radius, self.time)
|
|
284
305
|
|
|
306
|
+
if color is not None:
|
|
307
|
+
sphere.GetDisplayColorAttr().Set([Gf.Vec3f(color)], self.time)
|
|
308
|
+
|
|
285
309
|
self._shape_constructors[name] = UsdGeom.Sphere
|
|
286
310
|
|
|
287
311
|
if not is_template:
|
|
@@ -298,6 +322,7 @@ class UsdRenderer:
|
|
|
298
322
|
half_height: float,
|
|
299
323
|
parent_body: str = None,
|
|
300
324
|
is_template: bool = False,
|
|
325
|
+
color: tuple = None,
|
|
301
326
|
):
|
|
302
327
|
"""
|
|
303
328
|
Debug helper to add a capsule for visualization
|
|
@@ -307,9 +332,10 @@ class UsdRenderer:
|
|
|
307
332
|
radius: The radius of the capsule
|
|
308
333
|
half_height: The half height of the capsule
|
|
309
334
|
name: A name for the USD prim on the stage
|
|
335
|
+
color: The color of the capsule
|
|
310
336
|
"""
|
|
311
337
|
|
|
312
|
-
from pxr import UsdGeom, Sdf
|
|
338
|
+
from pxr import Gf, UsdGeom, Sdf
|
|
313
339
|
|
|
314
340
|
if is_template:
|
|
315
341
|
prim_path = self._resolve_path(name, parent_body, is_template)
|
|
@@ -331,10 +357,13 @@ class UsdRenderer:
|
|
|
331
357
|
capsule.GetHeightAttr().Set(float(half_height * 2.0))
|
|
332
358
|
capsule.GetAxisAttr().Set("Y")
|
|
333
359
|
|
|
360
|
+
if color is not None:
|
|
361
|
+
capsule.GetDisplayColorAttr().Set([Gf.Vec3f(color)], self.time)
|
|
362
|
+
|
|
334
363
|
self._shape_constructors[name] = UsdGeom.Capsule
|
|
335
364
|
|
|
336
365
|
if not is_template:
|
|
337
|
-
_usd_set_xform(capsule, pos, rot, (1.0, 1.0, 1.0),
|
|
366
|
+
_usd_set_xform(capsule, pos, rot, (1.0, 1.0, 1.0), self.time)
|
|
338
367
|
|
|
339
368
|
return prim_path
|
|
340
369
|
|
|
@@ -347,6 +376,7 @@ class UsdRenderer:
|
|
|
347
376
|
half_height: float,
|
|
348
377
|
parent_body: str = None,
|
|
349
378
|
is_template: bool = False,
|
|
379
|
+
color: tuple = None,
|
|
350
380
|
):
|
|
351
381
|
"""
|
|
352
382
|
Debug helper to add a cylinder for visualization
|
|
@@ -356,9 +386,10 @@ class UsdRenderer:
|
|
|
356
386
|
radius: The radius of the cylinder
|
|
357
387
|
half_height: The half height of the cylinder
|
|
358
388
|
name: A name for the USD prim on the stage
|
|
389
|
+
color: The color of the cylinder
|
|
359
390
|
"""
|
|
360
391
|
|
|
361
|
-
from pxr import UsdGeom, Sdf
|
|
392
|
+
from pxr import Gf, UsdGeom, Sdf
|
|
362
393
|
|
|
363
394
|
if is_template:
|
|
364
395
|
prim_path = self._resolve_path(name, parent_body, is_template)
|
|
@@ -380,10 +411,13 @@ class UsdRenderer:
|
|
|
380
411
|
cylinder.GetHeightAttr().Set(float(half_height * 2.0))
|
|
381
412
|
cylinder.GetAxisAttr().Set("Y")
|
|
382
413
|
|
|
414
|
+
if color is not None:
|
|
415
|
+
cylinder.GetDisplayColorAttr().Set([Gf.Vec3f(color)], self.time)
|
|
416
|
+
|
|
383
417
|
self._shape_constructors[name] = UsdGeom.Cylinder
|
|
384
418
|
|
|
385
419
|
if not is_template:
|
|
386
|
-
_usd_set_xform(cylinder, pos, rot, (1.0, 1.0, 1.0),
|
|
420
|
+
_usd_set_xform(cylinder, pos, rot, (1.0, 1.0, 1.0), self.time)
|
|
387
421
|
|
|
388
422
|
return prim_path
|
|
389
423
|
|
|
@@ -396,6 +430,7 @@ class UsdRenderer:
|
|
|
396
430
|
half_height: float,
|
|
397
431
|
parent_body: str = None,
|
|
398
432
|
is_template: bool = False,
|
|
433
|
+
color: tuple = None,
|
|
399
434
|
):
|
|
400
435
|
"""
|
|
401
436
|
Debug helper to add a cone for visualization
|
|
@@ -405,9 +440,10 @@ class UsdRenderer:
|
|
|
405
440
|
radius: The radius of the cone
|
|
406
441
|
half_height: The half height of the cone
|
|
407
442
|
name: A name for the USD prim on the stage
|
|
443
|
+
color: The color of the cone
|
|
408
444
|
"""
|
|
409
445
|
|
|
410
|
-
from pxr import UsdGeom, Sdf
|
|
446
|
+
from pxr import Gf, UsdGeom, Sdf
|
|
411
447
|
|
|
412
448
|
if is_template:
|
|
413
449
|
prim_path = self._resolve_path(name, parent_body, is_template)
|
|
@@ -429,25 +465,29 @@ class UsdRenderer:
|
|
|
429
465
|
cone.GetHeightAttr().Set(float(half_height * 2.0))
|
|
430
466
|
cone.GetAxisAttr().Set("Y")
|
|
431
467
|
|
|
468
|
+
if color is not None:
|
|
469
|
+
cone.GetDisplayColorAttr().Set([Gf.Vec3f(color)], self.time)
|
|
470
|
+
|
|
432
471
|
self._shape_constructors[name] = UsdGeom.Cone
|
|
433
472
|
|
|
434
473
|
if not is_template:
|
|
435
|
-
_usd_set_xform(cone, pos, rot, (1.0, 1.0, 1.0),
|
|
474
|
+
_usd_set_xform(cone, pos, rot, (1.0, 1.0, 1.0), self.time)
|
|
436
475
|
|
|
437
476
|
return prim_path
|
|
438
477
|
|
|
439
478
|
def render_box(
|
|
440
|
-
self, name: str, pos: tuple, rot: tuple, extents: tuple, parent_body: str = None, is_template: bool = False
|
|
479
|
+
self, name: str, pos: tuple, rot: tuple, extents: tuple, parent_body: str = None, is_template: bool = False, color: tuple = None
|
|
441
480
|
):
|
|
442
481
|
"""Debug helper to add a box for visualization
|
|
443
482
|
|
|
444
483
|
Args:
|
|
445
|
-
pos: The position of the
|
|
446
|
-
extents: The radius of the
|
|
484
|
+
pos: The position of the box
|
|
485
|
+
extents: The radius of the box
|
|
447
486
|
name: A name for the USD prim on the stage
|
|
487
|
+
color: The color of the box
|
|
448
488
|
"""
|
|
449
489
|
|
|
450
|
-
from pxr import UsdGeom, Sdf, Gf
|
|
490
|
+
from pxr import UsdGeom, Sdf, Gf
|
|
451
491
|
|
|
452
492
|
if is_template:
|
|
453
493
|
prim_path = self._resolve_path(name, parent_body, is_template)
|
|
@@ -465,11 +505,14 @@ class UsdRenderer:
|
|
|
465
505
|
cube = UsdGeom.Cube.Define(self.stage, cube_path)
|
|
466
506
|
_usd_add_xform(cube)
|
|
467
507
|
|
|
508
|
+
if color is not None:
|
|
509
|
+
cube.GetDisplayColorAttr().Set([Gf.Vec3f(color)], self.time)
|
|
510
|
+
|
|
468
511
|
self._shape_constructors[name] = UsdGeom.Cube
|
|
469
512
|
self._shape_custom_scale[name] = extents
|
|
470
513
|
|
|
471
514
|
if not is_template:
|
|
472
|
-
_usd_set_xform(cube, pos, rot, extents,
|
|
515
|
+
_usd_set_xform(cube, pos, rot, extents, self.time)
|
|
473
516
|
|
|
474
517
|
return prim_path
|
|
475
518
|
|
|
@@ -662,11 +705,10 @@ class UsdRenderer:
|
|
|
662
705
|
|
|
663
706
|
instancer = UsdGeom.Points.Define(self.stage, instancer_path)
|
|
664
707
|
|
|
665
|
-
instancer.CreatePrimvar("displayColor", Sdf.ValueTypeNames.Float3Array, "vertex", 1)
|
|
666
708
|
if radius_is_scalar:
|
|
667
|
-
instancer.GetWidthsAttr().Set([radius] * len(points))
|
|
709
|
+
instancer.GetWidthsAttr().Set([radius * 2.0] * len(points))
|
|
668
710
|
else:
|
|
669
|
-
instancer.GetWidthsAttr().Set(radius)
|
|
711
|
+
instancer.GetWidthsAttr().Set(radius * 2.0)
|
|
670
712
|
|
|
671
713
|
if colors is None:
|
|
672
714
|
instancer.GetPositionsAttr().Set(points, self.time)
|
|
@@ -694,6 +736,6 @@ class UsdRenderer:
|
|
|
694
736
|
try:
|
|
695
737
|
self.stage.Save()
|
|
696
738
|
return True
|
|
697
|
-
except:
|
|
698
|
-
print("Failed to save USD stage")
|
|
739
|
+
except Exception as e:
|
|
740
|
+
print("Failed to save USD stage:", e)
|
|
699
741
|
return False
|
warp/sim/__init__.py
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# license agreement from NVIDIA CORPORATION is strictly prohibited.
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
from .model import State, Model, ModelBuilder, Mesh, SDF
|
|
9
|
+
from .model import State, Control, Model, ModelBuilder, Mesh, SDF
|
|
10
10
|
|
|
11
11
|
from .model import GEO_SPHERE
|
|
12
12
|
from .model import GEO_BOX
|
|
@@ -17,13 +17,13 @@ from .model import GEO_MESH
|
|
|
17
17
|
from .model import GEO_SDF
|
|
18
18
|
from .model import GEO_PLANE
|
|
19
19
|
from .model import GEO_NONE
|
|
20
|
-
from .model import ModelShapeGeometry
|
|
21
20
|
|
|
22
|
-
from .model import
|
|
21
|
+
from .model import JOINT_MODE_FORCE
|
|
23
22
|
from .model import JOINT_MODE_TARGET_POSITION
|
|
24
23
|
from .model import JOINT_MODE_TARGET_VELOCITY
|
|
25
24
|
|
|
26
25
|
from .model import JointAxis
|
|
26
|
+
from .model import ModelShapeGeometry
|
|
27
27
|
from .model import ModelShapeMaterials
|
|
28
28
|
|
|
29
29
|
from .model import JOINT_PRISMATIC
|
|
@@ -36,8 +36,10 @@ from .model import JOINT_UNIVERSAL
|
|
|
36
36
|
from .model import JOINT_DISTANCE
|
|
37
37
|
from .model import JOINT_D6
|
|
38
38
|
|
|
39
|
+
from .integrator import Integrator, integrate_particles, integrate_bodies
|
|
39
40
|
from .integrator_euler import SemiImplicitIntegrator
|
|
40
|
-
|
|
41
|
+
|
|
42
|
+
from .integrator_featherstone import FeatherstoneIntegrator
|
|
41
43
|
|
|
42
44
|
from .integrator_xpbd import XPBDIntegrator
|
|
43
45
|
|
|
@@ -48,3 +50,10 @@ from .import_mjcf import parse_mjcf
|
|
|
48
50
|
from .import_urdf import parse_urdf
|
|
49
51
|
from .import_snu import parse_snu
|
|
50
52
|
from .import_usd import parse_usd, resolve_usd_from_url
|
|
53
|
+
|
|
54
|
+
from .utils import velocity_at_point
|
|
55
|
+
from .utils import quat_from_euler
|
|
56
|
+
from .utils import quat_to_euler
|
|
57
|
+
from .utils import load_mesh
|
|
58
|
+
|
|
59
|
+
from .inertia import transform_inertia
|
warp/sim/articulation.py
CHANGED
|
@@ -105,7 +105,7 @@ def compute_3d_rotational_dofs(
|
|
|
105
105
|
local_1 = wp.quat_rotate(q_off, wp.vec3(0.0, 1.0, 0.0))
|
|
106
106
|
local_2 = wp.quat_rotate(q_off, wp.vec3(0.0, 0.0, 1.0))
|
|
107
107
|
|
|
108
|
-
# reconstruct rotation axes
|
|
108
|
+
# reconstruct rotation axes
|
|
109
109
|
axis_0 = local_0
|
|
110
110
|
q_0 = wp.quat_from_axis_angle(axis_0, q0)
|
|
111
111
|
|
|
@@ -331,10 +331,9 @@ def eval_articulation_fk(
|
|
|
331
331
|
iq = q_start + lin_axis_count
|
|
332
332
|
iqd = qd_start + lin_axis_count
|
|
333
333
|
if ang_axis_count == 1:
|
|
334
|
-
axis = joint_axis[
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
vel_w = joint_qd[qd_start + lin_axis_count + 0] * axis
|
|
334
|
+
axis = joint_axis[ia]
|
|
335
|
+
rot = wp.quat_from_axis_angle(axis, joint_q[iq])
|
|
336
|
+
vel_w = joint_qd[iqd] * axis
|
|
338
337
|
if ang_axis_count == 2:
|
|
339
338
|
rot, vel_w = compute_2d_rotational_dofs(
|
|
340
339
|
joint_axis[ia + 0],
|