From d2b13aff92cda90987364bbc34ca1a95e497a128 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Mon, 18 Mar 2019 23:50:40 +0300 Subject: [PATCH] optical_flow: use try when transform from camera to base_link frame --- clever/src/optical_flow.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clever/src/optical_flow.cpp b/clever/src/optical_flow.cpp index e051e072..6a97aef5 100644 --- a/clever/src/optical_flow.cpp +++ b/clever/src/optical_flow.cpp @@ -161,7 +161,12 @@ private: flow_camera.header.stamp = msg->header.stamp; flow_camera.vector.x = flow_y; // +y means counter-clockwise rotation around Y axis flow_camera.vector.y = -flow_x; // +x means clockwise rotation around X axis - tf_buffer_.transform(flow_camera, flow_fcu, fcu_frame_id_); + try { + tf_buffer_.transform(flow_camera, flow_fcu, fcu_frame_id_); + } catch (const tf2::TransformException& e) { + // transform is not available yet + return; + } // Calculate integration time ros::Duration integration_time = msg->header.stamp - prev_stamp_;