scripts/rawdata/pytreeros/smarc-project_smarc_missions_sam_execute_mission.py
def execute(self, goal):
        # We override
        """
        Check for pre-emption, but otherwise just spin around gradually incrementing
        a hypothetical 'percent' done.

        Args:
            goal (:obj:`any`): goal of type specified by the action_type in the constructor.
        """
        #if self.goal_received_callback:
        #    self.goal_received_callback(goal)
        # goal.target_pose = don't care
        frequency = 3.0  # hz
        increment = 100 / (frequency * self.parameters.duration)
        self.percent_completed = 0
        rate = rospy.Rate(frequency)  # hz

        goal = eval(goal.bt_action_goal)
        rospy.loginfo("{title}: received a goal:{goal}".format(title=self.title, goal=str(goal)))

        # if we just received a goal, we erase any previous pre-emption
        self.action_server.preempt_request = False

        while True:
            if rospy.is_shutdown() or self.action_server.is_preempt_requested():
                rospy.loginfo("{title}: goal preempted".format(title=self.title))
                self.action_server.set_preempted(self.action.action_result.result, "goal was preempted")
                success = False
                break
            if self.percent_completed >= 100:
                rospy.loginfo("{title}: feedback 100%".format(title=self.title))
                success = True
                break
            else:
                #rospy.loginfo("{title}: mission execution feedback {percent:.2f}%".format(title=self.title, percent=self.percent_completed))
                #self.percent_completed += increment
                #self.worker()

                if goal is None:
                    return False

                pitch, depth = goal
                self.pitch_publisher.publish(pitch)
                self.depth_publisher.publish(depth)





            rate.sleep()
        if success:
            rospy.loginfo("{title}: goal success".format(title=self.title))
            self.action_server.set_succeeded(self.action.action_result.result, "goal reached")

        Check for pre-emption, but otherwise just spin around gradually incrementing
        a hypothetical 'percent' done.

        Args:
            goal (:obj:`any`): goal of type specified by the action_type in the constructor.
        
Check for pre-emption, but otherwise just spin around gradually incrementing
a hypothetical 'percent' done.
Check for pre - emption but otherwise just spin around gradually incrementing a hypothetical ' percent ' done .
def execute(self, goal):
        frequency = 3.0  
        increment = 100 / (frequency * self.parameters.duration)
        self.percent_completed = 0
        rate = rospy.Rate(frequency)  
        goal = eval(goal.bt_action_goal)
        rospy.loginfo("{title}: received a goal:{goal}".format(title=self.title, goal=str(goal)))
        self.action_server.preempt_request = False
        while True:
            if rospy.is_shutdown() or self.action_server.is_preempt_requested():
                rospy.loginfo("{title}: goal preempted".format(title=self.title))
                self.action_server.set_preempted(self.action.action_result.result, "goal was preempted")
                success = False
                break
            if self.percent_completed >= 100:
                rospy.loginfo("{title}: feedback 100%".format(title=self.title))
                success = True
                break
            else:
                if goal is None:
                    return False
                pitch, depth = goal
                self.pitch_publisher.publish(pitch)
                self.depth_publisher.publish(depth)
            rate.sleep()
        if success:
            rospy.loginfo("{title}: goal success".format(title=self.title))
            self.action_server.set_succeeded(self.action.action_result.result, "goal reached")
def execute ( self , goal ) : frequency = 3.0 increment = 100 / ( frequency * self . parameters . duration ) self . percent_completed = 0 rate = rospy . Rate ( frequency ) goal = eval ( goal . bt_action_goal ) rospy . loginfo ( "{title}: received a goal:{goal}" . format ( title = self . title , goal = str ( goal ) ) ) self . action_server . preempt_request = False while True : if rospy . is_shutdown ( ) or self . action_server . is_preempt_requested ( ) : rospy . loginfo ( "{title}: goal preempted" . format ( title = self . title ) ) self . action_server . set_preempted ( self . action . action_result . result , "goal was preempted" ) success = False break if self . percent_completed >= 100 : rospy . loginfo ( "{title}: feedback 100%" . format ( title = self . title ) ) success = True break else : if goal is None : return False pitch , depth = goal self . pitch_publisher . publish ( pitch ) self . depth_publisher . publish ( depth ) rate . sleep ( ) if success : rospy . loginfo ( "{title}: goal success" . format ( title = self . title ) ) self . action_server . set_succeeded ( self . action . action_result . result , "goal reached" )
Check for pre-emption, but otherwise just spin around gradually incrementing
a hypothetical 'percent' done.
Check for pre - emption but otherwise just spin around gradually incrementing a hypothetical ' percent ' done .
# We override """
        Check for pre-emption, but otherwise just spin around gradually incrementing
        a hypothetical 'percent' done.

        Args:
            goal (:obj:`any`): goal of type specified by the action_type in the constructor.
        """ #if self.goal_received_callback: #    self.goal_received_callback(goal) # goal.target_pose = don't care # hz # hz # if we just received a goal, we erase any previous pre-emption #rospy.loginfo("{title}: mission execution feedback {percent:.2f}%".format(title=self.title, percent=self.percent_completed)) #self.percent_completed += increment #self.worker()
self
goal
goal (
`any`): goal of type specified by the action_type in the constructor.
` any ` ) : goal of type specified by the action_type in the constructor .