Skip to content

Commit

Permalink
testing stuff on spot
Browse files Browse the repository at this point in the history
  • Loading branch information
wmcclinton committed Oct 10, 2024
1 parent 1cfaf71 commit c153fab
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
36 changes: 18 additions & 18 deletions predicators/envs/spot_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ def _get_sweeping_surface_for_container(container: Object,
_Inside = VLMPredicate(
"Inside", [_movable_object_type, _container_type],
prompt=
"This typically describes an object (obj1, first arg) inside a container (obj2, second arg) (so it's overlapping), and it's in conflict with the object being on a surface. This is obj1 inside obj2, so obj1 should be smaller than obj2."
"This typically describes when an object (obj1:type, first arg) is inside another object/container (obj2:type, second arg) (so it's overlapping), and it's in conflict with the object being on a surface. Inside(obj1:type, obj2:type) means obj1 is inside obj2, so obj1 should be smaller than obj2."
)
_FakeInside = VLMPredicate(
_Inside.name,
Expand Down Expand Up @@ -3399,7 +3399,7 @@ def _detection_id_to_obj(self) -> Dict[ObjectDetectionID, Object]:
# "green bowl/greenish bowl")
# TODO test
green_bowl_detection = LanguageObjectDetectionID(
"cardboard box/brown box")
"plastic bin/white box")
detection_id_to_obj[green_bowl_detection] = green_bowl

# # TODO temp test new object sets
Expand Down Expand Up @@ -3435,7 +3435,7 @@ def _get_dry_task(self, train_or_test: str,


class LISSpotBlockInBoxEnv(SpotRearrangementEnv):
"""An environment where a red block needs to be moved into a cardboard box."""
"""An environment where a red block needs to be moved into a plastic bin."""

def __init__(self, use_gui: bool = True) -> None:
super().__init__(use_gui)
Expand Down Expand Up @@ -3480,9 +3480,9 @@ def _detection_id_to_obj(self) -> Dict[ObjectDetectionID, Object]:
# cup_detection = LanguageObjectDetectionID("green apple/greenish apple")
detection_id_to_obj[cup_detection] = cup

cardboard_box = Object("cardboard_box", _container_type)
cardboard_box_detection = LanguageObjectDetectionID("cardboard box/brown box")
detection_id_to_obj[cardboard_box_detection] = cardboard_box
plastic_bin = Object("plastic_bin", _container_type)
plastic_bin_detection = LanguageObjectDetectionID("plastic bin/white box")
detection_id_to_obj[plastic_bin_detection] = plastic_bin

for obj, pose in get_known_immovable_objects().items():
detection_id = KnownStaticObjectDetectionID(obj.name, pose)
Expand All @@ -3491,10 +3491,10 @@ def _detection_id_to_obj(self) -> Dict[ObjectDetectionID, Object]:
return detection_id_to_obj

def _generate_goal_description(self) -> GoalDescription:
# return "put the red block into the cardboard box on floor"
# return "put the red block into the plastic bin on floor"
# return "view the object from top"
# return "know container not as empty"
# return "put the cup into the cardboard box on floor"
# return "put the cup into the plastic bin on floor"
return "place empty cup into the box"

def _get_dry_task(self, train_or_test: str,
Expand All @@ -3503,7 +3503,7 @@ def _get_dry_task(self, train_or_test: str,


class LISSpotTableCupInBoxEnv(SpotRearrangementEnv):
"""An environment where a cup on a table needs to be moved into a cardboard box."""
"""An environment where a cup on a table needs to be moved into a plastic bin."""

def __init__(self, use_gui: bool = True) -> None:
super().__init__(use_gui)
Expand Down Expand Up @@ -3540,9 +3540,9 @@ def _detection_id_to_obj(self) -> Dict[ObjectDetectionID, Object]:
cup_detection = LanguageObjectDetectionID("orange cup/orange cylinder/orange-ish mug")
detection_id_to_obj[cup_detection] = cup

cardboard_box = Object("cardboard_box", _container_type)
cardboard_box_detection = LanguageObjectDetectionID("cardboard box/brown box")
detection_id_to_obj[cardboard_box_detection] = cardboard_box
plastic_bin = Object("plastic_bin", _container_type)
plastic_bin_detection = LanguageObjectDetectionID("plastic bin/white box")
detection_id_to_obj[plastic_bin_detection] = plastic_bin

for obj, pose in get_known_immovable_objects().items():
detection_id = KnownStaticObjectDetectionID(obj.name, pose)
Expand All @@ -3551,7 +3551,7 @@ def _detection_id_to_obj(self) -> Dict[ObjectDetectionID, Object]:
return detection_id_to_obj

def _generate_goal_description(self) -> GoalDescription:
return "put the cup into the cardboard box on floor"
return "put the cup into the plastic bin on floor"

def _get_dry_task(self, train_or_test: str,
task_idx: int) -> EnvironmentTask:
Expand Down Expand Up @@ -3612,7 +3612,7 @@ def _get_dry_task(self, train_or_test: str,
class LISSpotEmptyCupBoxEnv(SpotRearrangementEnv):
"""An environment designated for testing belief space predicates.
The goal is to move a single empty cup on the floor to a cardboard box
The goal is to move a single empty cup on the floor to a plastic bin
"""

def __init__(self, use_gui: bool = True) -> None:
Expand All @@ -3638,10 +3638,10 @@ def _detection_id_to_obj(self) -> Dict[ObjectDetectionID, Object]:

detection_id_to_obj: Dict[ObjectDetectionID, Object] = {}

cardboard_box = Object("cardboard_box", _container_type)
cardboard_box_detection = LanguageObjectDetectionID(
"cardboard box/box")
detection_id_to_obj[cardboard_box_detection] = cardboard_box
plastic_bin = Object("plastic_bin", _container_type)
plastic_bin_detection = LanguageObjectDetectionID(
"plastic bin/box")
detection_id_to_obj[plastic_bin_detection] = plastic_bin

# Case 1: Cup facing up with no lid
# To try more cases below
Expand Down
18 changes: 9 additions & 9 deletions predicators/perception/spot_perceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,9 @@ def _create_goal(self, state: State,
return {
GroundAtom(Inside, [block, bin]),
}
if goal_description == "put the red block into the cardboard box on floor":
if goal_description == "put the red block into the plastic bin on floor":
block = Object("red_block", _movable_object_type)
box = Object("cardboard_box", _container_type)
box = Object("plastic_bin", _container_type)
Inside = pred_name_to_pred["Inside"]
return {
GroundAtom(Inside, [block, box]),
Expand Down Expand Up @@ -558,14 +558,14 @@ def _create_goal(self, state: State,
}
if goal_description == "place empty cup into the box":
cup = Object("cup", _container_type)
cardboard_box = Object("cardboard_box", _container_type)
plastic_bin = Object("plastic_bin", _container_type)
ContainingWaterKnown = pred_name_to_pred["ContainingWaterKnown"]
NotContainingWater = pred_name_to_pred["NotContainingWater"]
Inside = pred_name_to_pred["Inside"]
return {
GroundAtom(ContainingWaterKnown, [cup]),
GroundAtom(NotContainingWater, [cup]),
GroundAtom(Inside, [cup, cardboard_box]),
#GroundAtom(ContainingWaterKnown, [cup]),
#GroundAtom(NotContainingWater, [cup]),
GroundAtom(Inside, [cup, plastic_bin]),
}
if goal_description == "know container as empty":
cup = Object("cup", _container_type)
Expand All @@ -575,12 +575,12 @@ def _create_goal(self, state: State,
GroundAtom(ContainingWaterKnown, [cup]),
GroundAtom(NotContainingWater, [cup]),
}
if goal_description == "put the cup into the cardboard box on floor":
if goal_description == "put the cup into the plastic bin on floor":
cup = Object("cup", _container_type)
cardboard_box = Object("cardboard_box", _container_type)
plastic_bin = Object("plastic_bin", _container_type)
Inside = pred_name_to_pred["Inside"]
return {
GroundAtom(Inside, [cup, cardboard_box]),
GroundAtom(Inside, [cup, plastic_bin]),
}
if goal_description == "setup sweeping":
robot = Object("robot", _robot_type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static-object-features:
length: 1.2
width: 0.8
flat_top_surface: 1
cardboard_box: # adopted from floor8-v2
plastic_bin: # adopted from floor8-v2
shape: 1
height: 0.5 # TODO check
width: 0.4
Expand Down

0 comments on commit c153fab

Please sign in to comment.