Exemple #1
0
                        break
            except BaseException as e:
                logger.info("Error reading values from HTTP server at %s [%s]",
                            self.hostname, e)
                time.sleep(pause_secs)

            logger.info("Disconnected from HTTP server at %s", self.hostname)


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--host",
                        dest="host",
                        default="localhost:8080",
                        help="Distance server hostname")
    cli.verbose(parser)
    args = vars(parser.parse_args())

    setup_logging(level=args[LOG_LEVEL])

    cnt = 0

    for i in range(5):
        print("Iteration {0}".format(i))
        with HttpDistanceClient(args["host"]) as client:
            for d, j in zip(client.values(), range(10)):
                print(d)
                cnt += 1

            for j in range(10):
                print(client.value())
Exemple #2
0
                   help="Dual color BGR value")
    p.add_argument("--singlebgr",
                   dest=SINGLE_BGR,
                   required=True,
                   help="Single color BGR value")
    p.add_argument("--dualport",
                   dest=DUAL_PORT,
                   default=GRPC_PORT_DEFAULT,
                   type=int,
                   help="Dual gRPC port [{0}]".format(GRPC_PORT_DEFAULT))
    p.add_argument("--singleport",
                   dest=SINGLE_PORT,
                   default=GRPC_PORT_DEFAULT + 1,
                   type=int,
                   help="Dual gRPC port [{0}]".format(GRPC_PORT_DEFAULT + 1))
    cli.verbose(p)
    args = vars(p.parse_args())

    # Setup logging
    setup_logging(level=args[LOG_LEVEL])

    tracker = ObjectTracker(width=args[WIDTH],
                            middle_percent=args[MIDDLE_PERCENT],
                            display=args[DISPLAY],
                            flip_x=args[FLIP_X],
                            flip_y=args[FLIP_Y],
                            mask_x=args[MASK_X],
                            mask_y=args[MASK_Y],
                            usb_camera=args[USB_CAMERA],
                            usb_port=args[USB_PORT],
                            camera_name=args[CAMERA_NAME],