hello-robot / stretch_mujoco

This library provides the simulation stack for Stretch with Mujoco.
BSD 3-Clause Clear License
16 stars 5 forks source link

Add Robocasa Object Placements #23

Closed hello-fazil closed 2 months ago

hello-fazil commented 2 months ago

This PR fixes the task-specific object placements that use the default randomly generated placement distribution fixture provided by Robocasa, which was missing previously. The Object placements should work for any Kitchen task registered from Robocasa here, including Single-Stage/Multi-Stage.

Placing [Object 0] (category: carrot, body_name: obj_0_main) at pos: [ 0.89 -0.48  0.95] quat: [0.99 0.   0.   0.12]
Placing [Object 1] (category: orange, body_name: obj_1_main) at pos: [ 1.79 -0.53  0.97] quat: [1.   0.   0.   0.07]
Placing [Object 2] (category: bottled_water, body_name: unwashable_obj_0_main) at pos: [ 1.6  -0.6   1.01] quat: [1. 0. 0. 0.]
Placing [Object 3] (category: tray, body_name: receptacle_main) at pos: [ 1.83 -0.24  0.96] quat: [1.   0.   0.   0.02]
Placing [Object 0] (category: mushroom, body_name: obj_0_main) at pos: [ 3.38 -2.23  0.95] quat: [0.12 0.   0.   0.99]
Placing [Object 1] (category: water_bottle, body_name: unwashable_obj_0_main) at pos: [ 3.46 -2.08  1.03] quat: [-0.15  0.    0.    0.99]
Placing [Object 2] (category: bottled_water, body_name: unwashable_obj_1_main) at pos: [ 3.56 -2.21  1.02] quat: [-0.11  0.    0.    0.99]
Placing [Object 3] (category: tray, body_name: receptacle_main) at pos: [ 1.94 -2.36  0.95] quat: [0.1 0.  0.  1. ]
Placing [Object 0] (category: beer, body_name: alcohol1_main) at pos: [ 1.83 -0.47  1.03] quat: [0.96 0.   0.   0.27]
Placing [Object 1] (category: beer, body_name: alcohol2_main) at pos: [ 1.67 -0.52  0.95] quat: [ 1.  0.  0. -0.]
Placing [Object 2] (category: water_bottle, body_name: non_alcohol1_main) at pos: [ 1.67 -0.3   1.03] quat: [ 0.96  0.    0.   -0.28]
Placing [Object 3] (category: can, body_name: non_alcohol2_main) at pos: [ 1.87 -0.45  0.98] quat: [0.94 0.   0.   0.33

Additionally now the [robocasa_gen.model_generation_wizard()]() API unpacks an additional element object_infos dictionary which has info on objects placement.

from stretch_mujoco import robocasa_gen
model, xml, objects_info = robocasa_gen.model_generation_wizard(task="ClearClutter", layout=0, style=1)
print(objects_info)
"""
{'obj_0_main': {'cat': 'potato',
                'pos': (0.8259696447487488, -0.4930029668187229, 0.9545504916),
                'quat': array([ 0.9834313 ,  0.        ,  0.        , -0.18128128], dtype=float32)},
 'obj_1_main': {'cat': 'bell_pepper',
                'pos': (0.6341548938033538,  -0.36549036909803156, 0.9615796320000001),
                'quat': array([ 0.9885259 ,  0.        ,  0.        , -0.15105131], dtype=float32)},
 'receptacle_main': {'cat': 'tray',
                     'pos': (1.7366825016273466, -0.23383657879200015, 0.9410638872),
                     'quat': array([ 0.99955136,  0.        ,  0.        , -0.02995089], dtype=float32)},
 'unwashable_obj_0_main': {'cat': 'teapot',
                           'pos': (0.6242942288114184,  -0.4940240521157808, 0.9750751375000001),
                           'quat': array([1.0000000e+00, 0.0000000e+00, 0.0000000e+00, 1.4759951e-04],dtype=float32)},
 'unwashable_obj_1_main': {'cat': 'beer',
                           'pos': (0.7409171927843065, -0.3259462942648694, 1.022),
                           'quat': array([0.9804823 , 0.        , 0.        , 0.19660743], dtype=float32)}}
"""