30 #ifndef RVIZ_FRAME_MANAGER_H 31 #define RVIZ_FRAME_MANAGER_H 39 #include <OgreVector3.h> 40 #include <OgreQuaternion.h> 42 #include <boost/thread/mutex.hpp> 44 #include <geometry_msgs/Pose.h> 53 class TransformListener;
88 [[deprecated(
"This constructor signature will be removed in the next version. " 89 "If you still need to pass a boost::shared_ptr<tf::TransformListener>, " 90 "disable the warning explicitly. " 91 "When this constructor is removed, a new constructor with a single, " 92 "optional argument will take a std::pair<> containing a " 93 "std::shared_ptr<tf2_ros::Buffer> and a " 94 "std::shared_ptr<tf2_ros::TransformListener>. " 95 "However, that cannot occur until the use of tf::TransformListener is " 109 void setFixedFrame(
const std::string& frame);
112 void setPause(
bool pause);
141 template <
typename Header>
144 return getTransform(header.frame_id, header.
stamp, position, orientation);
153 bool getTransform(
const std::string& frame,
155 Ogre::Vector3& position,
156 Ogre::Quaternion& orientation);
164 template <
typename Header>
166 const geometry_msgs::Pose& pose,
167 Ogre::Vector3& position,
168 Ogre::Quaternion& orientation)
170 return transform(header.frame_id, header.
stamp, pose, position, orientation);
180 bool transform(
const std::string& frame,
182 const geometry_msgs::Pose& pose,
183 Ogre::Vector3& position,
184 Ogre::Quaternion& orientation);
194 bool frameHasProblems(
const std::string& frame,
ros::Time time, std::string& error);
201 bool transformHasProblems(
const std::string& frame,
ros::Time time, std::string& error);
213 [[deprecated(
"use a tf2_ros::MessageFilter instead")]]
void 216 filter->
registerCallback(boost::bind(&FrameManager::messageCallback<M>,
this, _1, display));
218 boost::bind(&FrameManager::failureCallback<M, tf::FilterFailureReason>,
this, _1, _2, display));
232 filter->
registerCallback(boost::bind(&FrameManager::messageCallback<M>,
this, _1, display));
234 &FrameManager::failureCallback<M, tf2_ros::FilterFailureReason>,
this, _1, _2, display));
259 return tf_->getTF2BufferPtr();
271 [[deprecated(
"used tf2 version instead")]] std::string
272 discoverFailureReason(
const std::string& frame_id,
274 const std::string& caller_id,
286 std::string discoverFailureReason(
const std::string& frame_id,
288 const std::string& caller_id,
293 void fixedFrameChanged();
296 bool adjustTime(
const std::string& frame,
ros::Time& time);
304 messageArrived(msg->header.frame_id, msg->header.stamp, authority, display);
307 template <
class M,
class TfFilterFailureReasonType>
309 TfFilterFailureReasonType reason,
315 messageFailed(msg->header.frame_id, msg->header.stamp, authority, reason, display);
318 void messageArrived(
const std::string& frame_id,
320 const std::string& caller_id,
323 void messageFailedImpl(
const std::string& caller_id,
const std::string& status_text,
Display* display);
325 template <
class TfFilterFailureReasonType>
328 const std::string& caller_id,
329 TfFilterFailureReasonType reason,
334 #pragma GCC diagnostic push 335 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 338 std::string status_text = discoverFailureReason(frame_id, stamp, caller_id, reason);
341 #pragma GCC diagnostic pop 344 messageFailedImpl(caller_id, status_text, display);
355 if (frame != rhs.
frame)
357 return frame < rhs.
frame;
360 return time < rhs.
time;
369 CacheEntry(
const Ogre::Vector3& p,
const Ogre::Quaternion& o) : position(p), orientation(o)
376 typedef std::map<CacheKey, CacheEntry>
M_Cache;
398 #endif // RVIZ_FRAME_MANAGER_H const boost::shared_ptr< ConstMessage > & getConstMessage() const
Ogre::Quaternion orientation
boost::mutex cache_mutex_
boost::shared_ptr< tf::TransformListener > tf_
message_filters::Connection registerFailureCallback(const FailureCallback &callback)
ros::Time getTime()
Get current time, depending on the sync mode.
CacheKey(const std::string &f, ros::Time t)
void messageFailed(const std::string &frame_id, const ros::Time &stamp, const std::string &caller_id, TfFilterFailureReasonType reason, Display *display)
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
Helper class for transforming data into Ogre's world frame (the fixed frame).
const boost::shared_ptr< tf::TransformListener > & getTFClientPtr()
Return a boost shared pointer to the tf::TransformListener used to receive transform data...
void registerFilterForTransformStatusCheck(tf::MessageFilter< M > *filter, Display *display)
Connect a tf::MessageFilter's callbacks to success and failure handler functions in this FrameManager...
message_filters::Connection registerFailureCallback(const FailureCallback &callback)
std::map< CacheKey, CacheEntry > M_Cache
bool transform(const Header &header, const geometry_msgs::Pose &pose, Ogre::Vector3 &position, Ogre::Quaternion &orientation)
Transform a pose from a frame into the fixed frame.
void failureCallback(const ros::MessageEvent< M const > &msg_evt, TfFilterFailureReasonType reason, Display *display)
tf::TransformListener * getTFClient()
Return the tf::TransformListener used to receive transform data.
const std::string & getFixedFrame()
Return the current fixed frame name.
void registerFilterForTransformStatusCheck(tf2_ros::MessageFilter< M > *filter, Display *display)
void messageCallback(const ros::MessageEvent< M const > &msg_evt, Display *display)
bool getTransform(const Header &header, Ogre::Vector3 &position, Ogre::Quaternion &orientation)
Return the pose for a header, relative to the fixed frame, in Ogre classes.
const std::string & getPublisherName() const
CacheEntry(const Ogre::Vector3 &p, const Ogre::Quaternion &o)
const std::shared_ptr< tf2_ros::Buffer > getTF2BufferPtr()
bool operator<(const CacheKey &rhs) const
Connection registerCallback(const C &callback)