Open gavanderhoorn opened 2 years ago
One question I'd have fi would be: for messages containing other (nested) messages, like a.b.c.d
, where b
and c
are both sequences, but a
and d
are not, would the rules simply be:
micro_ros_utilities_memory_rule_t rules[] = {
{"a.b", 4},
{"a.b.c", 5},
}
to allocate for 4 instances of whatever type b
is, and 5
instances for c
?
And how would (max) string
lengths be specified for a string[]
in a message, such as:
string[] my_strs
Both my_strs
should get a max length, but the individual string
s as well.
No, we do not have any more documentation on that, it would great to improve this part.
Regarding your second question, I should check in the codebase because I did it a long time ago, but as far as I remember sequences are not handled. So
micro_ros_utilities_memory_rule_t rules[] = {
{"a.b", 4},
{"a.b.c", 5},
}
This means that each a
member will have a sequence of 4 b
s and each b
will have a sequence of 5 c
s, if I'm not wrong.
Also, we should take a look at the sequences of string configuration.
I will keep this open so we can do it after the micro-ROS Humble release (it is being time consuming). In any case, this feature is a naive implementation, so feel free to take a look and contribute if you have more specific ideas.
as far as I remember sequences are not handled
I'm confused.
Isn't one of the main advantages of the rule-system the fact it makes setting up a msg structure with sequences much more convenient?
Or are only string
s currently really supported?
So
micro_ros_utilities_memory_rule_t rules[] = { {"a.b", 4}, {"a.b.c", 5}, }
This means that each
a
member will have a sequence of 4b
s and eachb
will have a sequence of 5c
s, if I'm not wrong.
yes, that's what I wrote, isn't it (just making sure)?
I'm confused.
Sequence members individually. I mean you cannot specify that b[0]
as c
of size 5 and b[1]
as c
of size 3.
yes, that's what I wrote, isn't it (just making sure)?
That's right
Sequence members individually. I mean you cannot specify that
b[0]
asc
of size 5 andb[1]
asc
of size 3.
Yes, ok. Clear.
It's always going to spec the same sizes for all members of a field, if that field is a sequence.
yes, that's what I wrote, isn't it (just making sure)?
That's right
So contrary to how you'd access the data itself (by field_name->data[i]
), you never actually add .data
to the names in the rule(s). Correct?
So contrary to how you'd access the data itself (by field_name->data[i]), you never actually add .data to the names in the rule(s). Correct?
That's it
Especially with more complex messages, the convenience of being able to use a set of
micro_ros_utilities_memory_rule_t
in amicro_ros_utilities_memory_conf_t
and pass that tomicro_ros_utilities_create_message_memory(..)
is very nice.I've not been able to locate any documentation for this feature though, other than Handling messages memory in micro-ROS - micro-ROS Galactic and beyond. That section shows a very terse example of specifying a set of rules for the example message, but doesn't go into very much detail.
Would you have any additional documentation available for this feature, specifically the structure of the rules and how they should match fields?