0
$\begingroup$

Rosanswers logo

I had a problem with an action client not connecting to the server. I stuck as close to the tutorial as possible. I tested that the server works by using rosrun actionlib axclient.py /robot_skills/pick as proposed here.

Still, the code below would get stuck on "Waiting for result".

#!/usr/bin/env python import sys import rospy import actionlib import geometry_msgs.msg import robot_skills.msg class ExampleClass(object): def __init__(self): self.pick_client = actionlib.SimpleActionClient('/robot_skills/pick', robot_skills.msg.pickAction) def do_pick_action(self, robot_name): goal = robot_skills.msg.pickGoal() rospy.loginfo("Sending empty pick action goal") rospy.loginfo(goal) self.pick_client.send_goal(goal) rospy.loginfo("Waiting for result") self.pick_client.wait_for_result() rospy.loginfo("Getting result") return self.pick_client.get_result() if __name__ == '__main__': rospy.init_node('assembly_example') tutorial = ExampleClass() tutorial.do_pick_action("a_bot") 

Originally posted by fvd on ROS Answers with karma: 2180 on 2018-08-13

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The connection to the server wasn't ready, so the goal does not arrive at the server, and the code waits for a result that would never come. Don't waste hours like me, wait for your action servers after starting up your clients or before calling.

class ExampleClass(object): def __init__(self): self.pick_client = actionlib.SimpleActionClient('/o2as_skills/pick', o2as_skills.msg.pickAction) self.pick_client.wait_for_server() 

Originally posted by fvd with karma: 2180 on 2018-08-13

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by gvdhoorn on 2018-08-13:\

wait for your action servers after starting up your clients or before calling

As the tutorial actually does :)

Comment by fvd on 2018-08-13:
I know :( But I've googled stupider things before, maybe someone someday can save an hour.

$\endgroup$