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

I resolved this issue, 1. Create another function out of the class say name use_data(args) 2. Call use_data in main function and you are good to go.

One of the common problem is use of spin command,they block the main thread from exiting until ROS invokes a shutdown - via a Ctrl + C.

def use_data(args):

    ic = move_xarm()

    rospy.init_node('move_group_python_interface_tutorial',anonymous=True)

    rate = rospy.Rate(5) # ROS Rate at 5Hz

    while not rospy.is_shutdown():
     do stuff using the variable ic.my_data
     rate.sleep()