Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
18dfe90
Initial draft of ray cast queries
nvtw Apr 10, 2025
f65d95a
Add missing test files
nvtw Apr 10, 2025
92ed8d5
Fix a couple of errors
nvtw Apr 10, 2025
848b6fb
Fix more warp compatibility issues
nvtw Apr 11, 2025
2a90a61
Adapting the tests to warp
nvtw Apr 11, 2025
fba0207
Tetrahedron test working
nvtw Apr 11, 2025
bc44ac5
Forgot to save a file
nvtw Apr 11, 2025
62f9fd5
Add early out
nvtw Apr 11, 2025
b2038cb
Fix dodecahedron test
nvtw Apr 11, 2025
62077a4
Started to introduce geomgroup
nvtw Apr 11, 2025
daa4241
First draft of filter logic
nvtw Apr 11, 2025
0a301cd
test_ray_flg_static and test_ray_bodyexclude start to work
nvtw Apr 11, 2025
a8d58c9
All tests pass
nvtw Apr 11, 2025
b1397fc
Merge branch 'main' into dev/tw/ray_casting
nvtw Apr 11, 2025
815fd29
Fix linter issues
nvtw Apr 11, 2025
0f77d28
Implement first round of MR remarks
nvtw Apr 14, 2025
279a5e4
Make _ray_box more similar to mujoco
nvtw Apr 14, 2025
6cf2bf6
Follow the original even more closely
nvtw Apr 14, 2025
bf609ec
Add test test_ray_invisible
nvtw Apr 14, 2025
844cf8a
Rename ray_geom to ray
nvtw Apr 14, 2025
e666462
Merge branch 'main' into dev/tw/ray_casting
nvtw Apr 22, 2025
8b3e6fd
Merge branch 'main' into dev/tw/ray_casting
nvtw Apr 29, 2025
2587108
Merge branch 'main' into dev/tw/ray_casting
nvtw Apr 30, 2025
0cd1b17
Fixed cpu implementation
nvtw Apr 30, 2025
6dbc655
Merge branch 'main' into dev/tw/ray_casting
nvtw May 5, 2025
af389a6
Merge branch 'main' into dev/tw/ray_casting
nvtw May 12, 2025
3531da5
Reset io.py and types.py to the state of master since the merge was t…
nvtw May 12, 2025
7e1b50c
Bring back vec6 type
nvtw May 12, 2025
1eb27b5
Avoid using full model and data classes in ray casting
nvtw May 12, 2025
0388b72
Fix tests
nvtw May 12, 2025
697b593
Fix style issues
nvtw May 12, 2025
1b41b2e
Add overload for _ray_geom as requested in MR
nvtw May 12, 2025
b8bd380
Removed unused stl file
nvtw May 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mujoco_warp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from ._src.io import put_data as put_data
from ._src.io import put_model as put_model
from ._src.passive import passive as passive
from ._src.ray import ray as ray
from ._src.sensor import sensor_acc as sensor_acc
from ._src.sensor import sensor_pos as sensor_pos
from ._src.sensor import sensor_vel as sensor_vel
Expand Down
24 changes: 19 additions & 5 deletions mujoco_warp/_src/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ def put_model(mjm: mujoco.MjModel) -> types.Model:
m.nwrap = mjm.nwrap
m.nsensor = mjm.nsensor
m.nsensordata = mjm.nsensordata
m.nmeshvert = mjm.nmeshvert
m.nmeshface = mjm.nmeshface
m.nlsp = mjm.opt.ls_iterations # TODO(team): how to set nlsp?
m.npair = mjm.npair
m.nexclude = mjm.nexclude
Expand Down Expand Up @@ -281,10 +283,15 @@ def put_model(mjm: mujoco.MjModel) -> types.Model:
tile_beg = tile_corners[i]
tile_end = mjm.nv if i == len(tile_corners) - 1 else tile_corners[i + 1]
tiles.setdefault(tile_end - tile_beg, []).append(tile_beg)
qLD_tile = np.concatenate([tiles[sz] for sz in sorted(tiles.keys())])
tile_off = [0] + [len(tiles[sz]) for sz in sorted(tiles.keys())]
qLD_tileadr = np.cumsum(tile_off)[:-1]
qLD_tilesize = np.array(sorted(tiles.keys()))
if tiles:
qLD_tile = np.concatenate([tiles[sz] for sz in sorted(tiles.keys())])
tile_off = [0] + [len(tiles[sz]) for sz in sorted(tiles.keys())]
qLD_tileadr = np.cumsum(tile_off)[:-1]
qLD_tilesize = np.array(sorted(tiles.keys()))
else:
qLD_tile = np.array([], dtype=int)
qLD_tileadr = np.array([], dtype=int)
qLD_tilesize = np.array([], dtype=int)

# tiles for actuator_moment - needs nu + nv tile size and offset
actuator_moment_offset_nv = np.empty(shape=(0,), dtype=int)
Expand All @@ -297,7 +304,7 @@ def put_model(mjm: mujoco.MjModel) -> types.Model:
# how many actuators for each tree
tile_corners = [i for i in range(mjm.nv) if mjm.dof_parentid[i] == -1]
tree_id = mjm.dof_treeid[tile_corners]
num_trees = int(np.max(tree_id))
num_trees = int(np.max(tree_id)) if len(tree_id) > 0 else 0
tree = mjm.body_treeid[mjm.jnt_bodyid[mjm.actuator_trnid[:, 0]]]
counts, ids = np.histogram(tree, bins=np.arange(0, num_trees + 2))
acts_per_tree = dict(zip([int(i) for i in ids], [int(i) for i in counts]))
Expand Down Expand Up @@ -416,12 +423,17 @@ def put_model(mjm: mujoco.MjModel) -> types.Model:
m.geom_friction = wp.array(mjm.geom_friction, dtype=wp.vec3, ndim=1)
m.geom_margin = wp.array(mjm.geom_margin, dtype=wp.float32, ndim=1)
m.geom_gap = wp.array(mjm.geom_gap, dtype=wp.float32, ndim=1)
m.geom_rgba = wp.array(mjm.geom_rgba, dtype=wp.vec4, ndim=1)
m.geom_aabb = wp.array(mjm.geom_aabb, dtype=wp.vec3, ndim=3)
m.geom_rbound = wp.array(mjm.geom_rbound, dtype=wp.float32, ndim=1)
m.geom_dataid = wp.array(mjm.geom_dataid, dtype=wp.int32, ndim=1)
m.geom_group = wp.array(mjm.geom_group, dtype=wp.int32, ndim=1)
m.geom_matid = wp.array(mjm.geom_matid, dtype=wp.int32, ndim=1)
m.mesh_vertadr = wp.array(mjm.mesh_vertadr, dtype=wp.int32, ndim=1)
m.mesh_vertnum = wp.array(mjm.mesh_vertnum, dtype=wp.int32, ndim=1)
m.mesh_vert = wp.array(mjm.mesh_vert, dtype=wp.vec3, ndim=1)
m.mesh_faceadr = wp.array(mjm.mesh_faceadr, dtype=wp.int32, ndim=1)
m.mesh_face = wp.array(mjm.mesh_face, dtype=wp.vec3i, ndim=1)
m.eq_type = wp.array(mjm.eq_type, dtype=wp.int32, ndim=1)
m.eq_obj1id = wp.array(mjm.eq_obj1id, dtype=wp.int32, ndim=1)
m.eq_obj2id = wp.array(mjm.eq_obj2id, dtype=wp.int32, ndim=1)
Expand Down Expand Up @@ -508,6 +520,8 @@ def put_model(mjm: mujoco.MjModel) -> types.Model:
m.pair_friction = wp.array(mjm.pair_friction, dtype=types.vec5, ndim=1)
m.condim_max = np.max(mjm.geom_condim) # TODO(team): get max after filtering

m.mat_rgba = wp.array(mjm.mat_rgba, dtype=wp.vec4, ndim=1)

# tendon
m.tendon_adr = wp.array(mjm.tendon_adr, dtype=wp.int32, ndim=1)
m.tendon_num = wp.array(mjm.tendon_num, dtype=wp.int32, ndim=1)
Expand Down
Loading
Loading