Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pluto
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anton Tetov Johansson
pluto
Commits
78b4d76e
Commit
78b4d76e
authored
5 years ago
by
Anders Blomdell
Browse files
Options
Downloads
Patches
Plain Diff
Improved AUTO handling. Made safe-cell logic auto generated
parent
b8f8b8e8
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
robotlab_safety/pluto_auto.py
+16
-13
16 additions, 13 deletions
robotlab_safety/pluto_auto.py
robotlab_safety/safety_2020.sps
+0
-0
0 additions, 0 deletions
robotlab_safety/safety_2020.sps
with
16 additions
and
13 deletions
robotlab_safety/pluto_auto.py
+
16
−
13
View file @
78b4d76e
...
@@ -17,23 +17,26 @@ class PlutoVariables:
...
@@ -17,23 +17,26 @@ class PlutoVariables:
pass
pass
def
codegen
(
self
,
expr
):
def
codegen
(
self
,
expr
):
m
=
re
.
match
(
'
([^=]+)=AND\{(.*),(.*)\}
'
,
expr
)
m
=
re
.
match
(
'
([^=]+)=
(
AND
|OR)
\{(.*),(.*)\}
'
,
expr
)
if
m
:
if
m
:
lh
=
m
.
group
(
1
)
lh
=
m
.
group
(
1
)
regexp
=
m
.
group
(
2
).
replace
(
'
*
'
,
'
.*
'
)
op
=
m
.
group
(
2
)
rh
=
[
m
.
group
(
3
).
format
(
v
,
pluto
=
self
.
by_name
[
v
][
0
])
regexp
=
m
.
group
(
3
).
replace
(
'
*
'
,
'
.*
'
)
for
v
in
self
.
by_name
if
re
.
match
(
regexp
,
v
)]
expr
=
m
.
group
(
4
)
rh
=
[]
for
k
,
v
in
sorted
(
self
.
by_name
.
items
()):
rh_m
=
re
.
match
(
regexp
,
k
)
if
rh_m
:
matches
=
(
k
,)
+
rh_m
.
groups
()
rh
.
append
(
expr
.
format
(
*
matches
,
pluto
=
v
[
0
]))
pass
pass
if
op
==
'
AND
'
:
return
(
"
%s=%s
"
%
(
lh
,
'
*
'
.
join
(
rh
)))
return
(
"
%s=%s
"
%
(
lh
,
'
*
'
.
join
(
rh
)))
m
=
re
.
match
(
'
([^=]+)=OR\{(.*),(.*)\}
'
,
expr
)
elif
op
==
'
OR
'
:
if
m
:
lh
=
m
.
group
(
1
)
regexp
=
m
.
group
(
2
).
replace
(
'
*
'
,
'
.*
'
)
rh
=
[
m
.
group
(
3
).
format
(
v
,
pluto
=
self
.
by_name
[
v
][
0
])
for
v
in
self
.
by_name
if
re
.
match
(
regexp
,
v
)]
return
(
"
%s=%s
"
%
(
lh
,
'
+
'
.
join
(
rh
)))
return
(
"
%s=%s
"
%
(
lh
,
'
+
'
.
join
(
rh
)))
raise
Exception
(
'
Invalid expression
'
,
expr
)
raise
Exception
(
'
Invalid expression
'
,
expr
)
class
SPS
:
class
SPS
:
def
__init__
(
self
,
path
):
def
__init__
(
self
,
path
):
...
...
This diff is collapsed.
Click to expand it.
robotlab_safety/safety_2020.sps
+480 B (+1%)
View file @
78b4d76e
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
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