diff --git a/clever/src/optical_flow.cpp b/clever/src/optical_flow.cpp index 5975ad83..e051e072 100644 --- a/clever/src/optical_flow.cpp +++ b/clever/src/optical_flow.cpp @@ -219,16 +219,16 @@ private: { tf2::Quaternion prev_rot, curr_rot; tf2::fromMsg(tf_buffer_.lookupTransform(frame_id, local_frame_id_, prev).transform.rotation, prev_rot); - tf2::fromMsg(tf_buffer_.lookupTransform(frame_id, local_frame_id_, curr).transform.rotation, curr_rot); + tf2::fromMsg(tf_buffer_.lookupTransform(frame_id, local_frame_id_, curr, ros::Duration(0.1)).transform.rotation, curr_rot); geometry_msgs::Vector3Stamped flow; flow.header.frame_id = frame_id; flow.header.stamp = curr; // https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions#Quaternion_↔_angular_velocities auto diff = ((curr_rot - prev_rot) * prev_rot.inverse()) * 2.0f; - flow.vector.x = diff.x(); - flow.vector.y = diff.y(); - flow.vector.z = diff.z(); + flow.vector.x = -diff.x(); + flow.vector.y = -diff.y(); + flow.vector.z = -diff.z(); return flow; }