Eigen::Affine3f transform_temp = (Affine3f)transforms[i];
const Eigen::Matrix3d rotation_part = transform_temp.rotation().cast<double>();
const Eigen::Vector3d translation_part = transform_temp.translation().cast<double>();
tf::Matrix3x3 rot;
tf::Vector3 tra;
tf::matrixEigenToTF(rotation_part, rot);
tf::vectorEigenToTF(translation_part, tra);
tf::Transform temp_transform(rot, tra);
listener->lookupTransform (link, msg_in->header.frame_id, ros::Time(0), tfTransform);
broadcaster->sendTransform(tf::StampedTransform(tfTransform * temp_transform.inverse(), ros::Time::now(), link, "chess_board"));
我收到以下錯誤消息。不知道爲什麼,我有find_package(catkin REQUIRED COMPONENTS tf tf_conversions)
也target_link_libraries(${catkin_LIBRARIES})
tf和eigen之間的轉換
undefined reference to `tf::matrixEigenToTF(Eigen::Matrix<double, 3, 3, 1, 3, 3> const&, tf::Matrix3x3&)'
我可以手動轉換這只是複製tf :: matrixEigenToTF()代碼。但仍然不知道爲什麼直接調用這個函數不起作用。 – Johnnylin