Commit f24d4b8a authored by Ivan Tyagov's avatar Ivan Tyagov

Configure over CLI.

parent 11315a99
...@@ -16,9 +16,21 @@ import numpy as np ...@@ -16,9 +16,21 @@ import numpy as np
import asyncio import asyncio
import logging import logging
from asyncua import Server from asyncua import Server
import argparse
SLEEP_DURATION = 10e-3 # 10 milliseconds SLEEP_DURATION = 10e-3 # 10 milliseconds
# command line handling
parser = argparse.ArgumentParser(description='Run optical inspection OPC UA server.')
a = parser.add_argument
a('--ipv4', help='The IPv4 address on which the OPC UA server runs', default="0.0.0.0")
a('--port', help='The port on which the OPC UA server runs', default="4840")
a('--camera', help='The index of the camera (i.e. indxed in /dev/videoX)', default=0)
args = parser.parse_args()
ipv4 = args.ipv4
port = args.port
camera = int(args.camera)
def nothing(x): def nothing(x):
# any operation # any operation
pass pass
...@@ -28,7 +40,7 @@ async def main(): ...@@ -28,7 +40,7 @@ async def main():
# setup our server # setup our server
server = Server() server = Server()
await server.init() await server.init()
server.set_endpoint("opc.tcp://0.0.0.0:4840/freeopcua/server/") server.set_endpoint("opc.tcp://%s:%s/freeopcua/server/" %(ipv4, port))
# set up our own namespace, not really necessary but should as spec # set up our own namespace, not really necessary but should as spec
uri = "http://examples.freeopcua.github.io" uri = "http://examples.freeopcua.github.io"
...@@ -40,7 +52,7 @@ async def main(): ...@@ -40,7 +52,7 @@ async def main():
await myvar.set_writable() await myvar.set_writable()
# init camera # init camera
cap = cv2.VideoCapture(2) cap = cv2.VideoCapture(camera)
cv2.namedWindow("Trackbars") cv2.namedWindow("Trackbars")
cv2.createTrackbar("L-H", "Trackbars", 0, 180, nothing) cv2.createTrackbar("L-H", "Trackbars", 0, 180, nothing)
cv2.createTrackbar("L-S", "Trackbars", 0, 255, nothing) cv2.createTrackbar("L-S", "Trackbars", 0, 255, nothing)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment