Skip to content

Commit 537a4f2

Browse files
committed
Add EntitybyIdDesignator for similar entity
1 parent 5776145 commit 537a4f2

File tree

1 file changed

+7
-4
lines changed
  • challenge_storing_groceries/src/challenge_storing_groceries

1 file changed

+7
-4
lines changed

challenge_storing_groceries/src/challenge_storing_groceries/similarity.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import rospy
22

33
from ed.entity import Entity
4-
from robot_smach_states.util.designators import Designator
4+
from robot_smach_states.util.designators import Designator, EntityByIdDesignator
55

66

77
class SimilarEntityDesignator(Designator):
@@ -25,9 +25,12 @@ def _resolve(self):
2525
original = self.original.resolve()
2626
entity_list = self.entity_list.resolve()
2727
match = find_similar_entity(original, entity_list, self.knowledge)
28-
if match:
29-
rospy.loginfo("Selected {}, as it is similar to {}".format(match, original))
30-
return self.robot.ed.get_entity(uuid=match.uuid)
28+
for match_entity in entity_list:
29+
if match_entity.uuid == match.uuid:
30+
match_des = EntityByIdDesignator(self.robot, uuid=match.uuid)
31+
match_uuid_ds = match_des.resolve()
32+
rospy.loginfo("Selected {}, as it is similar to {}".format(match, original))
33+
return self.robot.ed.get_entity(uuid=match_uuid_ds.uuid)
3134
return None
3235

3336

0 commit comments

Comments
 (0)