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

Revision history [back]

click to hide/show revision 1
initial version

In order for wait_for_server to work, ROS has to be initialized. When you import gripper.py, python tries to run the 3 lines you pasted above since, I assume, they're not contained within any kind of function. So, if you're doing the import at the top of the file before a call to rospy.init_node the wait_for_server call will never return.

Normally, you'd wrap those three lines up in a function, import the file, and then call the function later after a call to rospy.init_node.

I'll admit that I'm guessing on a lot of the points I made since there's not enough information to be sure what's happening in the original post, but hopefully this helps.