Skip to content

Commit

Permalink
reformatted
Browse files Browse the repository at this point in the history
  • Loading branch information
Benteng Ma committed Jul 10, 2024
1 parent 677a087 commit 471ee60
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tasks/gpsr/src/gpsr/states/object_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def count_category(self, object_dictionary, count_object):
def execute(self, userdata):
detected_objects = userdata.object_dict
counts = self.count_category(self.object_weight, detected_objects)
category_counts = {key: value for key, value in counts.items() if value != 0}
category_counts = {
key: value for key, value in counts.items() if value != 0
}
userdata.category_dict = category_counts
userdata.detections_categories = list(category_counts.keys())
return "succeeded"
Expand Down Expand Up @@ -149,7 +151,7 @@ def __init__(self):
"sorted_size",
"sorted_weights",
],
output_keys=["say_text"]
output_keys=["say_text"],
)

def execute(self, userdata):
Expand Down Expand Up @@ -250,6 +252,8 @@ def __init__(
transitions={"succeeded": "succeeded", "failed": "failed"},
remapping={"text": "say_text"},
)


# if __name__ == "__main__":
# import rospy
# from sensor_msgs.msg import PointCloud2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def execute(self, userdata: UserData) -> str:
outcome = "failed"

return outcome

class PostRecoveryDecision(smach.State):
def __init__(
self,
Expand All @@ -93,6 +94,7 @@ def __init__(
prior_data: Dict[str, List[str]] = rospy.get_param(param_key)
self._possible_names = [name.lower() for name in prior_data["names"]]
self._possible_drinks = [drink.lower() for drink in prior_data["drinks"]]

def execute(self, userdata: UserData) -> str:
if not self._recovery_name_and_drink_required(userdata):
if userdata.guest_data[self._guest_id]["name"] == "unknown":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def speech_recovery(sentence):
print(f"final name: {handle_name(sentence_list, True)}")
print(f"final drink: {handle_drink(sentence_list, True)}")


def handle_name(sentence_list, last_resort):
result = handle_similar_spelt(sentence_list, available_names, 1)
if result != "unknown":
Expand All @@ -74,6 +75,7 @@ def handle_name(sentence_list, last_resort):
print("Last resort name")
return handle_closest_spelt(sentence_list, available_names)


def handle_drink(sentence_list, last_resort):
result = infer_second_drink(sentence_list)
if result != "unknown":
Expand Down

0 comments on commit 471ee60

Please sign in to comment.