Skip to content

Commit

Permalink
Move gym from habitat_baselines to habitat (facebookresearch#864)
Browse files Browse the repository at this point in the history
* merging

* -

* Updating configs

* -

* -

* -

* fixing tests

* fixing tests

* changing configs

* Update habitat/tasks/rearrange/multi_task/composite_sensors.py

Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>

* Update habitat/tasks/rearrange/multi_task/composite_sensors.py

Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>

* addressing comments

Co-authored-by: vincentpierre <vincentpierre@users.noreply.github.com>
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
  • Loading branch information
3 people authored May 10, 2022
1 parent 0234c90 commit 167a552
Show file tree
Hide file tree
Showing 52 changed files with 456 additions and 416 deletions.
13 changes: 10 additions & 3 deletions configs/tasks/rearrange/close_cab.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
GYM:
AUTO_NAME: "CloseCab"
OBS_KEYS: ['joint', 'ee_pos', 'is_holding', 'marker_rel_pos', 'marker_js', 'relative_resting_position']
CLASS_NAME: "RearrangeRLEnv"
ENVIRONMENT:
MAX_EPISODE_STEPS: 200
DATASET:
Expand All @@ -23,9 +27,12 @@ TASK:
USE_MARKER_T: True
SUCCESS_STATE: 0.0

# Measurements for composite tasks.
REWARD_MEASUREMENT: "art_obj_reward"
SUCCESS_MEASUREMENT: "art_obj_success"
REWARD_MEASURE: "art_obj_reward"
SUCCESS_MEASURE: "art_obj_success"
SUCCESS_REWARD: 10.0
SLACK_REWARD: 0.0
END_ON_SUCCESS: True


# If true, does not care about navigability or collisions with objects when spawning
# robot
Expand Down
12 changes: 9 additions & 3 deletions configs/tasks/rearrange/close_fridge.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
GYM:
AUTO_NAME: "CloseFridge"
OBS_KEYS: ['joint', 'ee_pos', 'is_holding', 'marker_rel_pos', 'marker_js', 'relative_resting_position']
CLASS_NAME: "RearrangeRLEnv"
ENVIRONMENT:
MAX_EPISODE_STEPS: 200
DATASET:
Expand All @@ -22,9 +26,11 @@ TASK:
USE_MARKER_T: False
SUCCESS_STATE: 0.0

# Measurements for composite tasks.
REWARD_MEASUREMENT: "art_obj_reward"
SUCCESS_MEASUREMENT: "art_obj_success"
REWARD_MEASURE: "art_obj_reward"
SUCCESS_MEASURE: "art_obj_success"
SUCCESS_REWARD: 10.0
SLACK_REWARD: 0.0
END_ON_SUCCESS: True

# If true, does not care about navigability or collisions with objects when spawning
# robot
Expand Down
10 changes: 10 additions & 0 deletions configs/tasks/rearrange/nav_pick.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
GYM:
AUTO_NAME: "NavPick"
OBS_KEYS: ['robot_head_depth', 'obj_start_sensor', 'joint', 'is_holding', 'relative_resting_position']
CLASS_NAME: "RearrangeRLEnv"
ENVIRONMENT:
MAX_EPISODE_STEPS: 500
DATASET:
Expand All @@ -7,6 +11,12 @@ DATASET:
SCENES_DIR: data/replica_cad/
TASK:
TYPE: RearrangeCompositeTask-v0

REWARD_MEASURE: "move_obj_reward"
SUCCESS_MEASURE: "composite_success"
SUCCESS_REWARD: 100.0
SLACK_REWARD: -0.01

MAX_COLLISIONS: -1.0
COUNT_OBJ_COLLISIONS: true
COUNT_ROBOT_OBJ_COLLS: false
Expand Down
10 changes: 10 additions & 0 deletions configs/tasks/rearrange/nav_pick_nav_place.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
GYM:
CLASS_NAME: "RearrangeRLEnv"
AUTO_NAME: "NavPickNavPlace"
OBS_KEYS: ['robot_head_depth', 'obj_start_sensor', 'joint', 'is_holding', 'relative_resting_position']
ENVIRONMENT:
MAX_EPISODE_STEPS: 500
DATASET:
Expand All @@ -7,6 +11,12 @@ DATASET:
SCENES_DIR: data/replica_cad/
TASK:
TYPE: RearrangeCompositeTask-v0

REWARD_MEASURE: "move_obj_reward"
SUCCESS_MEASURE: "composite_success"
SUCCESS_REWARD: 100.0
SLACK_REWARD: -0.01

MAX_COLLISIONS: -1.0
COUNT_OBJ_COLLISIONS: true
COUNT_ROBOT_OBJ_COLLS: false
Expand Down
12 changes: 9 additions & 3 deletions configs/tasks/rearrange/nav_to_obj.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
GYM:
AUTO_NAME: "NavToObj"
OBS_KEYS: ["object_to_agent_gps_compass", 'joint']
CLASS_NAME: "RearrangeRLEnv"
ENVIRONMENT:
MAX_EPISODE_STEPS: 400
DATASET:
Expand Down Expand Up @@ -27,9 +31,11 @@ TASK:
OBJ_SUCC_THRESH: 0.3
ART_SUCC_THRESH: 0.15

# Measurements for composite tasks.
REWARD_MEASUREMENT: "nav_to_obj_reward"
SUCCESS_MEASUREMENT: "nav_to_obj_success"
REWARD_MEASURE: "nav_to_obj_reward"
SUCCESS_MEASURE: "nav_to_obj_success"
SUCCESS_REWARD: 10.0
SLACK_REWARD: 0.0
END_ON_SUCCESS: True

TARGET_START_POINT_GOAL_SENSOR:
TYPE: "TargetOrGoalStartPointGoalSensor"
Expand Down
12 changes: 9 additions & 3 deletions configs/tasks/rearrange/open_cab.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
GYM:
AUTO_NAME: "OpenCab"
OBS_KEYS: ['joint', 'ee_pos', 'is_holding', 'marker_rel_pos', 'marker_js', 'relative_resting_position']
CLASS_NAME: "RearrangeRLEnv"
ENVIRONMENT:
MAX_EPISODE_STEPS: 200
DATASET:
Expand Down Expand Up @@ -25,9 +29,11 @@ TASK:
USE_MARKER_T: True
SUCCESS_STATE: 0.45

# Measurements for composite tasks.
REWARD_MEASUREMENT: "art_obj_reward"
SUCCESS_MEASUREMENT: "art_obj_success"
REWARD_MEASURE: "art_obj_reward"
SUCCESS_MEASURE: "art_obj_success"
SUCCESS_REWARD: 10.0
SLACK_REWARD: 0.0
END_ON_SUCCESS: True

# If true, does not care about navigability or collisions with objects when spawning
# robot
Expand Down
12 changes: 9 additions & 3 deletions configs/tasks/rearrange/open_fridge.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
GYM:
AUTO_NAME: "OpenFridge"
OBS_KEYS: ['joint', 'ee_pos', 'is_holding', 'marker_rel_pos', 'marker_js', 'relative_resting_position']
CLASS_NAME: "RearrangeRLEnv"
ENVIRONMENT:
MAX_EPISODE_STEPS: 200
DATASET:
Expand Down Expand Up @@ -25,9 +29,11 @@ TASK:
# (pi/2) - 0.35
SUCCESS_STATE: 1.2207963268

# Measurements for composite tasks.
REWARD_MEASUREMENT: "art_obj_reward"
SUCCESS_MEASUREMENT: "art_obj_success"
REWARD_MEASURE: "art_obj_reward"
SUCCESS_MEASURE: "art_obj_success"
SUCCESS_REWARD: 10.0
SLACK_REWARD: 0.0
END_ON_SUCCESS: True

# If true, does not care about navigability or collisions with objects when spawning
# robot
Expand Down
12 changes: 9 additions & 3 deletions configs/tasks/rearrange/pick.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
GYM:
AUTO_NAME: "Pick"
OBS_KEYS: ['robot_head_depth', 'obj_start_sensor', 'joint', 'is_holding', 'relative_resting_position']
CLASS_NAME: "RearrangeRLEnv"
ENVIRONMENT:
MAX_EPISODE_STEPS: 200
DATASET:
Expand All @@ -20,9 +24,11 @@ TASK:
CONSTRAINT_VIOLATION_ENDS_EPISODE: True
FORCE_REGENERATE: False

# Measurements for composite tasks.
REWARD_MEASUREMENT: "rearrangepick_reward"
SUCCESS_MEASUREMENT: "rearrangepick_success"
REWARD_MEASURE: "rearrangepick_reward"
SUCCESS_MEASURE: "rearrangepick_success"
SUCCESS_REWARD: 100.0
SLACK_REWARD: -0.01
END_ON_SUCCESS: True

# If true, does not care about navigability or collisions with objects when spawning
# robot
Expand Down
11 changes: 8 additions & 3 deletions configs/tasks/rearrange/place.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
GYM:
AUTO_NAME: "Place"
OBS_KEYS: ['obj_goal_sensor', 'joint', 'is_holding', 'relative_resting_position']
CLASS_NAME: "RearrangeRLEnv"
ENVIRONMENT:
MAX_EPISODE_STEPS: 200
DATASET:
Expand All @@ -21,9 +25,10 @@ TASK:
DESIRED_RESTING_POSITION: [0.5, 0.0, 1.0]
FORCE_REGENERATE: False

# Measurements for composite tasks.
REWARD_MEASUREMENT: "place_reward"
SUCCESS_MEASUREMENT: "place_success"
REWARD_MEASURE: "place_reward"
SUCCESS_MEASURE: "place_success"
SUCCESS_REWARD: 10.0
SLACK_REWARD: 0.0

# If true, does not care about navigability or collisions with objects when spawning
# robot
Expand Down
10 changes: 10 additions & 0 deletions configs/tasks/rearrange/prepare_groceries.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
GYM:
CLASS_NAME: "RearrangeRLEnv"
AUTO_NAME: "PrepareGroceries"
OBS_KEYS: ['robot_head_depth', 'obj_start_sensor', 'joint', 'is_holding', 'relative_resting_position']
ENVIRONMENT:
MAX_EPISODE_STEPS: 4000
DATASET:
Expand All @@ -7,6 +11,12 @@ DATASET:
SCENES_DIR: data/replica_cad/
TASK:
TYPE: RearrangeCompositeTask-v0

REWARD_MEASURE: "move_obj_reward"
SUCCESS_MEASURE: "composite_success"
SUCCESS_REWARD: 100.0
SLACK_REWARD: -0.01

MAX_COLLISIONS: -1.0
COUNT_OBJ_COLLISIONS: true
COUNT_ROBOT_OBJ_COLLS: false
Expand Down
9 changes: 9 additions & 0 deletions configs/tasks/rearrange/reach_state.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
GYM:
AUTO_NAME: "ReachState"
OBS_KEYS: ['joint', 'relative_resting_position']
ACTION_KEYS: ['ARM_ACTION']
CLASS_NAME: "RearrangeRLEnv"
ENVIRONMENT:
MAX_EPISODE_STEPS: 20
DATASET:
Expand All @@ -13,6 +18,10 @@ TASK:
EE_SAMPLE_FACTOR: 0.2
EE_EXCLUDE_REGION: 0.0

REWARD_MEASURE: "rearrange_reach_reward"
SUCCESS_MEASURE: "rearrange_reach_success"
SUCCESS_REWARD: 10.0

DESIRED_RESTING_POSITION: [0.5, 0.0, 1.0]

JOINT_SENSOR:
Expand Down
11 changes: 11 additions & 0 deletions configs/tasks/rearrange/set_table.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
GYM:
AUTO_NAME: "SetTable"
CLASS_NAME: "RearrangeRLEnv"
OBS_KEYS: ['robot_head_depth', 'obj_start_sensor', 'joint', 'is_holding', 'relative_resting_position']

ENVIRONMENT:
MAX_EPISODE_STEPS: 4500
DATASET:
Expand All @@ -7,6 +12,12 @@ DATASET:
SCENES_DIR: data/replica_cad/
TASK:
TYPE: RearrangeCompositeTask-v0

REWARD_MEASURE: "move_obj_reward"
SUCCESS_MEASURE: "composite_success"
SUCCESS_REWARD: 100.0
SLACK_REWARD: -0.01

MAX_COLLISIONS: -1.0
COUNT_OBJ_COLLISIONS: true
COUNT_ROBOT_OBJ_COLLS: false
Expand Down
10 changes: 10 additions & 0 deletions configs/tasks/rearrange/tidy_house.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
GYM:
CLASS_NAME: "RearrangeRLEnv"
AUTO_NAME: "TidyHouse"
OBS_KEYS: ['robot_head_depth', 'obj_start_sensor', 'joint', 'is_holding', 'relative_resting_position']
ENVIRONMENT:
MAX_EPISODE_STEPS: 5000
DATASET:
Expand All @@ -7,6 +11,12 @@ DATASET:
SCENES_DIR: data/replica_cad/
TASK:
TYPE: RearrangeCompositeTask-v0

REWARD_MEASURE: "move_obj_reward"
SUCCESS_MEASURE: "composite_success"
SUCCESS_REWARD: 100.0
SLACK_REWARD: -0.01

MAX_COLLISIONS: -1.0
COUNT_OBJ_COLLISIONS: true
COUNT_ROBOT_OBJ_COLLS: false
Expand Down
2 changes: 1 addition & 1 deletion examples/interactive_play.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
import habitat.tasks.rearrange.rearrange_task
from habitat.tasks.rearrange.actions import ArmEEAction
from habitat.tasks.rearrange.utils import euler_to_quat
from habitat.utils.render_wrapper import overlay_frame
from habitat.utils.visualizations.utils import observations_to_image
from habitat_baselines.utils.render_wrapper import overlay_frame
from habitat_sim.utils import viz_utils as vut

try:
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorials/colabs/Habitat2_Quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@
"import numpy as np\n",
"\n",
"import habitat\n",
"import habitat_baselines.utils.gym_definitions as habitat_gym\n",
"import habitat.utils.gym_definitions as habitat_gym\n",
"from habitat.core.embodied_task import Measure\n",
"from habitat.core.registry import registry\n",
"from habitat.core.simulator import Sensor, SensorTypes\n",
"from habitat.tasks.rearrange.rearrange_sensors import RearrangeReward\n",
"from habitat.tasks.rearrange.rearrange_task import RearrangeTask\n",
"from habitat.utils.render_wrapper import overlay_frame\n",
"from habitat.utils.visualizations.utils import observations_to_image\n",
"from habitat_baselines.utils.render_wrapper import overlay_frame\n",
"from habitat_sim.utils import viz_utils as vut\n",
"\n",
"# Quiet the Habitat simulator logging\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorials/colabs/habitat2_gym_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"import gym\n",
"\n",
"# flake8: noqa\n",
"import habitat_baselines.utils.gym_definitions"
"import habitat.utils.gym_definitions"
]
},
{
Expand Down Expand Up @@ -168,7 +168,7 @@
"env = gym.make(\n",
" \"HabitatPick-v0\",\n",
" override_options=[\n",
" \"TASK_CONFIG.TASK.ACTIONS.ARM_ACTION.GRIP_CONTROLLER\",\n",
" \"TASK.ACTIONS.ARM_ACTION.GRIP_CONTROLLER\",\n",
" \"SuctionGraspAction\",\n",
" ],\n",
")\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorials/nb_python/Habitat2_Quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@
import numpy as np

import habitat
import habitat_baselines.utils.gym_definitions as habitat_gym
import habitat.utils.gym_definitions as habitat_gym
from habitat.core.embodied_task import Measure
from habitat.core.registry import registry
from habitat.core.simulator import Sensor, SensorTypes
from habitat.tasks.rearrange.rearrange_sensors import RearrangeReward
from habitat.tasks.rearrange.rearrange_task import RearrangeTask
from habitat.utils.render_wrapper import overlay_frame
from habitat.utils.visualizations.utils import observations_to_image
from habitat_baselines.utils.render_wrapper import overlay_frame
from habitat_sim.utils import viz_utils as vut

# Quiet the Habitat simulator logging
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorials/nb_python/habitat2_gym_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
import gym

# flake8: noqa
import habitat_baselines.utils.gym_definitions
import habitat.utils.gym_definitions

# %% [markdown]
# # Simple Example
Expand Down Expand Up @@ -136,7 +136,7 @@
env = gym.make(
"HabitatPick-v0",
override_options=[
"TASK_CONFIG.TASK.ACTIONS.ARM_ACTION.GRIP_CONTROLLER",
"TASK.ACTIONS.ARM_ACTION.GRIP_CONTROLLER",
"SuctionGraspAction",
],
)
Expand Down
Loading

0 comments on commit 167a552

Please sign in to comment.