Skip to content

Conversation

@mini-1235
Copy link
Collaborator


Basic Info

Info Please fill out this column
Ticket(s) this addresses #4691
Primary OS tested on (Ubuntu, MacOS, Windows)
Robotic platform tested on (Steve's Robot, gazebo simulation of Tally, hardware turtlebot)
Does this PR contain AI generated software? (No; Yes and it is marked inline in the code)
Was this PR description generated by AI software? Out of respect for maintainers, AI for human-to-human communications are banned

Description of contribution in a few bullet points

Description of documentation updates required from your changes

Description of how this change was tested


Future work that may be required in bullet points

For Maintainers:

  • Check that any new parameters added are updated in docs.nav2.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists
  • Should this be backported to current distributions? If so, tag with backport-*.
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
@mini-1235 mini-1235 marked this pull request as draft December 23, 2025 01:44
@mini-1235
Copy link
Collaborator Author

Opening this as draft so we can discuss how to parameterize IPC in the following places:

  1. auto new_arguments = node->get_node_options().arguments();
    nav2::replaceOrAddArgument(
    new_arguments, "-r", "__node", std::string("__node:=") +
    std::string(node->get_name()) + "_" + client_node_name + "_rclcpp_node");
    auto options = node->get_node_options();
    options = options.use_intra_process_comms(true).arguments(new_arguments);
  2. rclcpp::NodeOptions getChildNodeOptions(
    const std::string & name,
    const std::string & parent_namespace,
    const bool & use_sim_time,
    const rclcpp::NodeOptions & parent_options)
    {
    std::vector<std::string> new_arguments = parent_options.arguments();
    nav2::replaceOrAddArgument(
    new_arguments, "-r", "__ns",
    "__ns:=" + nav2::add_namespaces(parent_namespace, name));
    nav2::replaceOrAddArgument(new_arguments, "-r", "__node", name + ":" + "__node:=" + name);
    nav2::replaceOrAddArgument(
    new_arguments, "-p", "use_sim_time",
    "use_sim_time:=" + std::string(use_sim_time ? "true" : "false"));
    return rclcpp::NodeOptions().use_intra_process_comms(true).arguments(new_arguments);
    }
  3. LifecycleManager::LifecycleManager(const rclcpp::NodeOptions & options)
    : Node("lifecycle_manager", rclcpp::NodeOptions(options).use_intra_process_comms(true)), diagnostics_updater_(this)
    {
    RCLCPP_INFO(get_logger(), "Creating");
  4. LifecycleNode(
    const std::string & node_name,
    const std::string & ns,
    const rclcpp::NodeOptions & options = rclcpp::NodeOptions())
    : rclcpp_lifecycle::LifecycleNode(node_name, ns, rclcpp::NodeOptions(options).use_intra_process_comms(true), getEnableLifecycleServices(options))
  5. inline rclcpp::Node::SharedPtr generate_internal_node(const std::string & prefix = "")
    {
    auto options =
    rclcpp::NodeOptions()
    .start_parameter_services(false)
    .start_parameter_event_publisher(false)
    .use_intra_process_comms(true)
    .arguments({"--ros-args", "-r", "__node:=" + generate_internal_node_name(prefix), "--"});
    return rclcpp::Node::make_shared("_", options);
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
@codecov
Copy link

codecov bot commented Dec 23, 2025

Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have those metrics you posted on discourse on a page about IPC to showcase that it can be helpful, but also could hurt depending on the optimizations made by the middleware and your particular operating environment (so its best to test and find what is best for you).

This could be a root-page on docs.nav2.org, or perhaps on the Tuning Guide? I think a big part of this contribution is going to be related to documentation rather than programming to make folks aware (1) that it exists, (2) its not always better on, and (3) describing the metrics they might expect to see from your experiments to help pass judgement

Comment on lines 113 to 115
auto msg = std::make_unique<visualization_msgs::msg::MarkerArray>(utils::toMsg(graph_,
route_frame_, this->now()));
graph_vis_publisher_->publish(std::move(msg));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could just return a unique pointer instead. Save a large copy.

if (graph_loader_->loadGraphFromFile(graph_, id_to_graph_map_, request->graph_filepath)) {
goal_intent_extractor_->setGraph(graph_, &id_to_graph_map_);
graph_vis_publisher_->publish(utils::toMsg(graph_, route_frame_, this->now()));
auto msg = std::make_unique<visualization_msgs::msg::MarkerArray>(utils::toMsg(graph_,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

void RouteTool::update_route_graph(void)
{
graph_vis_publisher_->publish(nav2_route::utils::toMsg(graph_, "map", node_->now()));
auto msg = std::make_unique<visualization_msgs::msg::MarkerArray>(nav2_route::utils::toMsg(graph_,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

std::string(node->get_name()) + "_" + client_node_name + "_rclcpp_node");
auto options = node->get_node_options();
options = options.arguments(new_arguments);
options = options.use_intra_process_comms(true).arguments(new_arguments);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and in others: obviously we need to parameterize this (as you know)

@SteveMacenski
Copy link
Member

Opening this as draft so we can discuss how to parameterize IPC

I assume the issue is that you are doing this in the constructor so you don't have access to declare_parmater() and get_parameter()? A couple of these are easy since the getChildNodeOptions() is after construction - same with BT Action.

While I didn't test, I think something like this should work

static bool get_use_ipc(const rclcpp::NodeOptions & options) {
  auto params = options.parameter_overrides();
  for (const auto & param : params) {
    if (param.get_name() == "use_intra_process_comms") {
      return param.as_bool();
    }
  }
  return false;  // default
}

// USE: rclcpp::NodeOptions(options).use_intra_process_comms(get_use_ipc_param(options)))

We can have this as a member of the Nav2 Lifecycle Node (though maybe implemented as a free function so it can be used independently as well.

@mergify
Copy link
Contributor

mergify bot commented Dec 30, 2025

This pull request is in conflict. Could you fix it @mini-1235?

Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
@mini-1235
Copy link
Collaborator Author

I assume the issue is that you are doing this in the constructor so you don't have access to declare_parmater() and get_parameter()?

Sorry, I should be more specific. What I wanted to discuss is whether we want to enable this via launch files or yaml configuration.

In fe1d30d I tried enabling IPC by adding extra_arguments in the node launch (for composable nodes), this works for (1),(3),(4):

  1. auto new_arguments = node->get_node_options().arguments();
    nav2::replaceOrAddArgument(
    new_arguments, "-r", "__node", std::string("__node:=") +
    std::string(node->get_name()) + "_" + client_node_name + "_rclcpp_node");
    auto options = node->get_node_options();
    options = options.use_intra_process_comms(true).arguments(new_arguments);
  2. rclcpp::NodeOptions getChildNodeOptions(
    const std::string & name,
    const std::string & parent_namespace,
    const bool & use_sim_time,
    const rclcpp::NodeOptions & parent_options)
    {
    std::vector<std::string> new_arguments = parent_options.arguments();
    nav2::replaceOrAddArgument(
    new_arguments, "-r", "__ns",
    "__ns:=" + nav2::add_namespaces(parent_namespace, name));
    nav2::replaceOrAddArgument(new_arguments, "-r", "__node", name + ":" + "__node:=" + name);
    nav2::replaceOrAddArgument(
    new_arguments, "-p", "use_sim_time",
    "use_sim_time:=" + std::string(use_sim_time ? "true" : "false"));
    return rclcpp::NodeOptions().use_intra_process_comms(true).arguments(new_arguments);
    }
  3. LifecycleManager::LifecycleManager(const rclcpp::NodeOptions & options)
    : Node("lifecycle_manager", rclcpp::NodeOptions(options).use_intra_process_comms(true)), diagnostics_updater_(this)
    {
    RCLCPP_INFO(get_logger(), "Creating");
  4. LifecycleNode(
    const std::string & node_name,
    const std::string & ns,
    const rclcpp::NodeOptions & options = rclcpp::NodeOptions())
    : rclcpp_lifecycle::LifecycleNode(node_name, ns, rclcpp::NodeOptions(options).use_intra_process_comms(true), getEnableLifecycleServices(options))
  5. inline rclcpp::Node::SharedPtr generate_internal_node(const std::string & prefix = "")
    {
    auto options =
    rclcpp::NodeOptions()
    .start_parameter_services(false)
    .start_parameter_event_publisher(false)
    .use_intra_process_comms(true)
    .arguments({"--ros-args", "-r", "__node:=" + generate_internal_node_name(prefix), "--"});
    return rclcpp::Node::make_shared("_", options);

For (2), I need to modify it to return rclcpp::NodeOptions(parent_options).arguments(new_arguments);

For (5), I am not sure if it is actually used in the current codebase, so I didn't modify it for now

Let me know which approach you would prefer

@mini-1235
Copy link
Collaborator Author

I think we should have those metrics you posted on discourse on a page about IPC to showcase that it can be helpful, but also could hurt depending on the optimizations made by the middleware and your particular operating environment (so its best to test and find what is best for you).

This could be a root-page on docs.nav2.org, or perhaps on the Tuning Guide? I think a big part of this contribution is going to be related to documentation rather than programming to make folks aware (1) that it exists, (2) its not always better on, and (3) describing the metrics they might expect to see from your experiments to help pass judgement

I have opened a PR here ros-navigation/docs.nav2.org#835 to document IPC. I also briefly mention composition, RMW, and QoS. Let me know if there are other details you would like me to add :)

@mini-1235 mini-1235 marked this pull request as ready for review January 1, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants