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)
def SendInputPoints(self): pattern = MsgPattern() pattern.mode = 'bypoints' pattern.shape = 'constant' pattern.frame_id = 'Plate' pattern.hzPattern = 1.0 pattern.hzPoint = 100.0 pattern.count = 1 pattern.points = self.pointsInput pattern.radius = 20.0 pattern.preempt = False command = MsgGalvoCommand() command.frameid_target_list = ['Plate',] command.pattern_list = [pattern,] command.units = 'volts' #'millimeters' # 'volts' # self.pubGalvoCommand.publish(command)
def TrackFly1(self): pattern = MsgPattern() pattern.mode = 'byshape' pattern.shape = 'grid' pattern.frame_id = 'Fly1' pattern.hzPattern = 40.0 pattern.hzPoint = 1000.0 pattern.count = 1 pattern.points = [] pattern.radius = 5 pattern.preempt = False command = MsgGalvoCommand() command.frameid_target_list = ['Plate',] command.pattern_list = [pattern,] command.units = 'millimeters' # 'millimeters' or 'volts' self.pubGalvoCommand.publish(command)