Esempio n. 1
0
    def executeCallback(self, goal):
        self.next_waypoint = goal.next_point
        while not rospy.is_shutdown() and self._as.is_active():
            self.request_name = ''
            result = InterfaceResult()
            if goal.show_select:
                client_utils.display_relative_page(self.display_no,
                                                   'guiding_chair.html')
            else:
                client_utils.display_relative_page(self.display_no,
                                                   'guiding.html')

            while self.request_name == '' and not rospy.is_shutdown():
                rospy.sleep(0.1)

            if self.request_name == 'next':
                result.chosen_point = self.next_waypoint
                result.idx = goal.idx
                rospy.loginfo(result)
                self._as.set_succeeded(result)
            elif self.request_name == 'abort':
                try:
                    s = rospy.ServiceProxy(
                        '/walking_group/guide_interface/cancel', Empty)
                    s()
                except rospy.ServiceException as e:
                    rospy.logwarn("Service call failed: %s" % e)
                self._as.set_preempted()
            elif self.request_name == 'killall':
                try:
                    s = rospy.ServiceProxy('/walking_group/cancel', Empty)
                    s()
                except rospy.ServiceException as e:
                    rospy.logwarn("Service call failed: %s" % e)
                self._as.set_preempted()
            elif self.request_name == 'select':
                result.command = self.request_name
                self._as.set_succeeded(result)
            else:
                self.request_name = ''
                result.chosen_point = ''
                result.idx = self.show_map(goal)
                rospy.loginfo(result)
                if result.idx < 0:
                    #                    self.request_name = ''
                    continue
                self._as.set_succeeded(result)
Esempio n. 2
0
    def node_callback(self, data):
        self.current_node = data.data
        if data.data == self.navgoal.target and self.navgoal.no_orientation:  # For intermediate nodes, being in the influence are is enough
            self.client.cancel_all_goals()


#            self.client_move_base.cancel_all_goals()
        if data.data in self.pause_points and not self.pause:
            rospy.loginfo("Pausing...")
            client_utils.display_relative_page(self.display_no, 'warte.html')
            self.client.cancel_all_goals()
            self.client_move_base.cancel_all_goals()
            self.pause = 1
            try:
                s = rospy.ServiceProxy(
                    '/sound_player_server/sound_player_service',
                    PlaySoundService)
                s.wait_for_service()
                s("jingle_stop.mp3")
            except rospy.ServiceException, e:
                rospy.logwarn("Service call failed: %s" % e)
Esempio n. 3
0
    def executeCallback(self, goal):
        self.request_name = ''
        self.next_waypoint = goal.next_point
        result = InterfaceResult()
        client_utils.display_relative_page(self.display_no, 'guiding.html')

        while self.request_name == '' and not rospy.is_shutdown():
            rospy.sleep(0.1)

        if self.request_name == 'next':
            result.chosen_point = goal.next_point
            rospy.loginfo(result)
            self._as.set_succeeded(result)
        elif self.request_name == 'abort':
            try:
                s = rospy.ServiceProxy('/walking_group/guide_interface/cancel',
                                       Empty)
                s()
            except rospy.ServiceException as e:
                rospy.logwarn("Service call failed: %s" % e)
            self._as.set_preempted()
        elif self.request_name == 'killall':
            try:
                s = rospy.ServiceProxy('/walking_group/cancel', Empty)
                s()
            except rospy.ServiceException as e:
                rospy.logwarn("Service call failed: %s" % e)
            self._as.set_preempted()
        else:
            self.request_name = ''
            self.listWaypointPage(goal.possible_points)
            while self.request_name == '':
                rospy.sleep(0.1)
            result.chosen_point = self.request_name
            rospy.loginfo(result)
            self._as.set_succeeded(result)
    def executeCallback(self, goal):
        if goal.waypoint == 'right':
            client_utils.display_relative_page(self.display_no,
                                               'turn_right.html')
        elif goal.waypoint == 'left':
            client_utils.display_relative_page(self.display_no,
                                               'turn_left.html')
        else:
            client_utils.display_relative_page(self.display_no,
                                               'straight.html')

        if self._as.is_preempt_requested():
            rospy.logwarn("Aborting the goal...")
            self._as.set_preempted()
        else:
            self._as.set_succeeded(GuidingResult())
Esempio n. 5
0
    def executeCallback(self, goal):
        self.previous_direction = ""
        while not self._as.is_preempt_requested() and not rospy.is_shutdown():
            if time.time() - self.start_time > 5:  #reconfigurable parameter
                self.direction = "stop"
                if self.previous_direction != self.direction:
                    client_utils.display_relative_page(self.display_no,
                                                       'stop.html')
                    rospy.loginfo("STOP")
                    self.indicate = False
                    #move head straight
                    self.head.position = [0, 0]
                    self.head_pub.publish(self.head)
                    self.previous_direction = "stop"
            else:
                if self.previous_direction != self.direction:
                    if self.direction == 'right':
                        client_utils.display_relative_page(
                            self.display_no, 'turn_right.html')
                        #move head right
                        self.head.position = [-30, 0]
                        self.head_pub.publish(self.head)
                        #indicate
                        if self.thread:
                            self.indicate = False
                            self.thread.join()
                        self.indicate = True
                        self.thread = Thread(target=self.blink,
                                             args=('right', ))
                        self.thread.start()
                        rospy.loginfo("Moving right...")
                        self.previous_direction = "right"

                    elif self.direction == 'left':
                        client_utils.display_relative_page(
                            self.display_no, 'turn_left.html')
                        #move head left
                        self.head.position = [30, 0]
                        self.head_pub.publish(self.head)
                        #indicate
                        if self.thread:
                            self.indicate = False
                            self.thread.join()
                        self.indicate = True
                        self.thread = Thread(target=self.blink,
                                             args=('left', ))
                        self.thread.start()
                        rospy.loginfo("Moving left...")
                        self.previous_direction = "left"

                    else:
                        client_utils.display_relative_page(
                            self.display_no, 'straight.html')
                        self.indicate = False
                        #move head straight
                        self.head.position = [0, 0]
                        self.head_pub.publish(self.head)
                        rospy.loginfo("Moving straight...")
                        self.previous_direction = "straight"

        if self._as.is_preempt_requested():
            self._as.set_preempted()
        else:
            self._as.set_succeeded()
 def goalCallback(self):
     self._goal = self._as.accept_new_goal()
     client_utils.display_relative_page(self.display_no, 'aaf_map.html')
Esempio n. 7
0
 def show_web_page(self):
     client_utils.display_relative_page(self.display_no, 'navigation.html')