Support configurable TF frame prefixes - #794
Open
Daniiiil1 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a configurable TF frame prefix mechanism to make frame IDs consistent across image/optical frames, IMU messages, and calibration-based TF publishing—primarily to support multi-robot namespacing scenarios raised in #789.
Changes:
- Introduces a
tf_prefixlaunch argument (defaulting to the driver node name) and threads it into calibration TF and URDF launch wiring. - Updates
BaseNodeand IMU publishing to derive frame IDs from a shared prefix when calibration TF publishing is enabled. - Adds a hardware-independent gtest to validate configured vs fallback prefix behavior, and wires it into the build/test system.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| depthai_ros_driver/test/tf_prefix_test.cpp | Adds gtest coverage for configured vs fallback TF prefix behavior. |
| depthai_ros_driver/src/param_handlers/driver_param_handler.cpp | Changes default i_tf_base_frame to node name for consistent defaults. |
| depthai_ros_driver/src/dai_nodes/sensors/imu.cpp | Switches IMU frame derivation to use BaseNode::getFrameName()-based prefixing. |
| depthai_ros_driver/src/dai_nodes/base_node.cpp | Adds getTFPrefix() and routes frame naming through it. |
| depthai_ros_driver/include/depthai_ros_driver/dai_nodes/base_node.hpp | Updates docstrings and adds getTFPrefix() declaration. |
| depthai_ros_driver/launch/driver.launch.py | Adds tf_prefix launch arg and applies it to calibration TF + URDF arguments. |
| depthai_descriptions/launch/urdf_launch.py | Separates robot_state_publisher node name from slash-delimited TF prefixes. |
| depthai_bridge/src/TFPublisher.cpp | Uses baseFrame consistently for calibration TF child/header frames. |
| depthai_bridge/include/depthai_bridge/TFPublisher.hpp | Removes stored nodeName member (now uses baseFrame for naming). |
| depthai_ros_driver/CMakeLists.txt | Adds a gtest target for the new TF prefix test. |
| depthai_ros_driver/package.xml | Adds ament_cmake_gtest as a test dependency. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
158
to
+160
| "i_publish_tf_from_calibration": True, | ||
| "i_tf_tf_prefix": name, | ||
| "i_tf_camera_model": cam_model, | ||
| "i_tf_base_frame": name, | ||
| "i_tf_base_frame": tf_prefix, |
Comment on lines
+51
to
+61
| std::string BaseNode::getTFPrefix() { | ||
| auto node = getROSNode(); | ||
| bool publishTF = false; | ||
| if(node->get_parameter("driver.i_publish_tf_from_calibration", publishTF) && publishTF) { | ||
| std::string baseFrame; | ||
| if(node->get_parameter("driver.i_tf_base_frame", baseFrame) && !baseFrame.empty()) { | ||
| return baseFrame; | ||
| } | ||
| } | ||
| return node->get_name(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Author: Daniil Mordanov
Issue
Issue link: #789
Issue description: Published image, optical, IMU, and calibration TF frames were derived from different prefixes, so a custom multi-robot prefix could not be applied consistently.
Related PRs: None
Changes
ROS distro: Kilted
tf_prefixlaunch argument, defaulting to the driver node namedriver.i_tf_base_frameas the shared frame prefix when calibration TF publishing is enabledAddresses #789.
Testing
Hardware used: None
DepthAI library version: N/A
clang-format --dry-run --Werroron changed C++ filesblack --checkon changed launch filesdepthai_ros_driver/package.xmlgit diff --checkThe new gtest is included for the ROS Kilted CI environment.