コード例 #1
0
 def blinking_stopped(self):
     time.sleep(1)
     ugm_helper.send_config(self.conn, self.status_ugm)
     ugm_helper.send_status(self.conn, self.break_text)
     time.sleep(self.break_duration)
     ugm_helper.send_config(self.conn, self.blinking_ugm)
     time.sleep(1)
     ugm_helper.send_start_blinking(self.conn)
コード例 #2
0
 def blinking_stopped(self):
     time.sleep(1)
     ugm_helper.send_config(self.conn, self.status_ugm)
     ugm_helper.send_status(self.conn, self.break_text)
     time.sleep(self.break_duration)
     ugm_helper.send_config(self.conn, self.blinking_ugm)
     time.sleep(1)
     ugm_helper.send_start_blinking(self.conn)
コード例 #3
0
 def robot(self, command):
     t = time.time()
     try:
         if command == 'forward':
             self._robot_cmd(self._robot.forward, command)
         elif command == 'backward':
             self._robot_cmd(self._robot.backward, command)
         elif command == 'left':
             self._robot_cmd(self._robot.left, command)
         elif command == 'right':
             self._robot_cmd(self._robot.right, command)
         elif command == 'camera_up':
             result = self._robot.head_up()
             self.logger.info(str(result) + "command: " + command)
         elif command == 'camera_middle':
             result = self._robot.head_middle()
             self.logger.info(str(result) + "command: " + command)
         elif command == 'camera_down':
             result = self._robot.head_down()
             self.logger.info(str(result) + "command: " + command)
         elif command == 'rotate_right':
             self._robot.rotate_right(angle=7)
         elif command == 'rotate_left':
             self._robot.rotate_left(angle=7)
         elif command == 'left_forward':
             self.robot('rotate_left')
             time.sleep(1)
             self.robot('forward')
         elif command == 'right_forward':
             self.robot('rotate_right')
             time.sleep(1)
             self.robot('forward')
         else:
             self.logger.error('(rovio handling) Command ' + command +
                               ' not supported.')
     except:
         self.logger.error(
             "NO CONNECTION TO ROBOT!!!! COMMAND IGNORED!!! In time: " +
             str(time.time() - t))
         if self.robot_info:
             ugm_helper.send_status(
                 self.conn, "Couldn't connect to Robot... Command ignored.")
         time.sleep(0.5)
コード例 #4
0
    def begin(self):
        ugm_helper.send_config(self.conn, self.status_ugm)
        ugm_helper.send_status(self.conn, self.hi_text)
        time.sleep(5)
        ugm_helper.send_status(self.conn, self.hi_text_2)
        time.sleep(8)
        ugm_helper.send_status(self.conn, self.hi_text_3)
        time.sleep(3)
        ugm_helper.send_status(self.conn, "")

        self.logger.info("Send begin config ...")
        ugm_helper.send_config(self.conn, self.blinking_ugm)
        self.logger.info("Send start blinking on begin ...")
        ugm_helper.send_start_blinking(self.conn)
コード例 #5
0
    def begin(self):
        ugm_helper.send_config(self.conn, self.status_ugm)
        ugm_helper.send_status(self.conn, self.hi_text)
        time.sleep(5)
        ugm_helper.send_status(self.conn, self.hi_text_2)
        time.sleep(8)
        ugm_helper.send_status(self.conn, self.hi_text_3)
        time.sleep(3)
        ugm_helper.send_status(self.conn, "")

        self.logger.info("Send begin config ...")
        ugm_helper.send_config(self.conn, self.blinking_ugm)
        self.logger.info("Send start blinking on begin ...")
        ugm_helper.send_start_blinking(self.conn)
コード例 #6
0
ファイル: robot_engine.py プロジェクト: BrainTech/openbci
 def robot(self, command):
     t = time.time()
     try:
         if command == 'forward':
             self._robot_cmd(self._robot.forward, command)
         elif command == 'backward':
             self._robot_cmd(self._robot.backward, command)
         elif command == 'left':
             self._robot_cmd(self._robot.left, command)
         elif command == 'right':
             self._robot_cmd(self._robot.right, command)
         elif command == 'camera_up':
             result = self._robot.head_up()
             self.logger.info(str(result) + "command: " + command)
         elif command == 'camera_middle':
             result = self._robot.head_middle()
             self.logger.info(str(result) + "command: " + command)
         elif command == 'camera_down':
             result = self._robot.head_down()
             self.logger.info(str(result) + "command: " + command)
         elif command == 'rotate_right':
             self._robot.rotate_right(angle=7)
         elif command == 'rotate_left':
             self._robot.rotate_left(angle=7)
         elif command == 'left_forward':
             self.robot('rotate_left')
             time.sleep(1)
             self.robot('forward')
         elif command == 'right_forward':
             self.robot('rotate_right')
             time.sleep(1)
             self.robot('forward')
         else:
             self.logger.error('(rovio handling) Command ' + command + ' not supported.')
     except:
         self.logger.error("NO CONNECTION TO ROBOT!!!! COMMAND IGNORED!!! In time: "+str(time.time()-t))
         if self.robot_info:
             ugm_helper.send_status(self.conn, "Couldn't connect to Robot... Command ignored.")
         time.sleep(0.5)
コード例 #7
0
 def end(self):
     ugm_helper.send_config(self.conn, self.status_ugm)
     ugm_helper.send_status(self.conn, self.bye_text)
     #acquire some more data
     time.sleep(2)
     acquisition_helper.send_finish_saving(self.conn)
コード例 #8
0
 def end(self):
     ugm_helper.send_config(self.conn, self.status_ugm)
     ugm_helper.send_status(self.conn, self.bye_text)
     #acquire some more data
     time.sleep(2)
     acquisition_helper.send_finish_saving(self.conn)