| 96 | pnh_.param("align_all_posture_to_source", align_all_posture_to_source_, false); |
| 97 | } |
| 98 | void process() |
| 99 | { |
| 100 | tf2::Stamped<tf2::Transform> trans; |
| 101 | tf2::Stamped<tf2::Transform> trans_target; |
| 102 | try |
| 103 | { |
| 104 | tf2::fromMsg( |
| 105 | tf_buffer_.lookupTransform(projection_surface_frame_, source_frame_, ros::Time(0), ros::Duration(0.1)), |
| 106 | trans); |
| 107 | tf2::fromMsg( |
| 108 | tf_buffer_.lookupTransform(parent_frame_, projection_surface_frame_, trans.stamp_, ros::Duration(0.1)), |
| 109 | trans_target); |
| 110 | } |
| 111 | catch (tf2::TransformException& e) |
| 112 | { |
| 113 | ROS_WARN_THROTTLE(1.0, "%s", e.what()); |
| 114 | return; |
| 115 | } |
| 116 | |
| 117 | if (!trans.stamp_.isZero()) |
| 118 | trans.stamp_ += ros::Duration(tf_tolerance_); |
| 119 | |
| 120 | if (project_posture_) |
| 121 | { |
| 122 | if (align_all_posture_to_source_) |
| 123 | { |
| 124 | const tf2::Quaternion rot(trans.getRotation()); |
| 125 | const tf2::Quaternion rot_yaw(tf2::Vector3(0.0, 0.0, 1.0), tf2::getYaw(rot)); |
| 126 | const tf2::Transform rot_inv(rot_yaw * rot.inverse()); |
| 127 | trans.setData(rot_inv * trans); |
| 128 | } |
| 129 | else |
| 130 | { |
| 131 | const float yaw = tf2::getYaw(trans.getRotation()); |
| 132 | trans.setRotation(tf2::Quaternion(tf2::Vector3(0.0, 0.0, 1.0), yaw)); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | const tf2::Stamped<tf2::Transform> result( |
| 137 | track_odometry::projectTranslation(trans, trans_target), |
| 138 | trans.stamp_, |
| 139 | parent_frame_); |
| 140 | |
| 141 | geometry_msgs::TransformStamped trans_out = tf2::toMsg(result); |
| 142 | if (flat_) |
| 143 | { |
| 144 | const double yaw = tf2::getYaw(trans_out.transform.rotation); |
| 145 | trans_out.transform.rotation = tf2::toMsg(tf2::Quaternion(tf2::Vector3(0.0, 0.0, 1.0), yaw)); |
| 146 | } |
| 147 | trans_out.child_frame_id = projected_frame_; |
| 148 | |
| 149 | if (trans.stamp_.isZero()) |
| 150 | { |
| 151 | tf_static_broadcaster_.sendTransform(trans_out); |
| 152 | } |
| 153 | else |
| 154 | { |
| 155 | tf_broadcaster_.sendTransform(trans_out); |
nothing calls this directly
no outgoing calls
no test coverage detected