Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
haiwei-luo committed Jun 26, 2024
1 parent 683636f commit b3e889a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
3 changes: 1 addition & 2 deletions tasks/receptionist/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"drink": "wine",
"dataset": "receptionist",
"confidence": 0.5,
"detection" : True,
"attributes": {
"has_hair": 0.5,
"hair_shape": "straight hair",
Expand All @@ -56,8 +57,6 @@
"max_dress": "unknown",
"max_top": "short sleeved top",
"max_outwear": "unknown",

"detection" : True,
},
},
)
Expand Down
13 changes: 11 additions & 2 deletions tasks/receptionist/src/receptionist/state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,10 +678,19 @@ def __init__(
LookToGivenPoint(
[-1.5, 0.0],
),
transitions={
"succeeded": "INTRODUCE_GUEST_HOST_TO_GUEST_2",
"timed_out": "INTRODUCE_GUEST_HOST_TO_GUEST_2",
"aborted": "INTRODUCE_GUEST_HOST_TO_GUEST_2",
},
)

smach.StateMachine.add(
"INTRODUCE_GUEST_HOST_TO_GUEST_2",
Introduce(guest_to_introduce="host", guest_to_introduce_to="guest2"),
transitions={
"succeeded": "FIND_AND_LOOK_AT_GUEST_1",
"timed_out": "FIND_AND_LOOK_AT_GUEST_1",
"aborted": "FIND_AND_LOOK_AT_GUEST_1",
"failed": "FIND_AND_LOOK_AT_GUEST_1",
},
)

Expand Down
6 changes: 3 additions & 3 deletions tasks/receptionist/src/receptionist/states/get_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, guest_id: str):

def execute(self, userdata: UserData) -> str:
try:
userdata.guest_data[self._guest_id]["attributes"]["detection"] = False
userdata.guest_data[self._guest_id]["detection"] = False
return "succeeded"
except Exception as e:
print(e)
Expand All @@ -41,7 +41,7 @@ def execute(self, userdata: UserData) -> str:
userdata.guest_data[self._guest_id]["attributes"] = json.loads(
userdata.people[0]["features"]
)
userdata.guest_data[self._guest_id]["attributes"]["detection"] = True
userdata.guest_data[self._guest_id]["detection"] = True
return "succeeded"

def __init__(
Expand All @@ -59,7 +59,7 @@ def __init__(
with self:
smach.StateMachine.add(
"INITIALISE_DETECTION_FLAG",
self.HandleGuestAttributes(self._guest_id),
self.InitialiseDetectionFlag(self._guest_id),
transitions={
"succeeded": "GET_GUEST_ATTRIBUTES",
"failed": "GET_GUEST_ATTRIBUTES",
Expand Down
4 changes: 1 addition & 3 deletions tasks/receptionist/src/receptionist/states/introduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,14 @@ def stringify_guest_data(guest_data: Dict[str, Any], guest_id: str) -> str:
"max_dress": "unknown",
"max_top": "unknown",
"max_outwear": "unknown",

"detection" : False
},
)

guest_str = ""

guest_str += f"{relevant_guest_data['name']}, their favourite drink is {relevant_guest_data['drink']}. "

if relevant_guest_data["attributes"]["detection"] == False:
if relevant_guest_data["detection"] == False:
guest_str += "No attributes were detected for them."
return guest_str

Expand Down

0 comments on commit b3e889a

Please sign in to comment.