Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SOIL2OPC UA Translator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WZL-IQS-Public
Sensor Interfacing Language (SOIL)
SOIL2OPC UA Translator
Commits
7199f5d0
Commit
7199f5d0
authored
2 years ago
by
Susanna Weber
Browse files
Options
Downloads
Patches
Plain Diff
Method goTo in zwei unterschiedlichen Versionen
parent
8f63ce02
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
robot.py
+35
-6
35 additions, 6 deletions
robot.py
with
35 additions
and
6 deletions
robot.py
+
35
−
6
View file @
7199f5d0
...
...
@@ -63,7 +63,7 @@ async def main():
tcpobject
=
Measurement
(
"
Tool Center Point
"
,
"
Tool center point of a six-arm robot.
"
,
float
,
3
,
(
-
0.5
,
0.5
),
"
metre
"
)
positionobject
=
Measurement
(
"
Position
"
,
"
Position in Cartesian coordinates given in metre.
"
,
float
,
3
,
(
-
50
,
50
)
,
"
metre
"
)
batteryobject
=
Measurement
(
"
Battery level
"
,
"
Battery level
"
,
int
,
0
,(
0
,
100
),
"
percent
"
)
measureobjectlist
=
[
tcpobject
,
positionobject
,
batteryobject
]
measureobjectlist
=
[
tcpobject
,
batteryobject
]
#positionobject,
#parameterobjekte
openobject
=
Parameter
(
"
Open
"
,
"
Flag to specify if something is open.
"
,
bool
,
0
,
default
=
True
)
...
...
@@ -80,16 +80,26 @@ async def main():
#variable mit entsprechenden properties
#measurements evtl varianttype vom variabletype und datatype measurement
for
a
in
measureobjectlist
:
var
=
await
myobj
.
add_variable
(
idx
,
a
.
name
,
a
.
value
,
datatype
=
vartype
.
nodeid
)
name
=
a
.
name
+
"
var
"
name
=
await
myobj
.
add_variable
(
idx
,
a
.
name
,
a
.
value
,
datatype
=
vartype
.
nodeid
)
#namelist = namelist + name
if
a
.
range
is
not
None
:
rangeprop
=
await
var
.
add_property
(
idx
,
"
range
"
,
ua
.
Range
(
a
.
range
[
0
],
a
.
range
[
1
]))
rangeprop
=
await
name
.
add_property
(
idx
,
"
range
"
,
ua
.
Range
(
a
.
range
[
0
],
a
.
range
[
1
]))
if
a
.
unit
is
not
None
:
unitporp
=
await
var
.
add_property
(
idx
,
"
unit
"
,
a
.
unit
)
description
=
await
var
.
add_property
(
idx
,
"
Description
"
,
a
.
description
)
unitporp
=
await
name
.
add_property
(
idx
,
"
unit
"
,
a
.
unit
)
description
=
await
name
.
add_property
(
idx
,
"
Description
"
,
a
.
description
)
positionvar
=
await
myobj
.
add_variable
(
idx
,
positionobject
.
name
,
positionobject
.
value
,
datatype
=
vartype
.
nodeid
)
if
a
.
range
is
not
None
:
posrangeprop
=
await
positionvar
.
add_property
(
idx
,
"
range
"
,
ua
.
Range
(
positionobject
.
range
[
0
],
positionobject
.
range
[
1
]))
if
a
.
unit
is
not
None
:
unitprop
=
await
positionvar
.
add_property
(
idx
,
"
unit
"
,
positionobject
.
unit
)
posdescription
=
await
positionvar
.
add_property
(
idx
,
"
Description
"
,
positionobject
.
description
)
#parameters
for
a
in
paraobjectlist
:
para
=
await
myobj
.
add_variable
(
idx
,
a
.
name
,
a
.
value
,
datatype
=
paratype
.
nodeid
)
if
a
.
range
is
not
None
:
...
...
@@ -106,9 +116,28 @@ async def main():
openvar
=
await
gripper
.
add_variable
(
idx
,
"
Open
"
,
True
,
datatype
=
paratype
.
nodeid
)
await
openvar
.
add_property
(
idx
,
"
Description
"
,
"
Flag to specify if something is open.
"
)
#functions
#Warten auf umsetzen
@uamethod
def
goTo
(
parent
,
position
):
while
positionvar
.
get_value
()
!=
position
:
print
(
"
Waiting for position
"
)
goTofunc
=
await
myobj
.
add_method
(
idx
,
"
goTo
"
,
goTo
,
[
vartype
])
#einfach umsetzen
@uamethod
def
goTosetvalue
(
parent
,
position
):
positionvar
.
set_value
(
position
)
goTosetvaluefunc
=
await
myobj
.
add_method
(
idx
,
"
goToset
"
,
goTosetvalue
,
[
vartype
])
#server
async
with
server
:
print
(
"
Server läuft!
"
)
#print(bla)
while
True
:
await
asyncio
.
sleep
(
1
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment