本文整理汇总了C++中tf::Transformer::canTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformer::canTransform方法的具体用法?C++ Transformer::canTransform怎么用?C++ Transformer::canTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tf::Transformer
的用法示例。
在下文中一共展示了Transformer::canTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: projectRayToGround
bool projectRayToGround(const tf::Transformer& listener,
const tf::Stamped<tf::Point> camera_ray,
Eigen::Vector4d ground_plane, std::string ground_frame,
tf::Stamped<tf::Point>* world_point)
{
tf::StampedTransform camera_transform;
// This is a static link, so Time(0) should be fine
if (!listener.canTransform(ground_frame, camera_ray.frame_id_, camera_ray.stamp_)) {
ROS_INFO("Couldn't transform %s to %s\n",camera_ray.frame_id_.c_str(),
ground_frame.c_str());
return false;
}
listener.lookupTransform(ground_frame, camera_ray.frame_id_,ros::Time(0),camera_transform);
tf::Stamped<tf::Point> ground_frame_ray;
listener.transformVector(ground_frame, camera_ray, ground_frame_ray);
Eigen::Vector3d ray, ray_origin;
tf::vectorTFToEigen(ground_frame_ray, ray);
tf::vectorTFToEigen(camera_transform.getOrigin(), ray_origin);
Eigen::Vector3d ground_v = intersectRayPlane(ray, ray_origin, ground_plane);
tf::vectorEigenToTF(ground_v, *world_point);
world_point->frame_id_ = ground_frame;
world_point->stamp_ = camera_ray.stamp_;
return true;
}