Skip to content

Conversation

@jb-balaji
Copy link

Refactor Topics to Use Relative Paths for Improved Namespace Compatibility

This commit updates topic and service names from absolute to relative paths across the repository by removing prefixed '/' from ros2 names This enables the correct appending of namespaces to nodes, topics, and services, enhancing flexibility and modularity of the system.

  • Modified topic and service paths in C++ source files and headers.
  • Updated corresponding Python scripts to reflect relative naming.
  • Adjusted unit tests to align with the new naming convention.

Fixes : #303

This commit updates topic and service names from absolute to relative
paths across the repository by removing prefixed '/' from ros2 names
This enables the correct appending of namespaces to nodes, topics,
and services, enhancing flexibility and modularity of the system.

- Modified topic and service paths in C++ source files and headers.
- Updated corresponding Python scripts to reflect relative naming.
- Adjusted unit tests to align with the new naming convention.

Signed-off-by: Arshad Mehmood <[email protected]>
@ynakaga
Copy link

ynakaga commented Mar 5, 2025

This fix will work well for issue #303.

Here is my question. In a big system, if the namespaces are used without a clear structure or understanding, the relative topic names could lead to communication issues.
Is there any alternatives? Such as adding unique identifiers into the global nodes when publishing for distinguish? It will make sure the receivers will receive the messages and pick up what they want to receive

@jb-balaji
Copy link
Author

This fix will work well for issue #303.

Here is my question. In a big system, if the namespaces are used without a clear structure or understanding, the relative topic names could lead to communication issues. Is there any alternatives? Such as adding unique identifiers into the global nodes when publishing for distinguish? It will make sure the receivers will receive the messages and pick up what they want to receive

Per ROS the recommended solution is to use relative namespace. As we want topics to be shared across several ros nodes, it gives the flexibility for publishers and subscribers efficiently

@jb-balaji
Copy link
Author

Copy link
Contributor

@LewisLiuPub LewisLiuPub left a comment

Choose a reason for hiding this comment

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

Please have a check with my comments.

…vino_toolkit/image_raw in all the launch files
@jb-balaji jb-balaji requested a review from LewisLiuPub July 21, 2025 13:32
jb-balaji and others added 3 commits July 21, 2025 15:58
* Refactor topic and service names to relative for namespace compatibility

This commit updates topic and service names from absolute to relative
paths across the repository by removing prefixed '/' from ros2 names
This enables the correct appending of namespaces to nodes, topics,
and services, enhancing flexibility and modularity of the system.

- Modified topic and service paths in C++ source files and headers.
- Updated corresponding Python scripts to reflect relative naming.
- Adjusted unit tests to align with the new naming convention.

Signed-off-by: Arshad Mehmood <[email protected]>

* Fix review comments and replace /openvino_toolkit/image_raw with openvino_toolkit/image_raw in all the launch files

* Apply suggestions from code review

Co-authored-by: Copilot <[email protected]>

---------

Signed-off-by: Arshad Mehmood <[email protected]>
Co-authored-by: Arshad Mehmood <[email protected]>
Co-authored-by: Copilot <[email protected]>
@jb-balaji jb-balaji marked this pull request as draft July 24, 2025 08:17
@jb-balaji jb-balaji removed the request for review from LewisLiuPub July 24, 2025 08:18
@jb-balaji jb-balaji marked this pull request as ready for review October 7, 2025 13:57
@jb-balaji jb-balaji requested a review from Copilot October 7, 2025 13:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors ROS2 topic and service names from absolute paths to relative paths across the codebase by removing the leading '/' prefix. This change improves namespace compatibility by allowing proper namespace appending to nodes, topics, and services.

  • Converted absolute topic paths (e.g., /ros2_openvino_toolkit/detected_objects) to relative paths (ros2_openvino_toolkit/detected_objects)
  • Updated service names from absolute to relative paths for improved modularity
  • Modified launch files to use relative remapping paths

Reviewed Changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/src/topic/*.cpp Updated test subscription topic names to use relative paths
tests/src/service/*.cpp Changed service client creation to use relative service names
sample/src/*.cpp Modified sample clients to use relative service paths
sample/launch/*.py Updated launch file remappings to use relative topic names
script/viewer/service.py Changed Python service client to use relative path
openvino_wrapper_lib/src/services/*.cpp Updated service creation to use relative names
openvino_wrapper_lib/src/outputs/*.cpp Modified publisher topic names to use relative paths
openvino_wrapper_lib/src/inputs/image_topic.cpp Changed input topic macro to relative path

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants