I had a problem with an action client not connecting to the server. I stuck as close to [the tutorial](http://wiki.ros.org/actionlib_tutorials/Tutorials/Writing%20a%20Simple%20Action%20Client%20(Python)) as possible. I tested that the server works by using `rosrun actionlib axclient.py /robot_skills/pick` as proposed [here](https://answers.ros.org/question/194379/actionlib-problems-when-try-to-connect-client-server/).
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")
↧