@@ -37,6 +37,8 @@ struct BackprojectionNode : public rclcpp::Node {
3737 size_t input_queue_size = 1 ;
3838 size_t output_queue_size = 1 ;
3939 bool show_config = true ;
40+ std::string camera_frame;
41+ std::string lidar_frame;
4042 } const config;
4143
4244 explicit BackprojectionNode (const rclcpp::NodeOptions& options);
@@ -69,6 +71,8 @@ void declare_config(BackprojectionNode::Config& config) {
6971 field (config.input_queue_size , " input_queue_size" );
7072 field (config.output_queue_size , " output_queue_size" );
7173 field (config.show_config , " show_config" );
74+ field (config.camera_frame , " camera_frame" );
75+ field (config.lidar_frame , " lidar_frame" );
7276 check (config.input_queue_size , GT, 0 , " input_queue_size" );
7377 check (config.output_queue_size , GT, 0 , " output_queue_size" );
7478}
@@ -125,8 +129,10 @@ void BackprojectionNode::callback(const Image::ConstSharedPtr& image_msg,
125129 const PointCloud2::ConstSharedPtr& cloud_msg) {
126130 // Find transform from cloud to image frame
127131 const rclcpp::Time stamp (cloud_msg->header .stamp );
128- const auto image_T_cloud =
129- getTransform (image_msg->header .frame_id , cloud_msg->header .frame_id , stamp);
132+ const auto image_T_cloud = getTransform (
133+ !config.camera_frame .empty () ? config.camera_frame : image_msg->header .frame_id ,
134+ !config.lidar_frame .empty () ? config.lidar_frame : cloud_msg->header .frame_id ,
135+ stamp);
130136 if (!image_T_cloud) {
131137 return ;
132138 }
0 commit comments