You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with opt_as_array, an optional string is declared as : string[] mystring
However the behavior of rostools (`rosservice call is an often use example) create such data :
mystring:
- ''
similar thing with [u]int[8|16|32|64] : uint8[] myint
produces :
myint:
- 0
opt_as_array policy is to consider empty array as not passed.
But we need to address this default argument issue to make it easier when using command line ros tools.
However it is unlikely that ROS1 will change anything, since all fields are mandatory, and it follows C semantics (doesnt have referense semantics or None element) it makes sense in that context to pregenerate the data structure with default values.
Some options :
expect user to handle this in code, when needed. simple. just what we do now, but not user friendly.
Our current patching strategy anyway requires code on user side for optional fields... but maybe it s best not to make it too complicated.
field decorator ? We need to find a way to add "comments" in a message type definition, in a way that can be somehow retrieved by an extra tool to handle optional fields, or maybe more logic ( ie. break if == 42 )
new type of field ? This probably menas patching genpy and a bunch of things. not likely.
opt_as_nested might be extendable for this usecase... this might be worth reinvestigating after opt_as_nested is implemented and working as expected for optional fields.
The text was updated successfully, but these errors were encountered:
with opt_as_array, an optional string is declared as :
string[] mystring
However the behavior of rostools (`rosservice call is an often use example) create such data :
similar thing with
[u]int[8|16|32|64]
:uint8[] myint
produces :
opt_as_array policy is to consider empty array as not passed.
But we need to address this default argument issue to make it easier when using command line ros tools.
However it is unlikely that ROS1 will change anything, since all fields are mandatory, and it follows C semantics (doesnt have referense semantics or None element) it makes sense in that context to pregenerate the data structure with default values.
Some options :
Our current patching strategy anyway requires code on user side for optional fields... but maybe it s best not to make it too complicated.
The text was updated successfully, but these errors were encountered: