-
Notifications
You must be signed in to change notification settings - Fork 13
Customization
One can adjust stiffness, elasticity, damping effect, texture, etc. through run arguments. This is the easiest way to customize DEDO. Example:
python -m dedo.demo --env=HangBag-v0 \
--cam_resolution 200 \
--viz \
--debug \
--deform_elastic_stiffness 12 \
--disable_self_collision \
--deform_init_pos 1.0 0.0 0.0 \
--deform_texture_file=textures/deform/pb_whitered_checker.jpg
To load custom object one would first have to fill an entry in DEFORM_INFO in
dedo/utils/task_info.py. The key should the the .obj file path relative to data/ or an absolute path:
Below is an example with annotation
DEFORM_INFO = {
...
# An example of info for a custom item.
'bags/custom.obj': {
'deform_init_pos': [0, 0.47, 0.47], # Initial position
'deform_init_ori': [np.pi/2, 0, 0], # Initial scale
'deform_scale': 0.1, # Object Scale
'deform_elastic_stiffness': 1.0, # The stiffness constraint for the elasticity factor
'deform_bending_stiffness': 1.0, # The stiffness constraint for the bending factor
'deform_damping_stiffness': 1.0, # The spring damping factor
'deform_friction_coeff': 0.1, # The Friction coefficient
'deform_anchor_vertices': [ # Annotated indices of vertex that each anchor grabs on to. (optional)
[0],[0]
]
'deform_true_loop_vertices': [ # Indices of vertices that make up the ground truth vertices for each hole (optional)
[0, 1, 2, 3]
]
'deform_texture_file': 'textures/deform/pb_leopard.png', # texture of the deformable object
'plane_texture_file': 'textures/plane/cobblestone.jpg', # Texture of the ground
'rigid_texture_file': "textures/rigid/concrete.jpg", # Texture of the rigid object
},
Then you can use --override_deform_obj flag:
python -m dedo.demo --env=HangBag-v0 --cam_resolution 200 --viz --debug \
--override_deform_obj bags/custom.obj
For items not in DEFORM_DICT you will need to specify sensible defaults,
for example:
python -m dedo.demo --env=HangGarment-v0 --viz --debug \
--override_deform_obj=generated_cloth/generated_cloth.obj \
--deform_init_pos 0.02 0.41 0.63 --deform_init_ori 0 0 1.5708
Example of scaling up the custom mesh objects:
python -m dedo.demo --env=HangGarment-v0 --viz --debug \
--override_deform_obj=generated_cloth/generated_cloth.obj \
--deform_init_pos 0.02 0.41 0.55 --deform_init_ori 0 0 1.5708 \
--deform_scale 2.0 --anchor_init_pos -0.10 0.40 0.70 \
--other_anchor_init_pos 0.10 0.40 0.70
Not all objects have anchor points annotated, for example the Sewing Database which has 22,000 unannotated objects.
Therefore we provide a mechanism for DEDO to grab on to the closest vertex given initial anchor point.
This is done through --anchor_init_pos and --other_anchor_init_pos flags, for more info pleae refer to the Anchor/grasping args section of Argument Reference .
Note that these flags will be ignored if ground truth is given deform_anchor_vertices is provided.
DEDO also supports easy addition of custom scenes.
Scene setup is stored in SCENE_INFO dictionary.
Below is an annotated example of the DressGarment scene setup
SCENE_INFO = {
...
'dress': { # Name of the scene
'entities': {
'urdf/figure_headless.urdf': { # Scene object's name, relative path to "dedo/data" dir.
'basePosition': [-0.22, 0, 3.00], # Scene object's base position
'baseOrientation': [0, 0, np.pi / 2], # Scene object's base orientation
'globalScaling': 10, # Scene object's scale
'useTexture': True, # Whether object should receive texturing (normally Yes)
},
'head_with_ears2.obj': {
'basePosition': [-0.22, 0.00, 6.54], # [-0.22, 0.00, 0.64],
'baseOrientation': [0, 0, np.pi * 1.05],
'globalScaling': 0.4,
'rgbaColor': (0.9, 0.75, 0.65, 1), # Scene object color in rgba (if texture is not specified)
},
},
'goal_pos': [[-1, -0.23, 5.3], # Goal position (For the corresponding ground truth vertices specified in deform_true_loop_vertices)
[0.6, -0.23, 5.3], ],
},
}
As one can notice, many of the configuration in DEFORM_DICT are identical to that of the run arguments. This is because DEFORM is eventually merged into the args object given by the ArgParser. In theory, one can preset any args inside DEFORM_DICT dictionary for any object.