20 #include <tf/transform_datatypes.h> 21 #include <tf_conversions/tf_eigen.h> 27 geometry_msgs::TransformStamped topToBase;
28 geometry_msgs::TransformStamped topToMarkerLeft;
29 geometry_msgs::TransformStamped topToMarkerRight;
31 topToBase.header.frame_id =
"object_top";
32 topToBase.child_frame_id =
"object_base";
33 topToMarkerLeft.header.frame_id =
"object_top";
34 topToMarkerLeft.child_frame_id =
"marker_left";
35 topToMarkerRight.header.frame_id =
"object_top";
36 topToMarkerRight.child_frame_id =
"marker_right";
37 mapToTop.header.frame_id =
"calibration_center";
38 mapToTop.child_frame_id =
"object_top";
46 topToBase.transform.translation.z = -
object->side_b;
47 topToBase.transform.rotation = tf::createQuaternionMsgFromYaw(0.0);
48 Eigen::Affine3d eigenTransform = Eigen::Affine3d(object->frame_marker_left);
49 tf::Transform tfTransform;
50 geometry_msgs::Transform gmTransform;
51 tf::transformEigenToTF(eigenTransform, tfTransform);
52 tf::transformTFToMsg(tfTransform, gmTransform);
53 topToMarkerLeft.transform = gmTransform;
54 eigenTransform = Eigen::Affine3d(object->frame_marker_right);
55 tf::transformEigenToTF(eigenTransform, tfTransform);
56 tf::transformTFToMsg(tfTransform, gmTransform);
57 topToMarkerRight.transform = gmTransform;
58 mapToTop.transform.rotation = tf::createQuaternionMsgFromYaw(0.0);
59 topToScanFrame.transform.rotation = tf::createQuaternionMsgFromYaw(0.0);
68 Eigen::Affine3d eigenTransform = Eigen::Affine3d(transform);
69 tf::Transform tfTransform;
70 geometry_msgs::Transform gmTransform;
71 tf::transformEigenToTF(eigenTransform, tfTransform);
72 tf::transformTFToMsg(tfTransform, gmTransform);
76 topToScanFrame.transform.rotation = tf::createQuaternionMsgFromYaw(0.0);
81 Eigen::Affine3d eigenTransform = Eigen::Affine3d(transform);
82 tf::Transform tfTransform;
83 geometry_msgs::Transform gmTransform;
84 tf::transformEigenToTF(eigenTransform, tfTransform);
85 tf::transformTFToMsg(tfTransform, gmTransform);
89 ROS_INFO(
"Got new camera frame from left marker.");
94 ROS_INFO(
"Got new camera frame from right marker.");
133 ROS_ERROR(
"Something went wrong in the tf broadcaster");
142 Eigen::Affine3d eigenTransform = Eigen::Affine3d(matrix);
143 tf::Transform tfTransform;
144 geometry_msgs::Transform gmTransform;
145 tf::transformEigenToTF(eigenTransform, tfTransform);
146 tf::transformTFToMsg(tfTransform, gmTransform);
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)