Skip to content

Commit

Permalink
Merge pull request #267 from StanfordVL/update-assembled
Browse files Browse the repository at this point in the history
Update assembled tasks and remove assembled predicate
  • Loading branch information
ChengshuLi authored Mar 12, 2024
2 parents 44033a4 + c0f746e commit 7006ddb
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 92 deletions.
20 changes: 14 additions & 6 deletions bddl/activity_definitions/assembling_furniture/problem0.bddl
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,31 @@
(:domain omnigibson)

(:objects
desk.n.01_1 - desk.n.01
desk_top.n.01_1 - desk_top.n.01
desk_bracket.n.01_1 - desk_bracket.n.01
desk_leg.n.01_1 desk_leg.n.01_2 desk_leg.n.01_3 desk_leg.n.01_4 - desk_leg.n.01
floor.n.01_1 - floor.n.01
agent.n.01_1 - agent.n.01
)

(:init
(not
(assembled desk.n.01_1)
)
(inroom floor.n.01_1 living_room)
(ontop desk.n.01_1 floor.n.01_1)
(ontop desk_top.n.01_1 floor.n.01_1)
(ontop desk_bracket.n.01_1 floor.n.01_1)
(ontop desk_leg.n.01_1 floor.n.01_1)
(ontop desk_leg.n.01_2 floor.n.01_1)
(ontop desk_leg.n.01_3 floor.n.01_1)
(ontop desk_leg.n.01_4 floor.n.01_1)
(ontop agent.n.01_1 floor.n.01_1)
)

(:goal
(and
(assembled ?desk.n.01_1)
(attached ?desk_bracket.n.01_1 ?desk_top.n.01_1)
(forall
(?desk_leg.n.01 - desk_leg.n.01)
(attached ?desk_leg.n.01 ?desk_bracket.n.01_1)
)
)
)
)
1 change: 0 additions & 1 deletion bddl/activity_definitions/domain_omnigibson.bddl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
(insource ?obj1 ?obj2)
(inroom ?obj1 ?obj2)
(broken ?obj1)
(assembled ?obj1)
(grasped ?obj1 ?obj2)
)
)
17 changes: 9 additions & 8 deletions bddl/activity_definitions/make_a_clothes_line/problem0.bddl
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@
(:domain omnigibson)

(:objects
cabinet.n.01_1 - cabinet.n.01
clothesline.n.01_1 - clothesline.n.01
clothesline_rope.n.01_1 - clothesline_rope.n.01
pole.n.01_1 pole.n.01_2 - pole.n.01
floor.n.01_1 - floor.n.01
agent.n.01_1 - agent.n.01
)

(:init
(ontop clothesline.n.01_1 floor.n.01_1)
(not
(assembled clothesline.n.01_1)
)
(inroom cabinet.n.01_1 utility_room)
(inroom pole.n.01_1 garden)
(inroom pole.n.01_2 garden)
(inroom floor.n.01_1 utility_room)
(ontop clothesline_rope.n.01_1 floor.n.01_1)
(ontop agent.n.01_1 floor.n.01_1)
)

(:goal
(and
(assembled ?clothesline.n.01_1)
(exists
(?pole.n.01 - pole.n.01)
(attached ?clothesline_rope.n.01_1 ?pole.n.01_1)
)
)
)
)
11 changes: 5 additions & 6 deletions bddl/activity_definitions/make_cabinet_doors/problem0.bddl
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@
(:domain omnigibson)

(:objects
cabinet.n.01_1 - cabinet.n.01
cabinet_base.n.01_1 - cabinet_base.n.01
cabinet_door.n.01_1 - cabinet_door.n.01
floor.n.01_1 - floor.n.01
agent.n.01_1 - agent.n.01
)

(:init
(not
(assembled cabinet.n.01_1)
)
(inroom floor.n.01_1 living_room)
(inroom cabinet.n.01_1 living_room)
(ontop cabinet_base.n.01_1 floor.n.01_1)
(ontop cabinet_door.n.01_1 floor.n.01_1)
(ontop agent.n.01_1 floor.n.01_1)
)

(:goal
(and
(assembled ?cabinet.n.01_1)
(attached ?cabinet_door.n.01_1 ?cabinet_base.n.01_1)
)
)
)
40 changes: 28 additions & 12 deletions bddl/activity_definitions/putting_up_shelves/problem0.bddl
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,45 @@
(:domain omnigibson)

(:objects
shelf.n.01_1 shelf.n.01_2 - shelf.n.01
shelf_back.n.01_1 - shelf_back.n.01
shelf_side.n.01_1 shelf_side.n.01_2 - shelf_side.n.01
shelf_shelf.n.01_1 shelf_shelf.n.01_2 shelf_shelf.n.01_3 shelf_shelf.n.01_4 shelf_shelf.n.01_5 shelf_shelf.n.01_6 - shelf_shelf.n.01
shelf_top.n.01_1 - shelf_top.n.01
shelf_baseboard.n.01_1 - shelf_baseboard.n.01
floor.n.01_1 - floor.n.01
agent.n.01_1 - agent.n.01
)

(:init
(not
(assembled shelf.n.01_1)
)
(not
(assembled shelf.n.01_2)
)
(inroom floor.n.01_1 bathroom)
(inroom shelf.n.01_1 bathroom)
(inroom shelf.n.01_2 bathroom)
(ontop agent.n.01_1 floor.n.01_1)
(ontop shelf_back.n.01_1 floor.n.01_1)
(ontop shelf_side.n.01_1 floor.n.01_1)
(ontop shelf_side.n.01_2 floor.n.01_1)
(ontop shelf_shelf.n.01_1 floor.n.01_1)
(ontop shelf_shelf.n.01_2 floor.n.01_1)
(ontop shelf_shelf.n.01_3 floor.n.01_1)
(ontop shelf_shelf.n.01_4 floor.n.01_1)
(ontop shelf_shelf.n.01_5 floor.n.01_1)
(ontop shelf_shelf.n.01_6 floor.n.01_1)
(ontop shelf_top.n.01_1 floor.n.01_1)
(ontop shelf_baseboard.n.01_1 floor.n.01_1)
)

(:goal
(and
(forall
(?shelf.n.01 - shelf.n.01)
(assembled ?shelf.n.01)
(forall
(?shelf_shelf.n.01 - shelf_shelf.n.01)
(attached ?shelf_shelf.n.01 ?shelf_back.n.01_1)
)
(forall
(?shelf_side.n.01 - shelf_side.n.01)
(attached ?shelf_side.n.01 ?shelf_back.n.01_1)
)
(attached ?shelf_top.n.01_1 ?shelf_back.n.01_1)
(exists
(?shelf_side.n.01 - shelf_side.n.01)
(attached ?shelf_baseboard.n.01_1 ?shelf_side.n.01)
)
)
)
Expand Down
17 changes: 11 additions & 6 deletions bddl/activity_definitions/setup_a_trampoline/problem0.bddl
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@
(:domain omnigibson)

(:objects
trampoline.n.01_1 - trampoline.n.01
trampoline_top.n.01_1 - trampoline_top.n.01
trampoline_leg.n.01_1 trampoline_leg.n.01_2 trampoline_leg.n.01_3 trampoline_leg.n.01_4 - trampoline_leg.n.01
floor.n.01_1 - floor.n.01
agent.n.01_1 - agent.n.01
)

(:init
(not
(assembled trampoline.n.01_1)
)
(ontop trampoline.n.01_1 floor.n.01_1)
(ontop trampoline_top.n.01_1 floor.n.01_1)
(ontop trampoline_leg.n.01_1 floor.n.01_1)
(ontop trampoline_leg.n.01_2 floor.n.01_1)
(ontop trampoline_leg.n.01_3 floor.n.01_1)
(ontop trampoline_leg.n.01_4 floor.n.01_1)
(inroom floor.n.01_1 garden)
(ontop agent.n.01_1 floor.n.01_1)
)

(:goal
(and
(assembled ?trampoline.n.01_1)
(forall
(?trampoline_leg.n.01 - trampoline_leg.n.01)
(attached ?trampoline_leg.n.01 ?trampoline_top.n.01_1)
)
)
)
)
10 changes: 6 additions & 4 deletions bddl/bddl_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@
("skateboard_wheel.n.01", "skateboard_deck.n.01"),
("shelf_shelf.n.01", "shelf_back.n.01"),
("shelf_side.n.01", "shelf_back.n.01"),
("shelf_baseboard.n.01", "shelf_back.n.01"),
("shelf_baseboard.n.01", "shelf_side.n.01"),
("shelf_top.n.01", "shelf_back.n.01"),
("desk_leg.n.01", "desk_bracket.n.01"),
("desk_bracket.n.01", "desk_top.n.01"),
("trampoline_leg.n.01", "trampoline_top.n.01"),
("clothesline_rope.n.01", "pole.n.01"),
("cabinet_door.n.01", "cabinet_base.n.01"),
])

VALID_ROOMS = set()
Expand Down Expand Up @@ -293,9 +298,6 @@ def check_synset_predicate_alignment(atom, syns_to_props):
if pred == "on_fire":
assert "nonSubstance" in syns_to_props[objects[0]], f"Inapplicable on_fire: {atom}"
assert "flammable" in syns_to_props[objects[0]], f"Inapplicable on_fire: {atom}"
if pred == "assembled":
assert "rigidBody" in syns_to_props[objects[0]], f"Inapplicable assembled: {atom}"
assert "assembleable" in syns_to_props[objects[0]], f"Inapplicable assembled: {atom}"
if pred == "broken":
assert "rigidBody" in syns_to_props[objects[0]], f"Inapplicable broken: {atom}"
assert "breakable" in syns_to_props[objects[0]], f"Inapplicable broken: {atom}"
Expand Down
2 changes: 1 addition & 1 deletion bddl/data_generation/get_syn_prop_annots_canonical.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"soakable": None,
"wetable": "wet",
"flammable": "on_fire",
"assembleable": "assembled",
"assembleable": None,
"heatable" : "hot",
"boilable": "boiling",
"meltable" : "melted",
Expand Down
20 changes: 0 additions & 20 deletions bddl/generated_data/synsets_to_descriptors.json
Original file line number Diff line number Diff line change
Expand Up @@ -25552,10 +25552,6 @@
]
],
"cabinet.n.01": [
[
"assembled",
"assembled"
],
[
"disinfected",
"disinfected"
Expand Down Expand Up @@ -35186,10 +35182,6 @@
]
],
"clothesline.n.01": [
[
"assembled",
"assembled"
],
[
"disinfected",
"disinfected"
Expand Down Expand Up @@ -47360,10 +47352,6 @@
]
],
"desk.n.01": [
[
"assembled",
"assembled"
],
[
"disinfected",
"disinfected"
Expand Down Expand Up @@ -127086,10 +127074,6 @@
]
],
"shelf.n.01": [
[
"assembled",
"assembled"
],
[
"disinfected",
"disinfected"
Expand Down Expand Up @@ -144292,10 +144276,6 @@
]
],
"trampoline.n.01": [
[
"assembled",
"assembled"
],
[
"disinfected",
"disinfected"
Expand Down
2 changes: 1 addition & 1 deletion bddl/knowledge_base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ def uses_physical_substance(self):
return any("physicalSubstance" in synset.property_names for synset in self.synsets)

def uses_attachment(self):
return any(pred.name in ['assembled', 'attached'] for pred in self.uses_predicates)
return any(pred.name == 'attached' for pred in self.uses_predicates)

def uses_cloth(self):
return any(pred.name in ['folded', 'draped', 'unfolded'] for pred in self.uses_predicates)
Expand Down
27 changes: 0 additions & 27 deletions bddl/trivial_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def get_predicate_class(self, predicate_name):
"draped": TrivialDrapedPredicate,
"insource": TrivialInsourcePredicate,
"broken": TrivialBrokenPredicate,
"assembled": TrivialAssembledPredicate,
"grasped": TrivialGraspedPredicate,
}
return PREDICATE_MAPPING[predicate_name]
Expand All @@ -61,7 +60,6 @@ def __init__(self):
self.real = set()
self.broken = set()
self.closed = set()
self.assembled = set()
# Binaries - populated with 2-tuples of string names
self.saturated = set()
self.covered = set()
Expand Down Expand Up @@ -92,7 +90,6 @@ def create_predicate_to_setters(self):
"on_fire": self.set_on_fire,
"empty": self.set_empty,
"broken": self.set_broken,
"assembled": self.set_assembled,
"closed": self.set_closed,
"future": self.set_future,
"real": self.set_real,
Expand Down Expand Up @@ -249,16 +246,6 @@ def set_broken(self, objs, is_broken):
def get_broken(self, objs):
return tuple(obj.name for obj in objs) in self.broken

def set_assembled(self, objs, is_assembled):
assert len(objs) == 1, f"`objs` has len other than 1: {objs}"
if is_assembled:
self.assembled.add(objs)
else:
self.assembled.discard(objs)

def get_assembled(self, objs):
return tuple(obj.name for obj in objs) in self.assembled

def set_future(self, objs, is_future):
assert len(objs) == 1, f"`objs` has len other than 1: {objs}"
if is_future:
Expand Down Expand Up @@ -458,9 +445,6 @@ def get_empty(self):
def get_broken(self):
return self.simulator.get_broken((self,))

def get_assembled(self):
return self.simulator.get_assembled((self,))

def get_future(self):
return self.simulator.get_future((self,))

Expand Down Expand Up @@ -640,17 +624,6 @@ def _sample(self, obj1, binary_state):
pass


class TrivialAssembledPredicate(UnaryAtomicFormula):
STATE_NAME = "assembled"

def _evaluate(self, obj):
print(self.STATE_NAME, obj.name, obj.get_assembled())
return obj.get_assembled()

def _sample(self, obj1, binary_state):
pass


class TrivialFuturePredicate(UnaryAtomicFormula):
STATE_NAME = "future"

Expand Down

0 comments on commit 7006ddb

Please sign in to comment.