Skip to content

Commit fd2c36d

Browse files
author
Jetson Developer
committed
Get frame_id prefix from paramters when using tf publishing is on
1 parent 5aed7fa commit fd2c36d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

depthai_ros_driver/include/depthai_ros_driver/dai_nodes/base_node.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "depthai-shared/common/CameraBoardSocket.hpp"
77
#include "depthai/pipeline/Node.hpp"
8+
#include "depthai_ros_driver/param_handlers/camera_param_handler.hpp"
89
#include "depthai_ros_driver/utils.hpp"
910
#include "rclcpp/logger.hpp"
1011

@@ -99,6 +100,8 @@ class BaseNode {
99100
std::string baseDAINodeName;
100101
bool intraProcessEnabled;
101102
rclcpp::Logger logger;
103+
104+
std::unique_ptr<param_handlers::CameraParamHandler> ph;
102105
};
103106
} // namespace dai_nodes
104107
} // namespace depthai_ros_driver

depthai_ros_driver/src/dai_nodes/base_node.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace dai_nodes {
1515
BaseNode::BaseNode(const std::string& daiNodeName, std::shared_ptr<rclcpp::Node> node, std::shared_ptr<dai::Pipeline> /*pipeline*/)
1616
: baseNode(node), baseDAINodeName(daiNodeName), logger(node->get_logger()) {
1717
intraProcessEnabled = node->get_node_options().use_intra_process_comms();
18+
ph = std::make_unique<param_handlers::CameraParamHandler>(baseNode, "camera");
1819
};
1920
BaseNode::~BaseNode() = default;
2021
void BaseNode::setNodeName(const std::string& daiNodeName) {
@@ -46,6 +47,10 @@ std::string BaseNode::getSocketName(dai::CameraBoardSocket socket) {
4647
}
4748

4849
std::string BaseNode::getTFPrefix(const std::string& frameName) {
50+
if(ph->getParam<bool>("i_publish_tf_from_calibration")) {
51+
return ph->getParam<std::string>("i_tf_base_frame") + "_" + frameName;
52+
}
53+
4954
return std::string(getROSNode()->get_name()) + "_" + frameName;
5055
}
5156

0 commit comments

Comments
 (0)