Exemple #1
0
 def __init__(self, *args, **kwargs):
     self.settings_manager = lset.settings_manager(
         parent=self, filename='daw_trans_settings.txt')
     self.settings = self.settings_manager.read_settings()
     def_ip = lset.get_setting('default_IP')
     self.udp_receiver = ludp.receiver(parent=self, default_IP=def_ip)
     self.udp_transceiver = ludp.receiver(parent=self, default_IP=def_ip)
     #self.udp_receiver.parent = self
     #self.udp_transceiver.parent = self
     self.script_sorter.parent = self
     self.daw_signaler.parent = self
     lfu.modular_object_qt.__init__(self, *args, **kwargs)
     self._children_ = [
         self.script_sorter, self.daw_signaler, self.udp_transceiver
     ]
Exemple #2
0
	def __init__(self, *args, **kwargs):
		self.settings_manager = lset.settings_manager(
			parent = self, filename = 'daw_trans_settings.txt')
		self.settings = self.settings_manager.read_settings()
		def_ip = lset.get_setting('default_IP')
		self.udp_receiver = ludp.receiver(
			parent = self, default_IP = def_ip)
		self.udp_transceiver = ludp.receiver(
			parent = self, default_IP = def_ip)
		#self.udp_receiver.parent = self
		#self.udp_transceiver.parent = self
		self.script_sorter.parent = self
		self.daw_signaler.parent = self
		lfu.modular_object_qt.__init__(self, *args, **kwargs)
		self._children_ = [self.script_sorter, 
			self.daw_signaler, self.udp_transceiver]
Exemple #3
0
class ensemble_dispatcher(lfu.modular_object_qt):
    udp_receiver = ludp.receiver()
    udp_transceiver = ludp.transceiver()

    def __init__(self, *args, **kwargs):
        self.udp_receiver.parent = self
        self.udp_transceiver.parent = self
        lfu.modular_object_qt.__init__(self, *args, **kwargs)

    def interpret_udp(self, data):
        print 'instructed to ', data
        if data == 'left': self.on_go_left()
        elif data == 'right': self.on_go_right()
        elif data == 'zero': self.on_go_zero()
        else:
            try:
                data = int(data)
                self.follow_state.set_in_state(data)
            except:
                print 'received a non-generic motor position target'

    def on_start_listening(self, *args, **kwargs):
        self.udp_receiver.listen(*args, **kwargs)

    def on_start_speaking(self, *args, **kwargs):
        self.udp_transceiver.speak(*args, **kwargs)

    def set_settables(self, *args, **kwargs):
        window = args[0]
        self.handle_widget_inheritance(*args, **kwargs)
        self.widg_templates.append(
            lgm.interface_template_gui(
                widgets=['button_set', 'button_set'],
                labels=[[
                    'Attach Motor', 'Start Receiver', 'Talk to Yourself',
                    'Talk To The Aether'
                ], ['Go Left', 'Go Right', 'Go to Zero']],
                bindings=[[
                    self.on_attach_motor, self.on_start_listening,
                    [self.on_start_listening, self.on_start_speaking],
                    self.on_start_speaking
                ], [self.on_go_left, self.on_go_right, self.on_go_zero]],
                bind_events=[[
                    'clicked', 'clicked', ['clicked', 'clicked'], 'clicked'
                ], None]))
        lfu.modular_object_qt.set_settables(self, *args, from_sub=True)
Exemple #4
0
    def __init__(self, *args, **kwargs):
        self.settings_manager = lset.settings_manager(
            parent=self, filename='daw_rec_settings.txt')
        self.settings = self.settings_manager.read_settings()
        def_ip = lset.get_setting('default_IP')
        self.udp_receiver = ludp.receiver(parent=self, default_IP=def_ip)
        self._children_ = [self.udp_receiver]
        #self.udp_receiver.parent = self
        #self.udp_transceiver.parent = self

        self.jog_distance = '0.1'
        self.jog_units = 'normalized'

        self.max_position = self.max_offset
        self.min_position = -self.max_offset

        self.left_state = lpm.motor_state_left(parent=self)
        self.right_state = lpm.motor_state_right(parent=self)
        self.zero_state = lpm.motor_state_zero(parent=self)
        self.follow_state = lpm.motor_state_follow(parent=self)
        if self.on_attach_motor():
            self.log_event(' : '.join(
                ['receiver initiated',
                 str(time.ctime()), '\n\n']))
            self.current_position = self.motors[-1].get_position()
            self.curr_accel = self.motors[-1].getAccel()
            self.curr_accel_bnds = (self.motors[-1].getMinAccel(),
                                    self.motors[-1].getMaxAccel())
            self.curr_vel_limit = self.motors[-1].getVelLimit()
            self.curr_vel_limit_bnds = (self.motors[-1].getVelMin(),
                                        self.motors[-1].getVelMax())
        else:
            self.current_position = 0
            self.curr_accel = 0
            self.curr_accel_bnds = (-1, 1)
            self.curr_vel_limit = 0
            self.curr_vel_limit_bnds = (-1, 1)
        lfu.modular_object_qt.__init__(self, *args, **kwargs)
Exemple #5
0
	def __init__(self, *args, **kwargs):
		self.settings_manager = lset.settings_manager(
			parent = self, filename = 'daw_rec_settings.txt')
		self.settings = self.settings_manager.read_settings()
		def_ip = lset.get_setting('default_IP')
		self.udp_receiver = ludp.receiver(
			parent = self, default_IP = def_ip)
		self._children_ = [self.udp_receiver]
		#self.udp_receiver.parent = self
		#self.udp_transceiver.parent = self

		self.jog_distance = '0.1'
		self.jog_units	  = 'normalized'

		self.max_position = self.max_offset
		self.min_position = -self.max_offset

		self.left_state = lpm.motor_state_left(parent = self)
		self.right_state = lpm.motor_state_right(parent = self)
		self.zero_state = lpm.motor_state_zero(parent = self)
		self.follow_state = lpm.motor_state_follow(parent = self)
		if self.on_attach_motor():
			self.log_event(' : '.join(['receiver initiated', 
								str(time.ctime()), '\n\n']))
			self.current_position = self.motors[-1].get_position()
			self.curr_accel = self.motors[-1].getAccel()
			self.curr_accel_bnds = (self.motors[-1].getMinAccel(), 
									self.motors[-1].getMaxAccel())
			self.curr_vel_limit = self.motors[-1].getVelLimit()
			self.curr_vel_limit_bnds = (self.motors[-1].getVelMin(), 
										self.motors[-1].getVelMax())
		else:
			self.current_position = 0
			self.curr_accel = 0
			self.curr_accel_bnds = (-1, 1)
			self.curr_vel_limit = 0
			self.curr_vel_limit_bnds = (-1, 1)
		lfu.modular_object_qt.__init__(self, *args, **kwargs)