Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
osie
Commits
f24d4b8a
Commit
f24d4b8a
authored
May 16, 2024
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Configure over CLI.
parent
11315a99
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
oi-sensor/oi-sensor.py
oi-sensor/oi-sensor.py
+14
-2
No files found.
oi-sensor/oi-sensor.py
View file @
f24d4b8a
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment