def Main(self): msgPattern = MsgPattern() # Publish a goto(0,0) pattern message, and wait for the end effector to initialize. msgPattern.mode = 'byshape' msgPattern.shape = 'constant' msgPattern.points = [] msgPattern.frame = 'Stage' msgPattern.hzPattern = 1.0 msgPattern.hzPoint = rospy.get_param('actuator/hzPoint', 100.0) msgPattern.count = 1 msgPattern.radius = 0.0 msgPattern.preempt = True self.pubPatternGen.publish (msgPattern) while not self.initialized_endeffector: rospy.sleep(0.5) rospy.sleep(2) self.initialized = True # Publish the spiral pattern message. msgPattern.mode = 'byshape' msgPattern.shape = rospy.get_param('calibration/shape', 'spiral') msgPattern.points = [] msgPattern.frame = 'Stage' msgPattern.count = -1 msgPattern.radius = 0.8 * rospy.get_param('arena/radius_inner', 25.4) msgPattern.preempt = True if msgPattern.shape=='spiral': msgPattern.hzPattern = 0.01 else: msgPattern.hzPattern = 0.1 self.pubPatternGen.publish (msgPattern) try: rospy.spin() except KeyboardInterrupt: print "Shutting down" # Publish a goto(0,0) pattern message. msgPattern.mode = 'byshape' msgPattern.shape = 'constant' msgPattern.points = [] msgPattern.frame = 'Stage' msgPattern.hz = 1.0 msgPattern.count = 1 msgPattern.radius = 0.0 msgPattern.preempt = True self.pubPatternGen.publish (msgPattern)
def OnShutdown_callback(self): if self.initialized: msgPattern = MsgPattern() msgPattern.mode = 'byshape' msgPattern.shape = 'constant' msgPattern.points = [] msgPattern.frame = 'Stage' msgPattern.hzPattern = 1.0 msgPattern.hzPoint = 100 msgPattern.count = 1 msgPattern.radius = 0.0 msgPattern.preempt = True self.pubPatternGen.publish (msgPattern)