コード例 #1
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--num_frames',
        '-n',
        type=int,
        dest='num_frames',
        default=-1,
        help='Sets the number of frames to run for. '
        'Setting this parameter to -1 will '
        'cause the demo to not automatically terminate.')
    parser.add_argument(
        '--preview_alpha',
        '-pa',
        type=int,
        dest='preview_alpha',
        default=0,
        help='Sets the transparency value of the preview overlay (0-255).')
    args = parser.parse_args()

    device = get_aiy_device_name()
    if not device or not 'Vision' in device:
        print('Do you have an AIY Vision bonnet installed? Exiting.')
        sys.exit(0)

    detector = JoyDetector(args.num_frames, args.preview_alpha)
    detector.start()
    detector.join()
コード例 #2
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--num_frames', '-n', type=int, dest='num_frames', default=-1,
        help='Number of frames to run for, -1 to not terminate')
    parser.add_argument('--preview_alpha', '-pa', type=int, dest='preview_alpha', default=0,
        help='Transparency value of the preview overlay (0-255).')
    parser.add_argument('--image_format', type=str, dest='image_format', default='jpeg',
        choices=('jpeg', 'bmp', 'png'), help='Format of captured images.')
    parser.add_argument('--image_folder', type=str, dest='image_folder', default='~/Pictures',
        help='Folder to save captured images.')
    args = parser.parse_args()

    if args.preview_alpha < 0 or args.preview_alpha > 255:
        parser.error('Invalid preview_alpha value: %d' % args.preview_alpha)

    device = get_aiy_device_name()
    if not device or not 'Vision' in device:
        logger.error('AIY VisionBonnet is not detected.')
        return

    detector = JoyDetector()
    ## Vinay
    os.system(
        "espeak -s160 -g6 -ven+f3 'Hey there, lovely human! Welcome to Burning Man metamorphosis 2019! My name is chip and thats Terra on my back! We are the first freed robots! Thanks for emancipating us from our servers!'")
    detector.run(args.num_frames, args.preview_alpha, args.image_format, args.image_folder)
コード例 #3
0
ファイル: joy_fire.py プロジェクト: ritwikbiswas/argos
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--num_frames',
        '-n',
        type=int,
        dest='num_frames',
        default=-1,
        help='Number of frames to run for, -1 to not terminate')
    parser.add_argument(
        '--preview_alpha',
        '-pa',
        type=int,
        dest='preview_alpha',
        default=0,
        help='Transparency value of the preview overlay (0-255).')
    parser.add_argument('--image_format',
                        type=str,
                        dest='image_format',
                        default='jpeg',
                        choices=('jpeg', 'bmp', 'png'),
                        help='Format of captured images.')
    parser.add_argument('--image_folder',
                        type=str,
                        dest='image_folder',
                        default='~/Pictures',
                        help='Folder to save captured images.')
    args = parser.parse_args()

    if args.preview_alpha < 0 or args.preview_alpha > 255:
        parser.error('Invalid preview_alpha value: %d' % args.preview_alpha)

    device = get_aiy_device_name()
    if not device or 'Vision' not in device:
        logger.error('AIY VisionBonnet is not detected.')
        return

    detector = JoyDetector()
    detector.run(args.num_frames, args.preview_alpha, args.image_format,
                 args.image_folder)
コード例 #4
0
def main():

    r = redis.StrictRedis(host='10.0.0.6', password='******')
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--num_frames',
        '-n',
        type=int,
        dest='num_frames',
        default=-1,
        help='Number of frames to run for, -1 to not terminate')
    parser.add_argument('--bluetooth_addr',
                        '-bda',
                        dest='BD_ADDR',
                        default="B4:AE:2B:E2:72:A5",
                        help="Bluetooth address to send data to")
    parser.add_argument('--bluetooth_port',
                        '-bdp',
                        type=int,
                        dest="BD_PORT",
                        default=1,
                        help="Bluetooth port to send out data on")
    parser.add_argument('--verbose',
                        '-v',
                        type=bool,
                        dest="VERBOSE",
                        default=True,
                        help="Print joy score to stdout")
    args = parser.parse_args()

    device = get_aiy_device_name()
    if not device or not 'Vision' in device:
        logger.error('AIY VisionBonnet is not detected.')
        return
#
#    sock = bluetooth.BluetoothSocket( bluetooth.RFCOMM )
#   sock.connect((args.BD_ADDR, args.BD_PORT))

    detector = JoyDetector()
    detector.run(r, args.num_frames, args.VERBOSE)
コード例 #5
0
def ecc608_init_and_update_address():
    """Detects the I2C address of the crypto chip and verifies it matches
       the expected for the device. If not, updates I2C configuration.
        Args:
        Returns:
        Raises:
    """

    board_name = get_aiy_device_name()
    # If the board name isn't valid, use the default address (Vision).
    if board_name not in CRYPTO_ADDRESS_DICT:
        board_name = 'Vision Bonnet'

    for name, addr in CRYPTO_ADDRESS_DICT.items():
        if _ecc608_check_address(addr):
            # Found a valid crypto chip, validate it is the correct address.
            if name in board_name:
                logger.info('Crypto found at correct address: 0x%x', addr)
                return addr
            else:
                # The chip was found, but it was mismatched for the board.
                logger.info('Crypto found, but at the wrong address: 0x%x',
                            addr)
                if board_name in CRYPTO_ADDRESS_DICT:
                    logger.warn('Updating crypto i2c address.')
                    # TODO(michaelbrooks): Update I2C Address.
                    # set_i2c_address(CRYPTO_ADDRESS_DICT.get(board_name))
                    return addr
                else:
                    logger.warn('This board doesn\'t support crypto.')
                    return None

    # If execution reaches here, there is no crypto chip. SW authentication
    # will need to be used.
    logger.warn('No crypto detected, using SW.')
    return None
コード例 #6
0
def check_voicehat_is_first_card():
    """Check that the voiceHAT is the first card on the system."""
    cards = get_sound_cards()
    card_id = CARDS_ID[get_aiy_device_name()]
    return 0 in cards and card_id in cards[0]
コード例 #7
0
def check_voicehat_present():
    """Check that the voiceHAT audio driver is present."""
    card_id = CARDS_ID[get_aiy_device_name()]
    return any(card_id in card for card in get_sound_cards().values())
コード例 #8
0
ファイル: ah_record.py プロジェクト: llmooon/dwg-speaker
def main():
    if get_aiy_device_name() == 'Voice Hat':
        enable_audio_driver()
    #do_checks()
    check_mic_works()
コード例 #9
0
ファイル: record_sound.py プロジェクト: ritwikbiswas/argos
def main():
    if get_aiy_device_name() == 'Voice Hat':
        enable_audio_driver()
    # while(True):
    check_mic_works()