-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support static topologies #126
Comments
Before diving into the various ways these arguments could be passed through the API I want to take a step back and ask the question if this is really a programming time decision. I can imagine scenarios where I program a few nodes but don't need to limit the resources on my development machine. Only when deploying a set of nodes on a target machine (which has to deal with constraint resources) I would like to define the upper boundaries. This kind of use case sounds to me that it should be possible to provide such configuration from the "outside" (instead of within the code calling |
|
With "outside" I was aiming for outside-of-code, e.g. a configuration file. Connext allows to specify those limits in an xml file afaik. |
File systems and files very often do not exist on production controllers.
RTI does not recommend using this mechanism for production. It's for R&D only. |
Firstly, I support this feature request in general.
I surmise that "configuration file" was short-hand for "configuration as data" (as opposed to code, which seems to have been the initial suggestion). I agree with @dirk-thomas that this seems to be something which could be handled with configuration data supplied "from the outside". In my opinion, this has many advantages,
However, I'm not sure whether it is sufficient and/or advisable to use the underlying DDS implementation's mechanisms. For one thing, ROS2 might require internal buffers, or other things which also need to be statically allocated. I would prefer that ROS2 defines the configuration format itself. |
These are my take aways for this discussion so far:
As to whether or not it is a programming time decision depends on how it is implemented imo. If you want to do static initialization on the stack or data section (what @iluetkeb described as compile/link time), then you need to change the code (unless maybe you do some fancy linking stuff). However, if it is fine to have a period of time in the runtime of the program where memory allocation is acceptable (what @iluetkeb described as "pre-allocation on process start-up"), then it could be done after programming/compile time. As I said in one of my bullets above, it needs to be doable programmatically and it needs to be expressed in terms of ROS 2 entities, so whether or not we take in settings from the filesystem or argv or eeprom doesn't really matter to me. As I see it there are a few questions (mostly decoupled from one another) that we need to answer before making/judging concrete proposals:
Then there are many technical questions like:
If we can begin to answer some of the questions, then an implementation will be easier to propose/review in my opinion. |
I’d be much more comfortable to answer your questions after trying to do the actual code hardening.
Process startup is OK.
Our choices:
I don't have a hard preference between the two: a non-static provider should not appear in a safety-critical app and hence any choice is good. We could have a QoS policy to select either behavior or a bit flag in
|
I think this is decided by the sort of microprocessor you want to include in your target systems. There are still many micros in use that don't have an OS. Do they support memory allocation in any way (e.g. OS-like, or a hack by the micro's compiler to mimic allocation)? If there is no way to "allocate" memory except when the code is compiled, then you must go with the latter option to support those platforms.
Having both options available would be the most flexible. If I am targeting a micro that requires it be done at compile time, then obviously that's the route I take, but if my micro can do allocation at run-time then I may prefer the option pre-allocation at startup combined with a chunk of configuration data, because that may be more flexible.
Yes, I think I agree that if it's compile time, it would need to be in the code. Otherwise some kind of custom pre-processor would be needed and that significantly raises maintenance costs for the rmw implementer.
For compile-time, the obviously the compilation fails. For run-time, I think it would be better to abort than to keep on going and potentially give the developer the wrong idea about what was pre-allocated.
I am generally in favour of using a context object because I think it is a cleaner architectural solution that avoids nasty problems that globals can introduce. But I accept the argument that a global declared and accessible internally leads to an easier public API and reduces the chance of errors made by the developer.
If the number of nodes and their names are known at compile time, then it should be possible to pre-allocate exactly what is needed, even if that information comes from a separate configuration data chunk. But that would lead to information duplication which is not so nice.
I think we should. |
From our side, for fairly classical mobile robotics use cases, we're currently looking at ARM M3/M4 class micro-controllers (in other words, fairly powerful ones), and the RTOS's we're considering in the first step do support memory allocation. I wouldn't rule out smaller devices forever, but I don't see a pull on that, yet. Also, given their other constraints, I would expect that a first step in that direction would start from an independent implementation which can talk DDS-XRCE. This means I don't think we need to consider those requirements for the ROS2 rcl. btw... I don't think we need to hold up the ROS2 release for all this stuff. Not sure what you guys think, but I think the options being discusses currently can all be introduced in a backwards compatible way. |
Feature request
Motivation
Feature description
We see two ways to implement this: 1) creating rmw_pre_init() and rmw_post_init() functions or 2) Passing a parameter to rmw_init that would be used to specify the topology.
e.g,:
Option 1
** Credit to @wjwwood @serge-nikulin for the original examples (which I may have bastardized when I elaborated on them)
Implementation considerations
Option 1
Option 2
At a high-level for the static topology, you would need to specify a graph of how your nodes are connected and what kind of resources they need to communicate (on an edge-by-edge basis). e.g., :
@dejanpan @dirk-thomas @wjwwood @serge-nikulin FYI
The text was updated successfully, but these errors were encountered: