Example #1
0
        '/etc/' + CFG_FILE_NAME,
        os.path.expanduser('~/.' + CFG_FILE_NAME)
    ]

    cfg = simpleconfig.parse(files=dflt_search_path, defaults={
        'port' : dspin.RASPI_SPI_DEVICE,
        'max_speed' : 1000,
        'step_mode' : 7,
        'resolution' : 400,
        'stdby_gpio' : 24,
        'cs_gpio' : 26,
        'not_busy_gpio' : 22
    })

    parser = cli.get_argument_parser(
        description="Demonstration of controlling a stepper motor with a dSPIN chip via SPI."
    )
    parser.add_argument('-R', '--resolution',
                        help="Stepper motor resolution (steps/turn)",
                        dest='resolution',
                        type=int,
                        default=cfg['resolution']
                        )
    parser.add_argument('-M', '--max-speed',
                        help="Maximum speed (steps/sec)",
                        dest='max_speed',
                        type=int,
                        default=cfg['max_speed']
                        )
    parser.add_argument('-S', '--step-mode',
                        help="Step mode (in range 0=full step,... 7=1/128 step)",
Example #2
0
    """ DMXL servo id CLI argument type checker."""
    try:
        dmxlid = int(s)
        if 1 <= dmxlid <= 250:
            return dmxlid
        else:
            raise ValueError()
    except ValueError:
        raise ArgumentTypeError('must be a positive integer')

def sigterm_handler(signum, frame):
    log.getLogger('sighandler').info('!! SIGTERM caught !!')
    ControlServerHandler._shutdown_requested = True #pylint: disable=W0212

if __name__ == '__main__':
    parser = cli.get_argument_parser(description='Dual beacons controller')

    parser.add_argument('-i', '--intf_dev',
                        help='device of the DMXL bus interface',
                        default='/dev/ttyACM0',
                        dest='intf_dev'
                        )
    parser.add_argument('-l', '--left_id',
                        help='id of left beacon servo',
                        default=2,
                        type=_servo_id,
                        dest='left_id'
                        )
    parser.add_argument('-r', '--right_id',
                        help='id of right beacon servo',
                        default=1,
Example #3
0
        sequence = robot.song_sequence_record(0, s.score)
        robot.song_sequence_play(sequence)


if __name__ == '__main__':
    dflt_search_path = [
        '/etc/demo-create.cfg',
        os.path.expanduser('~/.demo-create.cfg')
    ]

    cfg = simpleconfig.parse(files=dflt_search_path, defaults={
        'port' : '/dev/ttyUSB0'
    })

    parser = cli.get_argument_parser(
        description="Demonstration of controlling a iRobot Create robot with Python scripts."
    )
    parser.add_argument(dest='demo',
                        metavar='DEMO_NAME',
                        choices=_all_demos.keys() + ['?'],
                        nargs=1,
                        help="demonstration selector. Use '?' for a detailed list"
                        )
    parser.add_argument('-p', '--port',
                        help="Create connection serial port",
                        dest='port',
                        default=cfg['port']
                        )
    parser.add_argument('-T', '--trace',
                        help="""Trace the communications with the Create and set the display format
                        ('d' = decimal, 'h' = hex)""",