Skip to content

Commit 307ece6

Browse files
add option to override message frame IDs (#15)
1 parent 33b2600 commit 307ece6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

semantic_inference_ros/src/backprojection_nodelet.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)