Skip to content

Commit 4b9f44a

Browse files
committed
Fix Array parameters
1 parent 6a92417 commit 4b9f44a

File tree

79 files changed

+6309
-6433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+6309
-6433
lines changed

docu/ParametersAPI.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
## Parameters API
2+
3+
The types of parameters supported by the ROS tooling are the following:
4+
5+
* Boolean (true or false)
6+
* Integer
7+
* Double
8+
* String
9+
* Base64
10+
* List
11+
* Array
12+
* Struct
13+
14+
and their description is allowed at ROS and ROSSystem model level.
15+
16+
For the complete definition of parameters the user has to open the ROS model editor, where the language format is the following:
17+
```
18+
**parameters:**
19+
ParameterName:
20+
**type:** ParameterType
21+
**value:** ParameterValue
22+
```
23+
24+
For example (for a .ros2 file):
25+
26+
```
27+
test_parameters:
28+
artifacts:
29+
test_parameters:
30+
node: params_example
31+
parameters:
32+
string_test:
33+
type: String
34+
bool_test:
35+
type: Boolean
36+
array_test:
37+
type: Array [String]
38+
base64_test:
39+
type: Base64
40+
double_test:
41+
type: Double
42+
integer_test:
43+
type: Integer
44+
list_test:
45+
type: List [Integer,Integer,String]
46+
array_test:
47+
type: Array [String]
48+
struct_test:
49+
type: Struct [hello Integer, what String]
50+
```
51+
52+
These parameters can be re-set at Rossystem level (that means for ROS developers, the case of the set of a new parameter value within a node include on a ROS launch file). For the tooling the format is the following:
53+
54+
```
55+
- ParameterName : ParameterReferenceInRos2File
56+
**value:** ParameterValue
57+
```
58+
59+
Continuing the previous example, the parameters redefinition looks:
60+
61+
```
62+
test:
63+
nodes:
64+
params_node:
65+
from: "test_parameters.params_example"
66+
parameters:
67+
- test_s : "test_parameters::string_test"
68+
value: "hello"
69+
- test_b : "test_parameters::bool_test"
70+
value: true
71+
- test_d : "test_parameters::double_test"
72+
value: 1.1
73+
- test_i : "test_parameters::integer_test"
74+
value: 1
75+
- test_l: "test_parameters::list_test"
76+
value: [1,1,"hello"]
77+
- test_a: "test_parameters::array_test"
78+
value: ["hello", "hola", "hallo"]
79+
- test_st: "test_parameters::struct_test"
80+
value: [
81+
hello: 1
82+
what: "test"]
83+
```
84+
The model definition of parameters is also consider for the autogeneration of launch files and the component interfaces. Complementarily, and because of the complexity of the format, the .ros, the .componentinterface and the .rossystem language validators contain rules to check that the value given to the parameter has the correct type and also help messages that together with the auto-complete function (Ctrl+Space) facilitate to the user the creation of parameters.
85+

docu/RosModelDescription.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,17 @@ The only remarkable difference with the ROS 1 model is that the quality of servi
140140
- profile: default_qos / sensor_qos / services_qos/ parameter_qos
141141
- reliability: best_effort / reliable
142142

143+
The type of supported parameters are:
144+
- Boolean
145+
- Double
146+
- String
147+
- Integer
148+
- Base64
149+
- List [Type, Type]
150+
- Array [Type]
151+
- Struct [Name Type, Name Type]
152+
153+
For more details please check the following [examples](ParametersAPI.md).
143154

144155
See the following example for the [arucos_ros](https://github.com/pal-robotics/aruco_ros) driver:
145156

@@ -188,4 +199,4 @@ The textual editor contains checker embedded, for example:
188199

189200
It incorporates also the auto-complete function. This is available by pressing **Ctrl** + the space bar:
190201

191-
![alt text](images/RosModelAutocomplete.gif)
202+
![alt text](images/RosModelAutocomplete.gif)

plugins/de.fraunhofer.ipa.ros.xtext.ide/src-gen/de/fraunhofer/ipa/ros/ide/contentassist/antlr/BasicsParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private static void init(ImmutableMap.Builder<AbstractElement, String> builder,
7373
builder.put(grammarAccess.getParameterAnyTypeAccess().getGroup(), "rule__ParameterAnyType__Group__0");
7474
builder.put(grammarAccess.getParameterAnyTypeAccess().getGroup_2(), "rule__ParameterAnyType__Group_2__0");
7575
builder.put(grammarAccess.getParameterArrayTypeAccess().getGroup(), "rule__ParameterArrayType__Group__0");
76-
builder.put(grammarAccess.getParameterArrayTypeAccess().getGroup_3(), "rule__ParameterArrayType__Group_3__0");
76+
builder.put(grammarAccess.getParameterArrayTypeAccess().getGroup_4(), "rule__ParameterArrayType__Group_4__0");
7777
builder.put(grammarAccess.getParameterListAccess().getGroup(), "rule__ParameterList__Group__0");
7878
builder.put(grammarAccess.getParameterListAccess().getGroup_3(), "rule__ParameterList__Group_3__0");
7979
builder.put(grammarAccess.getParameterAnyAccess().getGroup(), "rule__ParameterAny__Group__0");
@@ -137,7 +137,7 @@ private static void init(ImmutableMap.Builder<AbstractElement, String> builder,
137137
builder.put(grammarAccess.getParameterBase64TypeAccess().getDefaultAssignment_2_1(), "rule__ParameterBase64Type__DefaultAssignment_2_1");
138138
builder.put(grammarAccess.getParameterAnyTypeAccess().getDefaultAssignment_2_1(), "rule__ParameterAnyType__DefaultAssignment_2_1");
139139
builder.put(grammarAccess.getParameterArrayTypeAccess().getTypeAssignment_2(), "rule__ParameterArrayType__TypeAssignment_2");
140-
builder.put(grammarAccess.getParameterArrayTypeAccess().getDefaultAssignment_3_1(), "rule__ParameterArrayType__DefaultAssignment_3_1");
140+
builder.put(grammarAccess.getParameterArrayTypeAccess().getDefaultAssignment_4_1(), "rule__ParameterArrayType__DefaultAssignment_4_1");
141141
builder.put(grammarAccess.getParameterListAccess().getValueAssignment_2(), "rule__ParameterList__ValueAssignment_2");
142142
builder.put(grammarAccess.getParameterListAccess().getValueAssignment_3_1(), "rule__ParameterList__ValueAssignment_3_1");
143143
builder.put(grammarAccess.getParameterAnyAccess().getValueAssignment_2_1(), "rule__ParameterAny__ValueAssignment_2_1");

plugins/de.fraunhofer.ipa.ros.xtext.ide/src-gen/de/fraunhofer/ipa/ros/ide/contentassist/antlr/RosParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private static void init(ImmutableMap.Builder<AbstractElement, String> builder,
117117
builder.put(grammarAccess.getParameterAnyTypeAccess().getGroup(), "rule__ParameterAnyType__Group__0");
118118
builder.put(grammarAccess.getParameterAnyTypeAccess().getGroup_2(), "rule__ParameterAnyType__Group_2__0");
119119
builder.put(grammarAccess.getParameterArrayTypeAccess().getGroup(), "rule__ParameterArrayType__Group__0");
120-
builder.put(grammarAccess.getParameterArrayTypeAccess().getGroup_3(), "rule__ParameterArrayType__Group_3__0");
120+
builder.put(grammarAccess.getParameterArrayTypeAccess().getGroup_4(), "rule__ParameterArrayType__Group_4__0");
121121
builder.put(grammarAccess.getParameterListAccess().getGroup(), "rule__ParameterList__Group__0");
122122
builder.put(grammarAccess.getParameterListAccess().getGroup_3(), "rule__ParameterList__Group_3__0");
123123
builder.put(grammarAccess.getParameterAnyAccess().getGroup(), "rule__ParameterAny__Group__0");
@@ -229,7 +229,7 @@ private static void init(ImmutableMap.Builder<AbstractElement, String> builder,
229229
builder.put(grammarAccess.getParameterBase64TypeAccess().getDefaultAssignment_2_1(), "rule__ParameterBase64Type__DefaultAssignment_2_1");
230230
builder.put(grammarAccess.getParameterAnyTypeAccess().getDefaultAssignment_2_1(), "rule__ParameterAnyType__DefaultAssignment_2_1");
231231
builder.put(grammarAccess.getParameterArrayTypeAccess().getTypeAssignment_2(), "rule__ParameterArrayType__TypeAssignment_2");
232-
builder.put(grammarAccess.getParameterArrayTypeAccess().getDefaultAssignment_3_1(), "rule__ParameterArrayType__DefaultAssignment_3_1");
232+
builder.put(grammarAccess.getParameterArrayTypeAccess().getDefaultAssignment_4_1(), "rule__ParameterArrayType__DefaultAssignment_4_1");
233233
builder.put(grammarAccess.getParameterListAccess().getValueAssignment_2(), "rule__ParameterList__ValueAssignment_2");
234234
builder.put(grammarAccess.getParameterListAccess().getValueAssignment_3_1(), "rule__ParameterList__ValueAssignment_3_1");
235235
builder.put(grammarAccess.getParameterAnyAccess().getValueAssignment_2_1(), "rule__ParameterAny__ValueAssignment_2_1");

plugins/de.fraunhofer.ipa.ros.xtext.ide/src-gen/de/fraunhofer/ipa/ros/ide/contentassist/antlr/internal/InternalBasicsParser.g

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ import de.fraunhofer.ipa.ros.services.BasicsGrammarAccess;
4949
tokenNameToValue.put("Node", "'node'");
5050
tokenNameToValue.put("Time", "'time'");
5151
tokenNameToValue.put("Type", "'type'");
52+
tokenNameToValue.put("Array", "'Array'");
5253
tokenNameToValue.put("Int16", "'int16'");
5354
tokenNameToValue.put("Int32", "'int32'");
5455
tokenNameToValue.put("Int64", "'int64'");
5556
tokenNameToValue.put("Type_1", "'type:'");
5657
tokenNameToValue.put("Uint8", "'uint8'");
5758
tokenNameToValue.put("Value", "'value'");
58-
tokenNameToValue.put("Array", "'Array:'");
5959
tokenNameToValue.put("Base64", "'Base64'");
6060
tokenNameToValue.put("Double", "'Double'");
6161
tokenNameToValue.put("Header", "'Header'");
@@ -4083,9 +4083,9 @@ rule__ParameterArrayType__Group__0__Impl
40834083
}
40844084
:
40854085
(
4086-
{ before(grammarAccess.getParameterArrayTypeAccess().getBEGINTerminalRuleCall_0()); }
4087-
RULE_BEGIN
4088-
{ after(grammarAccess.getParameterArrayTypeAccess().getBEGINTerminalRuleCall_0()); }
4086+
{ before(grammarAccess.getParameterArrayTypeAccess().getArrayKeyword_0()); }
4087+
Array
4088+
{ after(grammarAccess.getParameterArrayTypeAccess().getArrayKeyword_0()); }
40894089
)
40904090
;
40914091
finally {
@@ -4110,9 +4110,9 @@ rule__ParameterArrayType__Group__1__Impl
41104110
}
41114111
:
41124112
(
4113-
{ before(grammarAccess.getParameterArrayTypeAccess().getArrayKeyword_1()); }
4114-
Array
4115-
{ after(grammarAccess.getParameterArrayTypeAccess().getArrayKeyword_1()); }
4113+
{ before(grammarAccess.getParameterArrayTypeAccess().getLeftSquareBracketKeyword_1()); }
4114+
LeftSquareBracket
4115+
{ after(grammarAccess.getParameterArrayTypeAccess().getLeftSquareBracketKeyword_1()); }
41164116
)
41174117
;
41184118
finally {
@@ -4164,9 +4164,9 @@ rule__ParameterArrayType__Group__3__Impl
41644164
}
41654165
:
41664166
(
4167-
{ before(grammarAccess.getParameterArrayTypeAccess().getGroup_3()); }
4168-
(rule__ParameterArrayType__Group_3__0)?
4169-
{ after(grammarAccess.getParameterArrayTypeAccess().getGroup_3()); }
4167+
{ before(grammarAccess.getParameterArrayTypeAccess().getRightSquareBracketKeyword_3()); }
4168+
RightSquareBracket
4169+
{ after(grammarAccess.getParameterArrayTypeAccess().getRightSquareBracketKeyword_3()); }
41704170
)
41714171
;
41724172
finally {
@@ -4190,63 +4190,63 @@ rule__ParameterArrayType__Group__4__Impl
41904190
}
41914191
:
41924192
(
4193-
{ before(grammarAccess.getParameterArrayTypeAccess().getENDTerminalRuleCall_4()); }
4194-
RULE_END
4195-
{ after(grammarAccess.getParameterArrayTypeAccess().getENDTerminalRuleCall_4()); }
4193+
{ before(grammarAccess.getParameterArrayTypeAccess().getGroup_4()); }
4194+
(rule__ParameterArrayType__Group_4__0)?
4195+
{ after(grammarAccess.getParameterArrayTypeAccess().getGroup_4()); }
41964196
)
41974197
;
41984198
finally {
41994199
restoreStackSize(stackSize);
42004200
}
42014201

42024202

4203-
rule__ParameterArrayType__Group_3__0
4203+
rule__ParameterArrayType__Group_4__0
42044204
@init {
42054205
int stackSize = keepStackSize();
42064206
}
42074207
:
4208-
rule__ParameterArrayType__Group_3__0__Impl
4209-
rule__ParameterArrayType__Group_3__1
4208+
rule__ParameterArrayType__Group_4__0__Impl
4209+
rule__ParameterArrayType__Group_4__1
42104210
;
42114211
finally {
42124212
restoreStackSize(stackSize);
42134213
}
42144214

4215-
rule__ParameterArrayType__Group_3__0__Impl
4215+
rule__ParameterArrayType__Group_4__0__Impl
42164216
@init {
42174217
int stackSize = keepStackSize();
42184218
}
42194219
:
42204220
(
4221-
{ before(grammarAccess.getParameterArrayTypeAccess().getDefaultKeyword_3_0()); }
4221+
{ before(grammarAccess.getParameterArrayTypeAccess().getDefaultKeyword_4_0()); }
42224222
Default
4223-
{ after(grammarAccess.getParameterArrayTypeAccess().getDefaultKeyword_3_0()); }
4223+
{ after(grammarAccess.getParameterArrayTypeAccess().getDefaultKeyword_4_0()); }
42244224
)
42254225
;
42264226
finally {
42274227
restoreStackSize(stackSize);
42284228
}
42294229

4230-
rule__ParameterArrayType__Group_3__1
4230+
rule__ParameterArrayType__Group_4__1
42314231
@init {
42324232
int stackSize = keepStackSize();
42334233
}
42344234
:
4235-
rule__ParameterArrayType__Group_3__1__Impl
4235+
rule__ParameterArrayType__Group_4__1__Impl
42364236
;
42374237
finally {
42384238
restoreStackSize(stackSize);
42394239
}
42404240

4241-
rule__ParameterArrayType__Group_3__1__Impl
4241+
rule__ParameterArrayType__Group_4__1__Impl
42424242
@init {
42434243
int stackSize = keepStackSize();
42444244
}
42454245
:
42464246
(
4247-
{ before(grammarAccess.getParameterArrayTypeAccess().getDefaultAssignment_3_1()); }
4248-
(rule__ParameterArrayType__DefaultAssignment_3_1)
4249-
{ after(grammarAccess.getParameterArrayTypeAccess().getDefaultAssignment_3_1()); }
4247+
{ before(grammarAccess.getParameterArrayTypeAccess().getDefaultAssignment_4_1()); }
4248+
(rule__ParameterArrayType__DefaultAssignment_4_1)
4249+
{ after(grammarAccess.getParameterArrayTypeAccess().getDefaultAssignment_4_1()); }
42504250
)
42514251
;
42524252
finally {
@@ -6870,15 +6870,15 @@ finally {
68706870
restoreStackSize(stackSize);
68716871
}
68726872

6873-
rule__ParameterArrayType__DefaultAssignment_3_1
6873+
rule__ParameterArrayType__DefaultAssignment_4_1
68746874
@init {
68756875
int stackSize = keepStackSize();
68766876
}
68776877
:
68786878
(
6879-
{ before(grammarAccess.getParameterArrayTypeAccess().getDefaultParameterListParserRuleCall_3_1_0()); }
6879+
{ before(grammarAccess.getParameterArrayTypeAccess().getDefaultParameterListParserRuleCall_4_1_0()); }
68806880
ruleParameterList
6881-
{ after(grammarAccess.getParameterArrayTypeAccess().getDefaultParameterListParserRuleCall_3_1_0()); }
6881+
{ after(grammarAccess.getParameterArrayTypeAccess().getDefaultParameterListParserRuleCall_4_1_0()); }
68826882
)
68836883
;
68846884
finally {

0 commit comments

Comments
 (0)