Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit bb338ab

Browse files
author
Pasch, Frederik
committed
add additional py-trees composites
1 parent 408ae37 commit bb338ab

14 files changed

+4559
-3251
lines changed

scenario_execution/scenario_execution/model/model_to_py_tree.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,13 @@ def visit_do_member(self, node: DoMember):
163163
behavior = py_trees.composites.Parallel(name=name, policy=py_trees.common.ParallelPolicy.SuccessOnAll())
164164
elif composition_operator == "one_of":
165165
behavior = py_trees.composites.Parallel(name=name, policy=py_trees.common.ParallelPolicy.SuccessOnOne())
166+
# support for composites not available in osc2
167+
elif composition_operator == "selector":
168+
behavior = py_trees.composites.Selector(name=name, memory=True)
169+
elif composition_operator == "selector_no_memory":
170+
behavior = py_trees.composites.Selector(name=name, memory=False)
171+
elif composition_operator == "serial_no_memory":
172+
behavior = py_trees.composites.Sequence(name=name, memory=False)
166173
else:
167174
raise NotImplementedError(f"scenario operator {composition_operator} not yet supported.")
168175

scenario_execution/scenario_execution/osc2_parsing/OpenSCENARIO2.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ composition : compositionOperator (OPEN_PAREN argumentList? CLOSE_PAREN)?':' NEW
445445
doMember+ DEDENT (behaviorWithDeclaration)?;
446446

447447
compositionOperator
448-
: 'serial' | 'one_of' | 'parallel';
448+
: 'serial' | 'one_of' | 'parallel' | 'serial_no_memory' | 'selector' | 'selector_no_memory';
449449

450450
behaviorInvocation
451451
: (actorExpression '.')? behaviorName OPEN_PAREN (argumentList)? CLOSE_PAREN (behaviorWithDeclaration | NEWLINE);

scenario_execution/scenario_execution/osc2_parsing/OpenSCENARIO2.interp

Lines changed: 7 additions & 1 deletion
Large diffs are not rendered by default.

scenario_execution/scenario_execution/osc2_parsing/OpenSCENARIO2.tokens

Lines changed: 58 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,26 @@ T__84=85
8686
T__85=86
8787
T__86=87
8888
T__87=88
89-
NEWLINE=89
90-
OPEN_BRACK=90
91-
CLOSE_BRACK=91
92-
OPEN_PAREN=92
93-
CLOSE_PAREN=93
94-
SKIP_=94
95-
BLOCK_COMMENT=95
96-
LINE_COMMENT=96
97-
StringLiteral=97
98-
FloatLiteral=98
99-
UintLiteral=99
100-
HexUintLiteral=100
101-
IntLiteral=101
102-
BoolLiteral=102
103-
Identifier=103
104-
INDENT=104
105-
DEDENT=105
89+
T__88=89
90+
T__89=90
91+
T__90=91
92+
NEWLINE=92
93+
OPEN_BRACK=93
94+
CLOSE_BRACK=94
95+
OPEN_PAREN=95
96+
CLOSE_PAREN=96
97+
SKIP_=97
98+
BLOCK_COMMENT=98
99+
LINE_COMMENT=99
100+
StringLiteral=100
101+
FloatLiteral=101
102+
UintLiteral=102
103+
HexUintLiteral=103
104+
IntLiteral=104
105+
BoolLiteral=105
106+
Identifier=106
107+
INDENT=107
108+
DEDENT=108
106109
'import'=1
107110
'.'=2
108111
'type'=3
@@ -160,38 +163,41 @@ DEDENT=105
160163
'serial'=55
161164
'one_of'=56
162165
'parallel'=57
163-
'wait'=58
164-
'emit'=59
165-
'call'=60
166-
'until'=61
167-
'def'=62
168-
'->'=63
169-
'expression'=64
170-
'undefined'=65
171-
'external'=66
172-
'only'=67
173-
'cover'=68
174-
'record'=69
175-
'range'=70
176-
'?'=71
177-
'=>'=72
178-
'or'=73
179-
'and'=74
180-
'not'=75
181-
'!='=76
182-
'<'=77
183-
'<='=78
184-
'>'=79
185-
'>='=80
186-
'in'=81
187-
'+'=82
188-
'-'=83
189-
'*'=84
190-
'/'=85
191-
'%'=86
192-
'it'=87
193-
'..'=88
194-
'['=90
195-
']'=91
196-
'('=92
197-
')'=93
166+
'serial_no_memory'=58
167+
'selector'=59
168+
'selector_no_memory'=60
169+
'wait'=61
170+
'emit'=62
171+
'call'=63
172+
'until'=64
173+
'def'=65
174+
'->'=66
175+
'expression'=67
176+
'undefined'=68
177+
'external'=69
178+
'only'=70
179+
'cover'=71
180+
'record'=72
181+
'range'=73
182+
'?'=74
183+
'=>'=75
184+
'or'=76
185+
'and'=77
186+
'not'=78
187+
'!='=79
188+
'<'=80
189+
'<='=81
190+
'>'=82
191+
'>='=83
192+
'in'=84
193+
'+'=85
194+
'-'=86
195+
'*'=87
196+
'/'=88
197+
'%'=89
198+
'it'=90
199+
'..'=91
200+
'['=93
201+
']'=94
202+
'('=95
203+
')'=96

scenario_execution/scenario_execution/osc2_parsing/OpenSCENARIO2Lexer.interp

Lines changed: 10 additions & 1 deletion
Large diffs are not rendered by default.

scenario_execution/scenario_execution/osc2_parsing/OpenSCENARIO2Lexer.py

Lines changed: 487 additions & 464 deletions
Large diffs are not rendered by default.

scenario_execution/scenario_execution/osc2_parsing/OpenSCENARIO2Lexer.tokens

Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,24 @@ T__84=85
8686
T__85=86
8787
T__86=87
8888
T__87=88
89-
NEWLINE=89
90-
OPEN_BRACK=90
91-
CLOSE_BRACK=91
92-
OPEN_PAREN=92
93-
CLOSE_PAREN=93
94-
SKIP_=94
95-
BLOCK_COMMENT=95
96-
LINE_COMMENT=96
97-
StringLiteral=97
98-
FloatLiteral=98
99-
UintLiteral=99
100-
HexUintLiteral=100
101-
IntLiteral=101
102-
BoolLiteral=102
103-
Identifier=103
89+
T__88=89
90+
T__89=90
91+
T__90=91
92+
NEWLINE=92
93+
OPEN_BRACK=93
94+
CLOSE_BRACK=94
95+
OPEN_PAREN=95
96+
CLOSE_PAREN=96
97+
SKIP_=97
98+
BLOCK_COMMENT=98
99+
LINE_COMMENT=99
100+
StringLiteral=100
101+
FloatLiteral=101
102+
UintLiteral=102
103+
HexUintLiteral=103
104+
IntLiteral=104
105+
BoolLiteral=105
106+
Identifier=106
104107
'import'=1
105108
'.'=2
106109
'type'=3
@@ -158,38 +161,41 @@ Identifier=103
158161
'serial'=55
159162
'one_of'=56
160163
'parallel'=57
161-
'wait'=58
162-
'emit'=59
163-
'call'=60
164-
'until'=61
165-
'def'=62
166-
'->'=63
167-
'expression'=64
168-
'undefined'=65
169-
'external'=66
170-
'only'=67
171-
'cover'=68
172-
'record'=69
173-
'range'=70
174-
'?'=71
175-
'=>'=72
176-
'or'=73
177-
'and'=74
178-
'not'=75
179-
'!='=76
180-
'<'=77
181-
'<='=78
182-
'>'=79
183-
'>='=80
184-
'in'=81
185-
'+'=82
186-
'-'=83
187-
'*'=84
188-
'/'=85
189-
'%'=86
190-
'it'=87
191-
'..'=88
192-
'['=90
193-
']'=91
194-
'('=92
195-
')'=93
164+
'serial_no_memory'=58
165+
'selector'=59
166+
'selector_no_memory'=60
167+
'wait'=61
168+
'emit'=62
169+
'call'=63
170+
'until'=64
171+
'def'=65
172+
'->'=66
173+
'expression'=67
174+
'undefined'=68
175+
'external'=69
176+
'only'=70
177+
'cover'=71
178+
'record'=72
179+
'range'=73
180+
'?'=74
181+
'=>'=75
182+
'or'=76
183+
'and'=77
184+
'not'=78
185+
'!='=79
186+
'<'=80
187+
'<='=81
188+
'>'=82
189+
'>='=83
190+
'in'=84
191+
'+'=85
192+
'-'=86
193+
'*'=87
194+
'/'=88
195+
'%'=89
196+
'it'=90
197+
'..'=91
198+
'['=93
199+
']'=94
200+
'('=95
201+
')'=96

0 commit comments

Comments
 (0)