Support static topologies
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- c
Research direction
The issue names the rmw_init API, rmw_init_options_t, and callback alternatives but no files or tests. Start by reviewing the existing rmw_init interface and its implementations, then define the topology representation and resource requirements before determining how completion would be validated.
Written by the indexing model from the issue text.
Description
Feature request
- Allow users to define a static topology during rmw_init, such that the system will allocate only as many resources as specified by the user.
Motivation
- Currently, ROS2 does not support the use of a static topology: the user gets to specificy exactly how many publishers, subscribers, topics, etc. a node needs, and thus the system allocates for exactly that many -- no more, no less. While Fast-RTPS and RTI Connext Pro do not require this feature, since they allow for dynamic allocation, I foresee that with the introduction of DDS-XCRE and the use of ROS in embedded devices, we will eventually have the need to statically allocate resources during initialization.
- While it is possible to over-allocate resources, this solution is obviously not ideal (especially if you are working in a low-resource device).
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
rmw_ret_t rmw_pre_init(rmw_init_options_t * context_ptr) //not necessarily void *
{
//pre-init stuff here
return RMW_RET_OK;
}
rmw_ret_t rmw_post_init(rmw_init_options_t * context_ptr) //not necessarily void *
{
// post-init stuff here
return RMW_RET_OK;
}
int main(void)
{
rmw_init_options_t * context_ptr = ...;
rmw_ret_t retval = rmw_pre_init(context_ptr);
// Check for and handle errors
retval = rmw_init();
if (ret == RMW_RET_OK) {
retval = rmw_post_init(context_ptr);
// Check for and handle errors
} else {
// error handling...
}
return 0;
}
- Option 2
rmw_ret_t entry_callback(void * caller_context_ptr)
{
// do pre-init stuff
return RMW_RET_OK;
}
rmw_ret_t exit_callback(void * caller_context_ptr, rmw_ret_t current_rmw_init_status)
{
// do post-init stuff
return RMW_RET_OK;
}
int main(void)
{
struct rmw_init_callbacks_t init_callbacks {
.m_caller_context_ptr = NULL,
.m_callback_at_rmw_init_entry = &entry_callback,
.m_callback_at_rmw_init_exit = &exit_callback
};
rmw_ret_t ret = rmw_init(init_callbacks); // new rmw_init
// error handling...
return 0;
}
rmw_ret_t rmw_init(const rmw_init_callbacks_t * callback_ptr) // new rmw_init
{
rmw_ret_t retval = RMW_RET_ERROR;
retval = callback_ptr->m_callback_at_rmw_init_entry(callback_ptr->m_caller_context_ptr);
// check for and handle errors
retval = old_rmw_init(); //old rmw_init
// check for and handle errors
retval = callback_ptr->m_callback_at_rmw_init_exit(callback_ptr->m_caller_context_ptr, retval);
// check for and handle errors
return retval
}
** Credit to @wjwwood @serge-nikulin for the original examples (which I may have bastardized when I elaborated on them)
Implementation considerations
-
Option 1
- Pros;
- Backwards-compatible (if you haven't needed to do any pre-init or post-init steps, your code won't have to change).
- Cons:
- User code written initially for a dynamic topology will require some changes before it is compatible with the static DDS implementation.
- Pros;
-
Option 2
- Pros:
- When switching from a dynamic to a static topology, the user code will not have to change since the rmw implementation will handle the static allocation of resources. If the users have an idea of what resources are needed, they will be able to specify this in a configuration file, and if they don't, then there can be a default over-allocating configuration that can later be tuned for the specific use-case.
- Cons:
- Not backwards-compatible.
- Pros:
-
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., :
- Number of nodes
- Per node:
- Number of publishers
- Number of subscribers
- Topics
- Per publisher/subscriber:
- Number of Writers/Readers
- Number of samples
- Routes between nodes
- QoS settings?
@dejanpan @dirk-thomas @wjwwood @serge-nikulin FYI
- Dominant language
- C
- Stars
- 121
- Forks
- 89
- Avg merge
- 17h 40m
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ros2/rmw
-
Delete ament_export_include_directories() and ament_export_libraries() callsMay be free again @EkenoSamson claimed this 62 days ago, and no pull request is open. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Use ament_cmake_ros_core::ament_ros_defaults instead of setting CMAKE_C_STANDARD or CMAKE_CXX_STANDARDPossibly taken @EkenoSamson claimed this 62 days ago. Opengood first issue
Difficulty 3/5 1-2 days Newbie friendliness 74/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
-
Service request timeouts missing in RCL → RMW interactionMay be free again @JEnoch claimed this 420 days ago, and no pull request is open. Openenhancement
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
area/docdb kind/failing-test priority/medium status/awaiting-triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
yugabyte/yugabyte-db#39462 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
libreswan/libreswan#3185 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
category:port-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days