Skip to content

Commit

Permalink
[HumanDescription fix]
Browse files Browse the repository at this point in the history
  • Loading branch information
Julislz authored Feb 9, 2024
2 parents a3a46e4 + f15aaea commit ef2fcc6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
10 changes: 7 additions & 3 deletions demos/pycram_receptionist_demo/tests/Ms2_testable_stuff.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,17 @@ def demo_test(area):
with real_robot:
print("start demo")
host = HumanDescription("Bob", fav_drink="Coffee")
host.human_pose.set_value(False)
guest1 = HumanDescription("guest1")
guest1.human_pose.set_value(False)

# Perception, detect first guest
DetectAction(technique='human', state='start').resolve().perform()

# While loop, human is detected
#while not guest1.human_pose:
# TalkingMotion("Please step in front of me").resolve.perform()
# rospy.sleep(5)
while not guest1.human_pose.get_value():
TalkingMotion("Please step in front of me").resolve.perform()
rospy.sleep(5)

rospy.loginfo("human detected")

Expand Down Expand Up @@ -97,6 +99,8 @@ def demo_test(area):

# stop perceiving human
DetectAction(technique='human', state='stop').resolve().perform()
guest1.human_pose.set_value(False)
host.human_pose.set_value(False)

rospy.loginfo("Navigating now")
TalkingMotion("navigating to couch area now, please step away").resolve().perform()
Expand Down
20 changes: 18 additions & 2 deletions demos/pycram_receptionist_demo/tests/perception_humans.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,33 @@

def test():
with real_robot:
print("...................... nothing" )
guest1 = HumanDescription("x")
# print("...................... nothing" )
guest1.human_pose.set_value(False)
if not guest1.human_pose.get_value():
print("wrong? " + str(guest1.human_pose))

if guest1.human_pose.get_value():
print("right? " + str(guest1.human_pose))

print("----------------------------------")
DetectAction(technique='human', state='start').resolve().perform()

if not guest1.human_pose.get_value():
print("wrong? " + str(guest1.human_pose))

if guest1.human_pose.get_value():
print("right? " + str(guest1.human_pose))



rospy.loginfo("human detected")

print("---------- " + "start")

rospy.loginfo("sleeping now")

rospy.sleep(10)
rospy.sleep(5)

rospy.loginfo("sleep done stopping now")

Expand Down
7 changes: 5 additions & 2 deletions src/pycram/designators/object_designator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import rospy
import sqlalchemy.orm
from geometry_msgs.msg import PoseStamped

from ..bullet_world import BulletWorld, Object as BulletWorldObject
from ..designator import DesignatorDescription, ObjectDesignatorDescription
from ..orm.base import ProcessMetaData
Expand Down Expand Up @@ -196,15 +198,16 @@ def __init__(self, name, fav_drink: Optional = None):
self.name = name
self.fav_drink = fav_drink # self.shirt_color = shirt_color # self.gender = gender

self.human_pose_sub = rospy.Subscriber("/human_pose", String, self.human_pose_cb)
self.human_pose_sub = rospy.Subscriber("/human_pose", PoseStamped, self.human_pose_cb)

def human_pose_cb(self, HumanPoseMsg):
"""
callback function for human_pose Subscriber.
sets the attribute human_pose when someone (e.g. Perception/Robokudo) publishes on the topic
:param HumanPoseMsg: received message
"""
self.human_pose.set_value(HumanPoseMsg.data)
rospy.loginfo("in callback")
self.human_pose.set_value(True)

def set_name(self, new_name):
"""
Expand Down

0 comments on commit ef2fcc6

Please sign in to comment.