bool Buffer::canTransform(const std::string& target_frame, const std::string& source_frame, const ros::Time& time, const ros::Duration timeout, std::string* errstr) const { // poll for transform if timeout is set ros::Time start_time = ros::Time::now(); while (ros::Time::now() < start_time + timeout && !canTransform(target_frame, source_frame, time)) ros::Duration(0.01).sleep(); return canTransform(target_frame, source_frame, time, errstr); }
geometry_msgs::TransformStamped Buffer::lookupTransform(const std::string& target_frame, const std::string& source_frame, const ros::Time& time, const ros::Duration timeout) const { canTransform(target_frame, source_frame, time, timeout); return lookupTransform(target_frame, source_frame, time); }
bool Buffer::canTransform(const std::string& target_frame, const std::string& source_frame, const ros::Time& time, const ros::Duration timeout, std::string* errstr) const { if (!checkAndErrorDedicatedThreadPresent(errstr)) return false; // poll for transform if timeout is set ros::Time start_time = now_fallback_to_wall(); while (now_fallback_to_wall() < start_time + timeout && !canTransform(target_frame, source_frame, time) && (now_fallback_to_wall()+ros::Duration(3.0) >= start_time) && //don't wait when we detect a bag loop (ros::ok() || !ros::isInitialized())) // Make sure we haven't been stopped (won't work for pytf) { sleep_fallback_to_wall(ros::Duration(0.01)); } bool retval = canTransform(target_frame, source_frame, time, errstr); conditionally_append_timeout_info(errstr, start_time, timeout); return retval; }