# cfg file for sim experiments
# main knobs to tune are init>type, env>goal_img

# ------------------------------------------------------------------------------
# Cloth parameters, should be loosely based on `cloth_from_184.,yaml`.
# ------------------------------------------------------------------------------

cloth:
    damping: 2.0            # Too slow if it's much above 2. :(
    density: 200.0          # Default is 150, increasing still results in a 'wispy' look, 400+ mean ugly self-collisions.
    ks: 10000.0             # Default is 5000. (HUGE NOTE I increased to 10k, higher = stiffer, lower = elastic/stretchy)
    enable_structural: true # Enable structural constraints.
    enable_shearing: true   # Enable shearing constraints.
    enable_bending: true    # Enable bending constraints.
    orientation: 1          # Manages xyz orientation.
    width: 1                # Set to 1 for simplicity.
    height: 1               # Set to 1 for simplicity.
    num_width_points: 25    # Number of points in x direction. KEEP AT 25.
    num_height_points: 25   # Number of points in y direction. KEEP AT 25.
    thickness: 0.0200       # For self-collisions; we do not want layers to collide.
    pin_cond: 'y=0'         # Determines which points are pinned. See `cloth.pyx`.
    color_pts: 'diag1'      # Determines which points are colored. See `cloth.pyx`.
    plane_friction: 1.0     # Corresopnds to 184's 'friction' in the 'plane' struct. Assume plane has normal=(0,0,1).
    tear_thresh: 2.0        # Tear thresh. I've found 2 to 3 works well. Set to >100 to basically ignore this feature.

frames_per_sec: 30          # In theory, but in practice we really render more often
simulation_steps: 30        # Actually an important hyperparameter to match with 184-based code.

# ------------------------------------------------------------------------------
# General 'env' parameters
# ------------------------------------------------------------------------------

env:
    max_actions: 15         # Max number of actions per episode. This should be on the order of 5 to 50.
    max_z_threshold: 5      # For now, we get high reward if all points are below this threshold (should fix)
    iters_up: 50            # For pulling cloth upwards (only z changes)
    iters_up_rest: 80       # Resting after pulling cloth upwards.
    iters_pull_max: 400     # Max number to pull; actions take a fraction of this.
    iters_grip_rest: 300    # No-ops to let cloth settle while being gripped --- needed for realism
    iters_rest: 1000        # No-ops to let the cloth rest (do larger to test if folds are stable...)
    updates_per_move: 1     # Should really be 1, ignore this?
    reduce_factor: 0.0020   # Multiply raw directions by this to make actions smaller
    grip_radius: 0.003      # alternative: .003, larger radius means we grab more points
    reward_type: 'coverage-delta' # See `ClothEnv` for possible types.
    force_grab: True       # Should ONLY be true for evaluation, never for training.
    clip_act_space: True    # Whether we assume our actions should be in [-1,1], might make it easier for RL
    delta_actions: True     # If True, our action for length/angle are deltas in x and y space.
    obs_type: 'blender'     # '1d' or 'blender'
    oracle_reveal: 'False'  # If 'True', we compute the occlusion vector every time Blender is called (should only be True if using corner revealing demonstrator)
    use_depth: 'False'      # If 'True', we use depth images for the training process instead of color images
    use_rgbd: 'True'        # If 'True', use both RGB and depth
    use_dom_rand: 'False'   
    goal_img: 'vismpc/goal_imgs/smooth.pkl' # '' for no goal image, otherwise file path to .pkl goal image
    goal_demo: '' # If non-empty, get subgoals from the demonstration in the given .pkl file.
    viz_vismpc: True # save images for inspection of vis dynamics and cost fns

# ------------------------------------------------------------------------------
# Initialization parameters. Let's assume we can pinpoint one of the four
# corners to fold, and we can automatically determine the coordinate to
# initially 'tension' from that. Corners: BL, BR, TL, TR (bottom/top,
# left/right). The (0,0) corner is at the BL. Actually it might be good to
# randomize but w/e. And we should know what stuff is pinned and what's not...
# ------------------------------------------------------------------------------

init:
    type: 'tier0'               # Options: tier0, tier1, tier2, tier3
    debug_matplotlib: False     # If we show matplotlib video of the initialization
    render_opengl: False        # If we show opengl rendering

# ------------------------------------------------------------------------------
# Logging. We add the date before the last `.log` in the file name.
# For random seed, use 1337-1400 for demonstrations.
# Use 1500 for *training*, and 1600 for *evaluation*.
# ------------------------------------------------------------------------------

log:
    level: debug                # Standard python logger level, use `info` or `debug`.
    file: logs/example.log      # File to save the logging, for debugging later.

seed: 1500                      # Random seed -- KEEP FIXED FOR REPRODUCIBILITY!
