7 import actionlib_tutorials.msg
11 _feedback = actionlib_tutorials.msg.FibonacciFeedback()
12 _result = actionlib_tutorials.msg.FibonacciResult()
25 self._feedback.sequence = []
26 self._feedback.sequence.append(0)
27 self._feedback.sequence.append(1)
30 rospy.loginfo(
'%s: Executing, creating fibonacci sequence of order %i with seeds %i, %i' % (self.
_action_name, goal.order, self._feedback.sequence[0], self._feedback.sequence[1]))
33 for i
in range(1, goal.order):
35 if self._as.is_preempt_requested():
37 self._as.set_preempted()
40 self._feedback.sequence.append(self._feedback.sequence[i] + self._feedback.sequence[i-1])
47 self._result.sequence = self._feedback.sequence
49 self._as.set_succeeded(self.
_result)
51 if __name__ ==
'__main__':
52 rospy.init_node(
'fibonacci')
def execute_cb(self, goal)