MCPcopy Create free account
hub / github.com/RoboMaster/RoboRTS / GetPoseFromTf

Method GetPoseFromTf

roborts_localization/localization_node.cpp:264–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264bool LocalizationNode::GetPoseFromTf(const std::string &target_frame,
265 const std::string &source_frame,
266 const ros::Time &timestamp,
267 Vec3d &pose)
268{
269 tf::Stamped<tf::Pose> ident(tf::Transform(tf::createIdentityQuaternion(),
270 tf::Vector3(0, 0, 0)),
271 timestamp,
272 source_frame);
273 tf::Stamped<tf::Pose> pose_stamp;
274 try {
275 this->tf_listener_ptr_->transformPose(target_frame,
276 ident,
277 pose_stamp);
278 } catch (tf::TransformException &e) {
279 LOG_ERROR << "Couldn't transform from "
280 << source_frame
281 << "to "
282 << target_frame;
283 return false;
284 }
285
286 pose.setZero();
287 pose[0] = pose_stamp.getOrigin().x();
288 pose[1] = pose_stamp.getOrigin().y();
289 double yaw,pitch, roll;
290 pose_stamp.getBasis().getEulerYPR(yaw, pitch, roll);
291 pose[2] = yaw;
292 return true;
293}
294
295void LocalizationNode::TransformLaserscanToBaseFrame(double &angle_min,
296 double &angle_increment,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected