Skip to content

Commit

Permalink
[Receptionist] Perception Test for new features
Browse files Browse the repository at this point in the history
  • Loading branch information
Julislz committed Mar 28, 2024
1 parent c09ad53 commit f0c44ce
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
1 change: 0 additions & 1 deletion demos/pycram_receptionist_demo/tests/MS3_testable.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ def demo_tst():

# introduce humans and look at them
giskardpy.move_head_to_human()
print("täsr" + misc.host.fav_drink)
misc.introduce(pose_b=pose_host, pose_a=pose_guest)


Expand Down
19 changes: 19 additions & 0 deletions demos/pycram_receptionist_demo/tests/perception_humans.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
def p():
with real_robot:

# to signal the start of demo
TalkingMotion("Hello, i am ready for the test").resolve().perform()

# does the code work with the manipulation feature?
giskardpy.move_head_to_human()

# old Detection Query
DetectAction(technique='human', state='start').resolve().perform()

rospy.loginfo("human detected")
Expand All @@ -48,6 +55,18 @@ def p():

print("------------------------------- stop")

# new Query to detect attributes of a human
TalkingMotion("detecting attributes now").resolve().perform()
attributes = DetectAction(technique='attributes').resolve().perform()
rospy.loginfo("Attributes: " + str(attributes))
rospy.sleep(5)

# new Query for free seat
#TalkingMotion("detecting free seat now").resolve().perform()
#seat = DetectAction(technique='location', state='seat1').resolve().perform()
#rospy.loginfo("seat bool: " + str(attributes))
#rospy.sleep(5)

print("end")


Expand Down
8 changes: 3 additions & 5 deletions src/pycram/external_interfaces/robokudo.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def callback(pose):
human_bool = True
human_pose = pose


# create client to communicate with perception
client = actionlib.SimpleActionClient('robokudo/query', QueryAction)
rospy.loginfo("Waiting for action server")
client.wait_for_server()
Expand Down Expand Up @@ -236,15 +236,14 @@ def done_callback(state, result: QueryResult):
global query_result
query_result = result.res


# fill Query with information so that perception looks for a seat
object_goal = QueryGoal()
object_goal.obj.location = seat # aktivate region filter
object_goal.obj.attribute = ["attributes"] # gender, bright/dark top, x, hat or no hat

client = actionlib.SimpleActionClient('robokudo/query', QueryAction)
rospy.loginfo("Waiting for action server")
client.wait_for_server()
rospy.loginfo("Query to Perception: " + str(object_goal))
client.send_goal(object_goal, active_cb=active_callback, done_cb=done_callback)
# TODO: necessary?
client.wait_for_result()
Expand All @@ -269,15 +268,14 @@ def done_callback(state, result: QueryResult):
global query_result
query_result = result



object_goal = QueryGoal()
# Perception will detect gender, clothes, skin color, age
object_goal.obj.attribute = ["attributes"]

client = actionlib.SimpleActionClient('robokudo/query', QueryAction)
rospy.loginfo("Waiting for action server")
client.wait_for_server()
rospy.loginfo("Query to Perception: " + str(object_goal))
client.send_goal(object_goal, active_cb=active_callback, done_cb=done_callback)
# TODO: necessary?
client.wait_for_result()
Expand Down
4 changes: 2 additions & 2 deletions src/pycram/process_modules/hsrb_process_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ def _execute(self, desig: DetectingMotion.Motion) -> Any:
seat_human_pose = seat_queryHuman(seat)
return seat_human_pose
elif desig.technique == 'attributes':
seat_human_pose = attributes_queryHuman()
return seat_human_pose
human_pose_attr = attributes_queryHuman()
return human_pose_attr


query_result = queryEmpty(ObjectDesignatorDescription(types=[desig.object_type]))
Expand Down

0 comments on commit f0c44ce

Please sign in to comment.