ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

[ERROR] : Called wait_for_result when no goal exists

asked 2022-08-09 06:12:24 -0600

anonymous user

Anonymous

updated 2022-08-09 06:13:41 -0600

This is terminal output:

[ERROR] [1660043302.501132, 4595.399000]: Called wait_for_result when no goal exists

[INFO] [1660043302.505849, 4595.405000]: Goal execution done!

It says Goal execution done but robot is not moving.

Can someone help me please?

from unittest import result
import rospy
import actionlib
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal

class SendGoal():
    def __init__(self):
        self.client = actionlib.SimpleActionClient('move_base',MoveBaseAction)
        self.wait = self.client.wait_for_result()

        self.goal = MoveBaseGoal()
        self.goal.target_pose.header.frame_id = "map"
        self.goal.target_pose.header.stamp = rospy.Time.now()
        self.goal.target_pose.pose.position.x = 30.0
        self.goal.target_pose.pose.orientation.w = 0.01
        self.goal.target_pose.pose.position.y = -10.5

    def movebase_client(self):

        self.client.wait_for_server()

        self.client.send_goal(self.goal)

        if result:
            print("job done")
        if not self.wait:
            rospy.logerr("Action server not available!")
            rospy.signal_shutdown("Action server not available!")
        else:
            return self.client.get_result()

if __name__ == '__main__':
    try:
        rospy.init_node('movebase_client_py')
        result = SendGoal().movebase_client()
        if result:
            rospy.loginfo("Goal execution done!")
    except rospy.ROSInterruptException:
        rospy.loginfo("Navigation test finished.")
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-08-09 07:31:46 -0600

muratcngncr gravatar image

updated 2022-08-09 07:47:32 -0600

Hi Onurcan

You are trying to wait result before sending goal to action server. In here

self.wait = self.client.wait_for_result()

You should do that after sending goal

self.client.send_goal(self.goal)
self.wait = self.client.wait_for_result()

and use self.client.wait_for_result() return for result variable.

In the class init you can use client.wait_for_server() function to wait for server.

edit flag offensive delete link more

Comments

Yeah i realized after i posted it but thanks a lot. :)

anonymous userAnonymous ( 2022-08-09 09:45:30 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2022-08-09 06:12:24 -0600

Seen: 172 times

Last updated: Aug 09 '22