Exemplo n.º 1
0
	def __init__(self, root, state=None):
		self.root = root
		
		ShetClient.__init__(self)
		Controller.__init__(self, state)
		
		self.add_action("set_state", self.set_state)
Exemplo n.º 2
0
 def __init__(self, parent):
     Cell.__init__(self, parent)
     Controller.__init__(self, self.parent.canvas, parent)
     self.offset_x = 0
     self.offset_y = 0
     self.update_request = False
     self.old_zoom = False
Exemplo n.º 3
0
    def __init__(self, topic, sleep):
        Controller.__init__(self, topic, sleep)

        self.action = None
        self.repeat = 0
        self.turn = 0
        self.running = True
Exemplo n.º 4
0
 def __init__(self):
     Controller.__init__(self)
     self.s = socket.socket()
     self.host = socket.gethostname()
     self.port = self.SERVER_PORT
     print("Your IP address is: %s" % socket.gethostbyname(self.host))
     self.s.bind((self.host, self.port))
Exemplo n.º 5
0
    def __init__(self, event_manager, server_url=None):
        # Setup inital states
        Controller.__init__(self, event_manager)
        self._server_url = server_url
        self.system_state = SystemState.ARMED
        self.user_list = []
        self.input_devices = []
        self.door_timer_delay = DOOR_EVENT_TIMER_DELAY

        # Load the event handlers functions into a dictionary to make calling
        # the appropriate function easier through the enum
        self.event_handling_functions = {
            EventType.DOOR_SENSOR_EVENT: self._handle_door_event,
            EventType.WINDOW_SENSOR_EVENT: self._handle_window_event,
            EventType.FLOOD_SENSOR_EVENT: self._handle_flood_event,
            EventType.TEMP_SENSOR_EVENT: self._handle_temp_event,
            EventType.MOTION_SENSOR_EVENT: self._handle_motion_event,
            EventType.ALARM_EVENT: self._handle_alarm_event,
            EventType.KEYPAD_EVENT: self._handle_keypad_event,
            EventType.NFC_EVENT: self._handle_nfc_event,
        }

        # Subscribe to events
        if self.event_manager is not None:
            for event_type in self.event_handling_functions.keys():
                self.event_manager.subscribe(event_type, self)
 def __init__(self, params):
     '''Initialize internal variables'''
     Controller.__init__(self,params)
     
     # This angle shows the direction that the controller
     # tries to follow. It is used by the supervisor
     # to draw and debug this controller
     self.heading_angle = 0
Exemplo n.º 7
0
    def __init__(self, params):
        '''Initialize internal variables'''
        Controller.__init__(self, params)

        # This angle shows the direction that the controller
        # tries to follow. It is used by the supervisor
        # to draw and debug this controller
        self.heading_angle = 0
 def __init__(self, user, log_helper, data):
     Controller.__init__(self, user, log_helper, 'ServiceController')
     self._gmail_client = data['gmail_client']
     self._service_dao = data['service_dao']
     self._songs_dao = data['songs_dao']
     self._slides_helper = data['slides_helper']
     self._recipients_dao = data['recipients_dao']
     self._band_dao = data['band_dao']
Exemplo n.º 9
0
    def __init__(self, source, size):
        """Default constructor.

        :param source: Path of the source file the neuron will be created from.
        :param size: Number of neuron to be created through this controller.
        """
        Controller.__init__(self, size, "Creating neurons")
        self.source = source
Exemplo n.º 10
0
    def __init__(self, controlled_object):
        Controller.__init__(self, controlled_object)
        self.agent = Agent(Settings.ARCHITECTURE, Settings.LR, Settings.GAMMA,
                           Settings.SAVE_INTERVAL,
                           Settings.LOAD_MOST_RECENT_MODEL,
                           Settings.SAVE_DIRECTORY)

        if not Settings.LOAD_MOST_RECENT_MODEL:
            self.agent._load_model(f"../models/chkpnt-{Settings.LO}.h5")
Exemplo n.º 11
0
    def __init__(self, params):
        """init
        @params: 

        """
        Controller.__init__(self,params)

        self.E_k = 0 # integrated error
        self.e_k_1 = 0 # last step error
Exemplo n.º 12
0
    def __init__(self, config):
        Controller.__init__(self)

        self.log.debug("[__init__]: Initializing Lab...")

        self.chambers = []
        self.equipment = []

        # Initialize the Lab
        self.config(config)
Exemplo n.º 13
0
 def __init__(self, **kwargs):
     Controller.__init__(self, **kwargs)
     self.l3_up = 0
     self.l3_down = 0
     self.l3_left = 0
     self.l3_right = 0
     self.r3_up = 0
     self.r3_down = 0
     self.r3_left = 0
     self.r3_right = 0
 def __init__(self, net, actor):
     Controller.__init__(self, actor)
     self.net = net
     self.values = net[:]
     self.weights = [tf.random_normal((24,1), stddev=0.1), tf.random_normal((4,1), stddev=0.1)]
     self.w1 = init_weights((24, 256))
     self.w2 = init_weights((256, 4))
     self.yhat = [0,0,0,0,0]
     self.pred = [0]*5
     self.X = tf.placeholder("float", shape=[None, 24])
 def __init__(self, application):
     Controller.__init__(self, True)
     self.application = application
     self.initialiseMutex()
     self.equipDBSystem = None
     self.devicesInfo = self.getDevicesInfo()
     self.sparesInfo = self.getSparesInfo()
     self.mainWindow = MainWindow(self)
     self.devicesWidget = DevicesWidget(self.devicesInfo, self.mainWindow, self)
     self.sparesWidget = SparesWidget(self.sparesInfo, self.mainWindow, self)
     self.connectActions(self.mainWindow)
     self.mainWindow.show()
Exemplo n.º 16
0
	def __init__(self, root, default_timeout=None, default_state=None):
		self.root = root
		self.default_timeout = default_timeout
		self.default_state = default_state
		self.timer = None
		
		ShetClient.__init__(self)
		
		Controller.__init__(self, default_state)
		
		self.on_timed_out = self.add_event("timed_out")
		
		self.on_start = self.add_event("on_start")
Exemplo n.º 17
0
	def __init__(self, root, controllers, default_state=False):
		self.root = root
		self.controllers = []
		self.default_state = default_state
		self.controller_states = {}
		self.watches = []
		
		ShetClient.__init__(self)
		# Default to off.
		Controller.__init__(self, False)
		
		# Do all the normal stuff when changing the controllers.
		self.set_controllers(controllers)
Exemplo n.º 18
0
    def __init__(self, parent, op_stack_cb):
        self._operation_stack_cb = op_stack_cb
        self.e = parent.e
        Controller.__init__(self, parent)

        self.e.callback_add("group.changed", self._group_load)
        self.e.callback_add("group.min.changed", self._group_min_load)
        self.e.callback_add("group.max.changed", self._group_max_load)
        self.e.callback_add("group.size.changed", self._group_size_load)
        self.e.callback_add("part.added", self._part_added)
        self.e.part.callback_add("part.changed", self._part_load)
        self.e.part.callback_add("part.unselected", self._part_load)
        self.e.part.callback_add("name.changed", self._part_rename)
        self.e.part.state.callback_add("state.rel1.changed", self._rel1_load)
        self.e.part.state.callback_add("state.rel2.changed", self._rel2_load)
Exemplo n.º 19
0
    def __init__(self, parent, op_stack_cb):
        self._operation_stack_cb = op_stack_cb
        self.e = parent.e
        Controller.__init__(self, parent)

        self.e.callback_add("group.changed", self._group_load)
        self.e.callback_add("group.min.changed", self._group_min_load)
        self.e.callback_add("group.max.changed", self._group_max_load)
        self.e.callback_add("group.size.changed", self._group_size_load)
        self.e.callback_add("part.added", self._part_added)
        self.e.part.callback_add("part.changed", self._part_load)
        self.e.part.callback_add("part.unselected", self._part_load)
        self.e.part.callback_add("name.changed", self._part_rename)
        self.e.part.state.callback_add("state.rel1.changed", self._rel1_load)
        self.e.part.state.callback_add("state.rel2.changed", self._rel2_load)
Exemplo n.º 20
0
    def __init__(self):
        Controller.__init__(self, self.log_file)
        self.logging.info("TicTacToe controller initiated")
        self.matrix = []
        self.board = []
        self.alpha = -9999999999
        self.beta = 9999999999
        for i in range(3):
            a = []
            for i in range(3):
                a.append('_')
            self.board.append(a)

        for i in range(1, 9, 3):
            self.matrix.append(range(i, i + 3))
        self.logging.info("matrix has been built")
        self.logging.info(str(self.matrix))
Exemplo n.º 21
0
	def __init__(self, root, lat, long, leeway = 30*60):
		self.root = root
		
		self.lat  = lat
		self.long = long
		
		# How long before sunset/after sunrise should the lights still turn on
		self.leeway = leeway
		
		ShetClient.__init__(self)
		Controller.__init__(self, None)
		
		# Allow overriding
		self.add_action("override_state", self.set_state)
		
		# Start the process
		self.update_state()
Exemplo n.º 22
0
 def __init__(self, debug=False, log=None, config=None):
     Controller.__init__(self, debug=False)
     
     self.indexer = Indexer(debug=debug, log=log)
     if self.indexer.serial is None:
         raise Exception("USBIO missing serial")
     
     c = config['cnc']['pr0ndexer']
     self.indexer.configure(acl=int(c.get('acl', '325')),
             velmin=int(c.get('velmin', '10')), velmax=int(c.get('velmax', '9250')),
             hstep_c=int(c.get('hstep_c', '740000')))
     
     self.x = PDCAxis('X', self.indexer, config=config)
     self.y = PDCAxis('Y', self.indexer, config=config)
     self.z = PDCAxis('Z', self.indexer, config=config)
     
     self.axes = [self.x, self.y, self.z]
     # enforce some initial state?
     
     self.um()
Exemplo n.º 23
0
    def __init__(self, debug=False, log=None):
        Controller.__init__(self, debug=False, log=log)

        self.usbio = USBIO(debug=debug)
        self.log('opened some USBIO okay')
        if self.usbio.serial is None:
            raise Exception("USBIO missing serial")

        self.axes = [
            MCAxis('X', self, 0, 1, invert_dir=True, log=log),
            MCAxis('Y', self, 2, 3, invert_dir=False, log=log),
            MCAxis('Z', self, 4, 5, invert_dir=False, log=log),
        ]

        for axis in self.axes:
            axis.forward(True)
        #self.inches()
        self.um()
        # enforce some initial state?
        #self.off()
        self.log('Controller ready')
Exemplo n.º 24
0
    def __init__(self, debug=False, log=None, config=None):
        Controller.__init__(self, debug=False)

        self.indexer = Indexer(debug=debug, log=log)
        if self.indexer.serial is None:
            raise Exception("USBIO missing serial")

        c = config['cnc']['pr0ndexer']
        self.indexer.configure(acl=int(c.get('acl', '325')),
                               velmin=int(c.get('velmin', '10')),
                               velmax=int(c.get('velmax', '9250')),
                               hstep_c=int(c.get('hstep_c', '740000')))

        self.x = PDCAxis('X', self.indexer, config=config)
        self.y = PDCAxis('Y', self.indexer, config=config)
        self.z = PDCAxis('Z', self.indexer, config=config)

        self.axes = [self.x, self.y, self.z]
        # enforce some initial state?

        self.um()
Exemplo n.º 25
0
    def __init__(self, debug=False, log=None):
        Controller.__init__(self, debug=False, log=log)

        self.usbio = USBIO(debug=debug)
        self.log("opened some USBIO okay")
        if self.usbio.serial is None:
            raise Exception("USBIO missing serial")

        self.axes = [
            MCAxis("X", self, 0, 1, invert_dir=True, log=log),
            MCAxis("Y", self, 2, 3, invert_dir=False, log=log),
            MCAxis("Z", self, 4, 5, invert_dir=False, log=log),
        ]

        for axis in self.axes:
            axis.forward(True)
        # self.inches()
        self.um()
        # enforce some initial state?
        # self.off()
        self.log("Controller ready")
Exemplo n.º 26
0
    def __init__(self, event_manager, server_url=None):
        Controller.__init__(self, event_manager)
        self._server_url = server_url
        self.system_state = SystemState.ARMED
        self.user_list = []
        self.input_devices = []
        self.door_timer_delay = DOOR_EVENT_TIMER_DELAY

        self.event_handling_functions = {
            EventType.DOOR_SENSOR_EVENT : self._handle_door_event,
            EventType.WINDOW_SENSOR_EVENT : self._handle_window_event,
            EventType.FLOOD_SENSOR_EVENT : self._handle_flood_event,
            EventType.TEMP_SENSOR_EVENT : self._handle_temp_event,
            EventType.MOTION_SENSOR_EVENT : self._handle_motion_event,
            EventType.ALARM_EVENT : self._handle_alarm_event,
            EventType.KEYPAD_EVENT : self._handle_keypad_event,
            EventType.NFC_EVENT : self._handle_nfc_event
        }

        # Subscribe to events
        if self.event_manager is not None:
            for event_type in self.event_handling_functions.keys():
                self.event_manager.subscribe(event_type, self)
Exemplo n.º 27
0
    def __init__(self, params):
        '''Initialize internal variables'''
        
        # Find us a joystick
        
        pygame.init()
        joystick.init()
        
        if joystick.get_count() == 0:
            raise OSError("No joysticks found!")
        
        self.joystick = joystick.Joystick(0)
        self.joystick.init()
        self.i_j = 0
        self.i_x = 0
        self.i_y = 1
        self.inv_x = True
        self.inv_y = True

        self.v_max = params[1]
        self.w_max = params[2]

        Controller.__init__(self, params[0])
Exemplo n.º 28
0
    def __init__(self, params):
        '''Initialize internal variables'''

        # Find us a joystick

        pygame.init()
        joystick.init()

        if joystick.get_count() == 0:
            raise OSError("No joysticks found!")

        self.joystick = joystick.Joystick(0)
        self.joystick.init()
        self.i_j = 0
        self.i_x = 0
        self.i_y = 1
        self.inv_x = True
        self.inv_y = True

        self.v_max = params[1]
        self.w_max = params[2]

        Controller.__init__(self, params[0])
Exemplo n.º 29
0
	def __init__(self, name):
		self.root = root+"/"+name
		ShetClient.__init__(self)
		Controller.__init__(self, None)
		self.add_action("standby", self.standby)
		self.add_action("run", self.run)
Exemplo n.º 30
0
 def __init__(self, topic_name):
   Controller.__init__(self, topic_name)
Exemplo n.º 31
0
 def __init__(self, **kwargs):
     Controller.__init__(self, **kwargs)
     self.car = Car(controller_connected=self.is_connected)
     self.min_value = -32767
     self.max_value = 32767
Exemplo n.º 32
0
 def __init__(self, params):
     Controller.__init__(self,params)
Exemplo n.º 33
0
 def __init__(self, config, minecraft):
     self.minecraft = minecraft;
     Controller.__init__(self, config)
Exemplo n.º 34
0
 def __init__(self, params):
     '''Initialize some variables'''
     
     Controller.__init__(self,params)
     self.heading_angle = 0
Exemplo n.º 35
0
 def __init__(self, topic_name):
   Controller.__init__(self, topic_name)
   #self.set_offset = rospy.ServiceProxy('/%s/set_offset' % self.topic_name, SetJointOffset).call
   #self.get_offset = rospy.ServiceProxy('/%s/get_offset' % self.topic_name, GetJointOffset).call
   self.calibrate_ = rospy.ServiceProxy( '/%s/calibrate' % self.topic_name, CalibrateJoint).call
Exemplo n.º 36
0
 def __init__(self, debug=False, log=None):
     Controller.__init__(self, debug=debug, log=log)
     self.x = DummyAxis('X', log=log)
     self.y = DummyAxis('Y', log=log)
     self.axes = [self.x, self.y]
Exemplo n.º 37
0
 def __init__(self, user, log_helper, recipients_dao):
     Controller.__init__(self, user, log_helper, 'RecipientsController')
     self._recipients_dao = recipients_dao
Exemplo n.º 38
0
 def __init__(self, topic_name):
   Controller.__init__(self, topic_name)
   
   self.set_ = rospy.ServiceProxy('%s/set_command' % self.topic_name, SetCommand).call 
   self.get_ = rospy.ServiceProxy('%s/get_actual' % self.topic_name, GetActual).call
Exemplo n.º 39
0
    def __init__(self, params):
        '''Initialize some variables'''

        Controller.__init__(self, params)
        self.heading_angle = 0
Exemplo n.º 40
0
 def __init__(self, debug=False, log=None):
     Controller.__init__(self, debug=debug, log=log)
     self.x = DummyAxis('X', log=log)
     self.y = DummyAxis('Y', log=log)
     self.axes = [self.x, self.y]
Exemplo n.º 41
0
    def __init__(self, topic, sleep):
        Controller.__init__(self, topic, sleep)

        rospy.loginfo('w, a, s, d to move')
        rospy.loginfo('esc, q to exit')
Exemplo n.º 42
0
 def __init__(self):
     Controller.__init__(self)
Exemplo n.º 43
0
 def __init__(self, **kwargs):
     Controller.__init__(self, **kwargs)
     self.db_host = self.config.get("DB_CLIPPER", "db_host")
     self.db_pwd = self.config.get("DB_CLIPPER", "db_pwd")
     self.db_user = self.config.get("DB_CLIPPER", "db_user")
     self.day = self.get_days()
Exemplo n.º 44
0
 def __init__(self, mainpage):
     Controller.__init__(self, mainpage)
Exemplo n.º 45
0
 def __init__(self):
     Controller.__init__(self)
Exemplo n.º 46
0
 def __init__(self, topic_name):
   Controller.__init__(self, topic_name)
   #self.set_offset = rospy.ServiceProxy('/%s/set_offset' % self.topic_name, SetJointOffset).call
   #self.get_offset = rospy.ServiceProxy('/%s/get_offset' % self.topic_name, GetJointOffset).call
   self.begin_manual_ = rospy.ServiceProxy('/%s/begin_manual_calibration' % self.topic_name, CalibrateJoint).call
   self.end_manual_ = rospy.ServiceProxy('/%s/end_manual_calibration' % self.topic_name, CalibrateJoint).call
 def __init__(self):
     Controller.__init__(self, '/dev/ttyACM0')
     self.prefix = chr(0xaa) + chr(0x0c) + chr(0x04)
Exemplo n.º 48
0
 def __init__(self, controlled_object):
     Controller.__init__(self, controlled_object)
Exemplo n.º 49
0
 def __init__(self, topic_name):
   Controller.__init__(self,topic_name)
   print '/%s/begin_sweep' % self.topic_name
   self.sweep_ = rospy.ServiceProxy('/%s/begin_sweep' % self.topic_name, SetCommand).call
Exemplo n.º 50
0
 def __init__(self, params, yaw = Fuzzy(mf_types, f_ssets)):
     '''Initialize some variables'''
     
     Controller.__init__(self,params)
     self.heading_angle = 0
     self.yaw = yaw
Exemplo n.º 51
0
 def __init__(self, params):
     """Initialize internal variables"""
     Controller.__init__(self, params)
Exemplo n.º 52
0
 def __init__(self, event_manager):
     Controller.__init__(self, event_manager)
     self.sensor_list = []
Exemplo n.º 53
0
Arquivo: car.py Projeto: wshon/scripts
 def __init__(self, car, **kwargs):
     Controller.__init__(self, **kwargs)
     self.car = car
Exemplo n.º 54
0
 def __init__(self, board):
     Controller.__init__(self, board)
Exemplo n.º 55
0
 def __init__(self, user, log_helper, data):
     Controller.__init__(self, user, log_helper, 'AdminController')
     self._user_dao = data
Exemplo n.º 56
0
 def __init__(self, params):
     '''read another .xml for PID parameters?'''
     Controller.__init__(self,params)
     self.clear_error()
Exemplo n.º 57
0
 def __init__(self, user, log_helper, songs_dao):
     Controller.__init__(self, user, log_helper, 'SongController')
     self._songs_dao = songs_dao
Exemplo n.º 58
0
    def __init__(self):
        """

        """
        Controller.__init__(self)
Exemplo n.º 59
0
 def __init__(self, params):
     """Initialize internal variables"""
     Controller.__init__(self,params)