def start(self):
     ''' Initialize the camera if there is an camera block in use '''
     camera_blocks = len(self._parent.block_list.get_similar_blocks(
         'block', ['camera', 'camera1', 'read_camera', 'luminance']))
     if not self._parent.running_turtleart or camera_blocks > 0:
         if self._status and len(self.cameras) == 0:
             for device in self.devices:
                 self.cameras.append(Camera(device))
             power_manager_off(True)
Ejemplo n.º 2
0
 def quit(self):
     self.pollrun = False
     if self.pollthread:
         self.pollthread.cancel()
     self.butia.closeService()
     self.butia.close()
     if self.bobot:
         self.bobot.kill()
     power_manager_off(False)
 def start(self):
     ''' Initialize the camera if there is an camera block in use '''
     camera_blocks = len(self._parent.block_list.get_similar_blocks(
         'block', ['camera', 'camera1', 'read_camera', 'luminance']))
     if not self._parent.running_turtleart or camera_blocks > 0:
         if self._status and len(self.cameras) == 0:
             for device in self.devices:
                 self.cameras.append(Camera(device))
             power_manager_off(True)
Ejemplo n.º 4
0
 def __init__(self, parent):
     Plugin.__init__(self)
     self.tw = parent
     self.init_gconf()
     power_manager_off(True)
     self.butia = pybot_client.robot(auto_connect=False)
     self.actualSpeed = [600, 600]
     self.active_butia = 0
     self.butia_count = 0
     self.pollthread = None
     self.pollrun = True
     self.bobot = None
     self._auto_refresh = False
     self.use_cc = False
     self.modsen_a_f = 'x'
     self.modsen_b_f = 'x'
     self.modsen_c_f = 'x'
     self.getCastButia()
     self.m_d = {}
     self.match_dict = {}
     self.battery_value = ERROR
     self.battery_color = COLOR_NOTPRESENT[:]
     self.old_battery_color = COLOR_NOTPRESENT[:]
     self.statics_color = COLOR_NOTPRESENT[:]
     self.extras_color = COLOR_NOTPRESENT[:]
     self.old_extras_color = COLOR_NOTPRESENT[:]
     self.match_list = []
     self.modules_changed = []
     self.list_connected_device_module = []
     self.pollthread = threading.Timer(0, self.pybot_launch)
     self.pollthread.start()
     self.can_refresh = True
     self.regex = re.compile(r"""^		#Start of the string
                             (\D*?)			# name, an string  without digits, the ? mark says that it's not greedy, to avoid to consume also the "Butia" part, in case it's present
                             (\d*)				# index, a group comprised only of digits, posibly absent
                             (?:Butia)?			# an ocurrence of the "Butia" string, the first ? mark says that the group hasn't to be returned, the second that the group might or not be present 
                             $				# end of the string, this regex must match all of the input
                     """, re.X)  # Verbose definition, to include comments
     global d
     d['led'] = self.setLed
     d['light'] = self.getLight
     d['gray'] = self.getGray
     d['button'] = self.getButton
     d['distance'] = self.getDistance
     d['resistanceB'] = self.getResistance
     d['voltageB'] = self.getVoltage
     d['temperature'] = self.getTemperature
     d['modSenA'] = self.getSenA
     d['modSenB'] = self.getSenB
     d['modSenC'] = self.getSenC
     d['modActA'] = self.setActA
     d['modActB'] = self.setActB
     d['modActC'] = self.setActC
 def _reset_the_camera(self):
     if self._status and len(self.cameras) > 0:
         for i, camera in enumerate(self.cameras):
             camera.stop_camera_input()
             self._set_autogain(1, camera=i)  # enable AUTOGAIN
         power_manager_off(False)
Ejemplo n.º 6
0
 def _reset_the_camera(self):
     if self._status and len(self.cameras) > 0:
         for i, camera in enumerate(self.cameras):
             camera.stop_camera_input()
             self._set_autogain(1, camera=i)  # enable AUTOGAIN
         power_manager_off(False)
Ejemplo n.º 7
0
    def __init__(self, parent):
        Plugin.__init__(self)
        self.tw = parent
        power_manager_off(True)

        self.apiArDrone = ardroneAPI.ardroneAPI()