fixed camera info frame id

This commit is contained in:
Joe Dong
2023-09-05 18:02:06 +08:00
parent 8509ccfd67
commit f6b9551320
+6 -2
View File
@@ -815,7 +815,11 @@ void OBCameraNode::onNewFrameCallback(const std::shared_ptr<ob::Frame> &frame,
stream_index == COLOR ? camera_param_->rgbIntrinsic : camera_param_->depthIntrinsic;
auto &distortion =
stream_index == COLOR ? camera_param_->rgbDistortion : camera_param_->depthDistortion;
std::string frame_id =
depth_registration_ ? depth_aligned_frame_id_[stream_index] : optical_frame_id_[stream_index];
auto camera_info = convertToCameraInfo(intrinsic, distortion, width);
camera_info.header.stamp = timestamp;
camera_info.header.frame_id = frame_id;
CHECK(camera_info_publishers_.count(stream_index) > 0);
camera_info_publishers_[stream_index]->publish(camera_info);
auto image_msg =
@@ -823,8 +827,8 @@ void OBCameraNode::onNewFrameCallback(const std::shared_ptr<ob::Frame> &frame,
image_msg->header.stamp = timestamp;
image_msg->is_bigendian = false;
image_msg->step = width * unit_step_size_[stream_index];
image_msg->header.frame_id =
depth_registration_ ? depth_aligned_frame_id_[stream_index] : optical_frame_id_[stream_index];
image_msg->header.frame_id = frame_id;
CHECK(image_publishers_.count(stream_index) > 0);
image_publishers_[stream_index].publish(image_msg);
saveImageToFile(stream_index, image, image_msg);