Commit 54f390ad authored by Patrick Holthaus's avatar Patrick Holthaus

use waypoint when exiting kitchen, correct uttering

parent 44062080
......@@ -140,19 +140,19 @@ class ExperimentControl(object):
rospy.logdebug("Updated position to '%s,%s'.", self.position.x, self.position.y)
def prepare(self, item, phrase="acted", wait=2):
def say_item(self, item, wait=2):
#utterance = get_parameter("/script_server/utterances/" + item)
#self.sound.say(utterance)
self.sound.playWave(self.sound_path + "/" + item + ".ogg")
time.sleep(wait)
def prepare(self, item, phrase=None, only_phrase=False, wait=2):
assert (not "stop" in self.signal)
if not phrase is None:
#utterance = get_parameter("/script_server/utterances/" + phrase + "/", self.condition)
#self.sound.say(utterance)
if not self.acted is None and not only_phrase:
self.say_item(self.acted + "/" + self.condition)
self.sound.playWave(self.sound_path + "/" + phrase + "/" + self.condition + ".ogg")
time.sleep(wait)
elif not self.acted is None:
#utterance = get_parameter("/script_server/utterances/" + self.acted + "/", self.condition)
#self.sound.say(utterance)
self.sound.playWave(self.sound_path + "/" + self.acted + "/" + self.condition + ".ogg")
time.sleep(wait)
if not phrase is None:
self.say_item(phrase + "/" + self.condition)
rospy.loginfo("EXPERIMENT PHASE ID '%s', COND '%s': PUZZLE/INSPECT(%s).", self.experiment_id, self.condition, item)
self.check_result(self.head.look_at("straight"), "head")
......@@ -228,12 +228,16 @@ class ExperimentControl(object):
rospy.loginfo("EXPERIMENT PHASE ID '%s', COND '%s': %s.", self.experiment_id, self.condition, cur_state)
rospy.set_param('/safety_security/experiment_trials/' + self.experiment_id + '/state', cur_state)
def interrupt_person(self, item, monitor=None, monitor_class=SensorMonitor):
def interrupt_person(self, item, monitor=None, via=None, monitor_class=SensorMonitor):
#int_utterance = get_parameter("/script_server/utterances/interrupt/", self.condition)
#utterance = get_parameter("/script_server/utterances/" + item + "/", self.condition)
self.set_state("INTERRUPT/INITIATED(%s)" % item)
self.base.goto("notify" + "/" + self.condition)
if via is None:
self.base.goto("notify" + "/" + self.condition)
else:
self.move_via("notify" + "/" + self.condition, via)
self.set_state("INTERRUPT/ARRIVED(%s)" % item)
#self.sss.move("head", "interrupt/" + self.condition, False) #TODO decide
......@@ -262,25 +266,26 @@ class ExperimentControl(object):
def inspect_a(self):
item="oven"
self.prepare(item, "greet_dismiss")
self.prepare(item, "greet_dismiss", only_phrase=True)
self.search("inspect/living_1")
self.base.goto("prepare/kitchen")
self.search("inspect/kitchen")
self.interrupt_person(item)
self.interrupt_person(item, via=["prepare/kitchen"])
def inspect_b(self):
item = "plugs"
self.prepare(item)
self.move_via("inspect/living_2", ["waypoint_a", "waypoint_b"])
self.move_via("inspect/living_2", ["waypoint_a", "waypoint_b"], True)
self.search()
self.base.goto("prepare/kitchen")
self.search("inspect/kitchen")
self.interrupt_person(item,
{672: "Off",
monitor={672: "Off",
750: "Off",
752: "Off",
755: "Off",
})
},
via=["prepare/kitchen"])
self.actuators.setActuator(672, 0)
self.actuators.setActuator(673, 0)
self.actuators.setActuator(750, 0)
......@@ -298,7 +303,7 @@ class ExperimentControl(object):
self.actuators.setActuator(752, 100)
self.base.goto("prepare/kitchen")
self.search("inspect/kitchen")
self.interrupt_person(item, {752: "Off"})
self.interrupt_person(item, monitor={752: "Off"}, via=["prepare/kitchen"])
def inspect_d(self):
item = "pepper"
......@@ -336,20 +341,21 @@ class ExperimentControl(object):
self.signal = "";
return si
time.sleep(.5)
time.sleep(.1)
if rospy.is_shutdown():
raise StoppedException()
def move_via(self, target, waypoints, distance=.5):
def move_via(self, target, waypoints, conditions=False, distance=.6):
for wp in waypoints:
wp = wp + "/" + self.condition
if conditions:
wp = wp + "/" + self.condition
wp_x, wp_y, wp_phi = get_parameter("/script_server/base/", wp)
self.base.goto(wp, wait=False)
dist = hypot(wp_x - self.position.x, wp_y - self.position.y)
while dist > distance:
time.sleep(.05)
time.sleep(.02)
dist = hypot(wp_x - self.position.x, wp_y - self.position.y)
self.base.goto(target)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment