Skip to content

Commit c5d9103

Browse files
ayrton04mikaelarguedas
authored andcommitted
Adding information for array parameters (#152)
* Adding information for array parameters * Incorporating PR feedback.
1 parent 596bf8d commit c5d9103

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

articles/055_ros_parameter_design.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,31 @@ Each parameter consists of a key and a value.
109109
The key is a string value.
110110
The value can be one of the following datatypes:
111111

112-
- `float64`
112+
- `bool`
113113
- `int64`
114+
- `float64`
114115
- `string`
115-
- `bool`
116-
- `bytes[]`
116+
- `byte[]`
117+
- `bool[]`
118+
- `int64[]`
119+
- `float64[]`
120+
- `string[]`
117121

118-
The datatypes are chosen as non-complex datatypes, as defined in the [interface definitions article](articles/interface_definition.html)
122+
The datatypes are chosen as non-complex datatypes, as defined in the [interface definitions article](interface_definition.html).
119123
The full complement of datatypes of different bitdepth and unsigned types are avoided to allow interpretation from text based configuration files.
120124

121-
`bytes` are included to allow the storage of binary blobs.
122-
It's use is not recommended but can be very convenient, and explicitly supporting it is better than having people try to abuse other datatypes such as strings.
125+
Array datatypes support a variety of use cases, e.g.,
126+
- `byte[]` is included to allow the storage of binary blobs.
127+
Its use is not recommended but can be very convenient, and explicitly supporting it is better than having people try to abuse other datatypes such as strings.
128+
- `bool[]` can be useful as a mask for other array parameters.
129+
- `int64[]` and `float64[]` can be used to express numerical vector and matrix parameters.
130+
- `string[]` can be used to express groups of names, such as a set of robots in a multi-robot context.
131+
132+
While the use of array parameters increases the complexity of the API, their omission would necessitate complex naming schemes for parameters like matrices, which are common in robotics.
133+
134+
Only homogenous arrays of datatypes will be supported. This is to avoid the unnecessary complexity of the introspection needed to handle multidimensionality and heterogeneity within the arrays.
135+
136+
Arrays should not be abused, however; users should rely on namespacing and explicit variable names wherever possible.
123137

124138
### Required functionality
125139

@@ -210,13 +224,6 @@ A few to highlight:
210224
There are several ways to load parameters at startup including command line arguments, roslaunch arguments, and potentially parameter files.
211225
This is something which should be addressed in conjunction with the new launch system.
212226

213-
### Support for arrays of primitives
214-
215-
During the API discussions supporting arrays of primitives was discussed and deferred.
216-
Adding support for arrays in the interface is relatively straight forward.
217-
It slightly increases the complexity of the API for users, but can support several use cases.
218-
A use case for arrays of numbers is expressing a matrix or vector, addressing each position in a matrix by some sort of row-column naming scheme can get very cumbersome.
219-
220227
### Predeclared interface to support static checking/validation
221228

222229
The ability to declare an API which can help with static checks and prevent logical errors which arise from setting the wrong parameter based on a typo.

0 commit comments

Comments
 (0)