@@ -127,17 +127,18 @@ def put_model(mjm: mujoco.MjModel) -> types.Model:
127
127
tile_beg = tile_corners [i ]
128
128
tile_end = mjm .nv if i == len (tile_corners ) - 1 else tile_corners [i + 1 ]
129
129
tiles .setdefault (tile_end - tile_beg , []).append (tile_beg )
130
+
130
131
qM_tiles = tuple (types .TileSet (adr = wp .array (tiles [sz ], dtype = int ), size = sz ) for sz in sorted (tiles .keys ()))
131
132
132
- # subtree_mass is a precalculated arrya used in smooth
133
+ # subtree_mass is a precalculated array used in smooth
133
134
subtree_mass = np .copy (mjm .body_mass )
134
135
# TODO(team): should this be [mjm.nbody - 1, 0) ?
135
136
for i in range (mjm .nbody - 1 , - 1 , - 1 ):
136
137
subtree_mass [mjm .body_parentid [i ]] += subtree_mass [i ]
137
138
138
139
# actuator_moment tiles are grouped by dof size and number of actuators
139
- tree_id = mjm . dof_treeid [ tile_corners ]
140
- num_trees = int (np .max (tree_id ))
140
+ tree_id = np . arange ( len ( tile_corners ), dtype = np . int32 )
141
+ num_trees = int (np .max (tree_id )) if len ( tree_id ) > 0 else 0
141
142
bodyid = []
142
143
for i in range (mjm .nu ):
143
144
trntype = mjm .actuator_trntype [i ]
@@ -250,7 +251,7 @@ def put_model(mjm: mujoco.MjModel) -> types.Model:
250
251
nxn_geom_pair .append ((geom1 , geom2 ))
251
252
nxn_pairid .append (pairid )
252
253
253
- return types .Model (
254
+ m = types .Model (
254
255
nq = mjm .nq ,
255
256
nv = mjm .nv ,
256
257
nu = mjm .nu ,
@@ -270,6 +271,8 @@ def put_model(mjm: mujoco.MjModel) -> types.Model:
270
271
nwrap = mjm .nwrap ,
271
272
nsensor = mjm .nsensor ,
272
273
nsensordata = mjm .nsensordata ,
274
+ nmeshvert = mjm .nmeshvert ,
275
+ nmeshface = mjm .nmeshface ,
273
276
nlsp = nlsp ,
274
277
npair = mjm .npair ,
275
278
opt = types .Option (
@@ -375,6 +378,8 @@ def put_model(mjm: mujoco.MjModel) -> types.Model:
375
378
geom_condim = wp .array (mjm .geom_condim , dtype = int ),
376
379
geom_bodyid = wp .array (mjm .geom_bodyid , dtype = int ),
377
380
geom_dataid = wp .array (mjm .geom_dataid , dtype = int ),
381
+ geom_group = wp .array (mjm .geom_group , dtype = int ),
382
+ geom_matid = wp .array (mjm .geom_matid , dtype = int ),
378
383
geom_priority = wp .array (mjm .geom_priority , dtype = int ),
379
384
geom_solmix = wp .array (mjm .geom_solmix , dtype = float ),
380
385
geom_solref = wp .array (mjm .geom_solref , dtype = wp .vec2 ),
@@ -387,6 +392,7 @@ def put_model(mjm: mujoco.MjModel) -> types.Model:
387
392
geom_friction = wp .array (mjm .geom_friction , dtype = wp .vec3 ),
388
393
geom_margin = wp .array (mjm .geom_margin , dtype = float ),
389
394
geom_gap = wp .array (mjm .geom_gap , dtype = float ),
395
+ geom_rgba = wp .array (mjm .geom_rgba , dtype = wp .vec4 ),
390
396
site_bodyid = wp .array (mjm .site_bodyid , dtype = int ),
391
397
site_pos = wp .array (mjm .site_pos , dtype = wp .vec3 ),
392
398
site_quat = wp .array (mjm .site_quat , dtype = wp .quat ),
@@ -411,6 +417,8 @@ def put_model(mjm: mujoco.MjModel) -> types.Model:
411
417
mesh_vertadr = wp .array (mjm .mesh_vertadr , dtype = int ),
412
418
mesh_vertnum = wp .array (mjm .mesh_vertnum , dtype = int ),
413
419
mesh_vert = wp .array (mjm .mesh_vert , dtype = wp .vec3 ),
420
+ mesh_faceadr = wp .array (mjm .mesh_faceadr , dtype = int ),
421
+ mesh_face = wp .array (mjm .mesh_face , dtype = wp .vec3i ),
414
422
eq_type = wp .array (mjm .eq_type , dtype = int ),
415
423
eq_obj1id = wp .array (mjm .eq_obj1id , dtype = int ),
416
424
eq_obj2id = wp .array (mjm .eq_obj2id , dtype = int ),
@@ -517,8 +525,11 @@ def put_model(mjm: mujoco.MjModel) -> types.Model:
517
525
mujoco .mjtSensor .mjSENS_FRAMEANGACC ,
518
526
],
519
527
).any (),
528
+ mat_rgba = wp .array (mjm .mat_rgba , dtype = wp .vec4 ),
520
529
)
521
530
531
+ return m
532
+
522
533
523
534
def make_data (mjm : mujoco .MjModel , nworld : int = 1 , nconmax : int = - 1 , njmax : int = - 1 ) -> types .Data :
524
535
# TODO(team): move to Model?
0 commit comments