15 Pose::Pose(std::string targetFrame, std::string referenceFrame)
16 : poseFrameName_(targetFrame),
17 referenceFrame_(referenceFrame),
22 ROS_INFO(
"[Pose] Creating Pose tracker component to track %s in the reference frame %s", targetFrame.c_str(), referenceFrame.c_str());
28 tfListener_ = std::make_shared<tf::TransformListener>();
35 while (ros::ok() && !found)
37 tf::StampedTransform transform;
43 ros::Time(0), transform);
47 std::lock_guard<std::mutex> guard(
m_mutex_);
48 tf::poseTFToMsg(transform, this->
pose_.pose);
49 this->
pose_.header.stamp = transform.stamp_;
54 catch (tf::TransformException ex)
56 ROS_ERROR_STREAM_THROTTLE(1,
"[Component pose] (" <<
poseFrameName_ <<
"/[" <<
referenceFrame_ <<
"] ) is failing on pose update : " << ex.what());
66 tf::StampedTransform transform;
72 ros::Time(0), transform);
76 std::lock_guard<std::mutex> guard(
m_mutex_);
77 tf::poseTFToMsg(transform, this->
pose_.pose);
78 this->
pose_.header.stamp = transform.stamp_;
82 catch (tf::TransformException ex)
84 ROS_ERROR_STREAM_THROTTLE(1,
"[Component pose] (" <<
poseFrameName_ <<
"/[" <<
referenceFrame_ <<
"] ) is failing on pose update : " << ex.what());
static std::shared_ptr< tf::TransformListener > tfListener_
std::string poseFrameName_
void waitTransformUpdate(ros::Rate r=ros::Rate(20))
std::string referenceFrame_
geometry_msgs::PoseStamped pose_
Pose(std::string poseFrameName="base_link", std::string referenceFrame="odom")
virtual void update() override
static std::mutex listenerMutex_