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
7d89645a
Commit
7d89645a
authored
Jun 21, 2024
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update only if it makes sense.
parent
f23927cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
oi-sensor/oi-sensor.py
oi-sensor/oi-sensor.py
+9
-7
No files found.
oi-sensor/oi-sensor.py
View file @
7d89645a
...
...
@@ -161,10 +161,11 @@ async def main():
print
(
"
\
t
Detected area (px)=%.2f, result=%d, shape changes=%d"
%
(
area
,
result
,
shape_change_counter
))
# update list for last X results (FILO)
result_stack
.
append
(
result
)
current_shape
=
result
shape_change_counter
+=
1
await
myvar
.
write_value
(
result
)
if
current_shape
!=
result
:
result_stack
.
append
(
result
)
current_shape
=
result
shape_change_counter
+=
1
await
myvar
.
write_value
(
result
)
# break current countour detection loop as in this example we care
# for first detected SHAPE, we do not expect more shapes
...
...
@@ -173,9 +174,10 @@ async def main():
if
not
contour_detected
:
# no countours actually detected thus update OPC UA server's node attribute
result
=
0.0
result_stack
.
append
(
result
)
shape_change_counter
+=
1
await
myvar
.
write_value
(
result
)
if
current_shape
!=
result
:
result_stack
.
append
(
result
)
shape_change_counter
+=
1
await
myvar
.
write_value
(
result
)
current_shape
=
result
print
(
"
\
t
No shape detected, result=%d, shape changes=%d"
%
(
result
,
shape_change_counter
))
...
...
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