Skip to content

Reduce TransformListener nodes #440

@gezp

Description

@gezp

hi, I'm working for Summer Student Program of Navigation2 : reduce the number of nodes running in Nav2 (tickets in Nav2), due to Node is overhead in ROS2.

When i reduce amcl_node nodes, i notice that the constructor of TransformListener has a argument spin_thread with default value true, which create a internal node to subscribe tf topic and a dedicated thread to spin this node.

i think the best way is to use new callback group and executor with dedicated thread so that we could avoid creating internal node which is overhead.

  • If spin_thread, then create new callback group, and use executor to spin callback group instead of node.
  • If not spin_thread, then its on the application to spin (no change)

After implementing this feature, we can use TransformListener in Node (for example AmclNode) like this to avoid creating internal Node.

tf_buffer_ = std::make_shared<tf2_ros::Buffer>(get_clock());
tf_listener_ = std::make_shared<tf2_ros::TransformListener>(
   *tf_buffer_, shared_from_this(), true);

any discussion is welcome, and i will make a PR if this feature is good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions