0
$\begingroup$

Rosanswers logo

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.")

Originally posted by anonymous60874 on ROS Answers with karma: 1 on 2022-08-09

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by muratcngncr with karma: 56 on 2022-08-09

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by anonymous60874 on 2022-08-09:
Yeah i realized after i posted it but thanks a lot. :)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.