Skip to content

Commit

Permalink
adding _chainAsVector method for ros/geometry#18
Browse files Browse the repository at this point in the history
  • Loading branch information
tfoote committed Jul 11, 2013
1 parent c90a4f4 commit 3f7575a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/tf2/buffer_core.h
Expand Up @@ -294,7 +294,10 @@ class BufferCore
*/
std::string _allFramesAsDot() const;


/** \brief Backwards compatabilityA way to see what frames are in a chain
* Useful for debugging
*/
void _chainAsVector(const std::string & target_frame, ros::Time target_time, const std::string & source_frame, ros::Time source_time, const std::string & fixed_frame, std::vector<std::string>& output) const;

private:

Expand Down
29 changes: 29 additions & 0 deletions src/buffer_core.cpp
Expand Up @@ -1388,4 +1388,33 @@ std::string BufferCore::_allFramesAsDot() const
}


void BufferCore::_chainAsVector(const std::string & target_frame, ros::Time target_time, const std::string & source_frame, ros::Time source_time, const std::string& fixed_frame, std::vector<std::string>& output) const
{
std::string error_string;

output.clear(); //empty vector

std::stringstream mstream;
boost::mutex::scoped_lock lock(frame_mutex_);

TransformStorage temp;

///regular transforms
for (unsigned int counter = 1; counter < frames_.size(); counter ++)
{
TimeCacheInterfacePtr frame_ptr = getFrame(CompactFrameID(counter));
if (frame_ptr == NULL)
continue;
CompactFrameID frame_id_num;
if (frame_ptr->getData(ros::Time(), temp))
frame_id_num = temp.frame_id_;
else
{
frame_id_num = 0;
}
output.push_back(frameIDs_reverse[frame_id_num]);
}
}


} // namespace tf2

0 comments on commit 3f7575a

Please sign in to comment.