Ros basics exercise 9.13

i keep getting that error and do not know why

Your executeCallback did not set the goal to a terminal status. This is a bug in your ActionServer implementation. Fix your code! For now, the ActionServer will set this goal to aborted

my server code using python

#! /usr/bin/env python 

import rospy 
import actionlib
from actionlib.msg import TestAction , TestResult , TestFeedback
from geometry_msgs.msg import Twist 
from std_msgs.msg import Empty
import time

class exercise(object):

    result = TestResult()
    feedback = TestFeedback()

    def __init__(self):
      self.server = actionlib.SimpleActionServer("exercise" , TestAction , self.goal_calback , False) = rospy.Publisher("/cmd_vel" , Twist , queue_size=1)
      self.takeoff = rospy.Publisher("/drone/takeoff" , Empty , queue_size=1) = rospy.Publisher("/drone/land" , Empty , queue_size=1)
      self.move = Twist()

    def goal_calback(self,goal):
        r = rospy.Rate(1)
        success = True
        = 1

        rospy.loginfo("exercise action is now executing")
        time_ = 3 
        distance = goal.goal
        speed = distance/time_ 
        count = 1 
        i = 0 
        start_time = time.time()
        for i in range(4):

            if self.server.is_preempt_requested():
               rospy.loginfo("the goal has been canceled")
               success = False

   += 1


            if count == 1 or count == 3 :
                self.move.linear.x = speed
                self.move.angular.z = 0 
                count += 1

            if count == 2 or count == 4 :
                self.move.linear.y = speed
                self.move.angular.z = 0 
                count +=1
        end_time = time.time()
        if success == True: 
            self.result.result = end_time - start_time
            rospy.loginfo("the operation succed")

if __name__ == '__main__':


Hi @80601 ,

I just see one issue in your program:

self.server.publish_feedback( # this line is wrong
self.server.publish_feedback( # this line is correct

I see that you have a different movement logic but I see no issues with your Action Server callback’s program flow.
You have this line self.server.set_succeeded(self.result) in your program, so terminal condition is set. However I do not know how your program would work, so must debug if there are issues.

Try the suggested correction above, maybe, that will fix your program.


1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.