def __init__(self): # Start the node rospy.init_node('armDriver', anonymous=True) self.armDriver = ArmDriver() # Setup topics so that users can control the motors self.setArmMotorStatesTopic = rospy.Subscriber( "setArmMotorStates", maplin_arm.msg.SetMotorStates, self.setArmMotorStatesCallback)
def listener(self): # In ROS, nodes are uniquely named. If two nodes with the same # name are launched, the previous one is kicked off. The # anonymous=True flag means that rospy will choose a unique # name for our 'listener' node so that multiple listeners can # run simultaneously. rospy.init_node('listener', anonymous=True) self.armDriver = ArmDriver() rospy.Subscriber('setArmMotorStates', SetMotorStates, self.setArmMotorStatesCallback) rospy.Timer(rospy.Duration(2), self.my_callback) rospy.spin()