|
From: <tf...@us...> - 2008-04-18 01:13:36
|
Revision: 128
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=128&view=rev
Author: tfoote
Date: 2008-04-17 18:13:41 -0700 (Thu, 17 Apr 2008)
Log Message:
-----------
returning a string instead of directly displaying to the terminal
Modified Paths:
--------------
pkg/trunk/libTF/simple/libTF.cc
pkg/trunk/libTF/simple/libTF.hh
pkg/trunk/libTF/simple/main.cc
Modified: pkg/trunk/libTF/simple/libTF.cc
===================================================================
--- pkg/trunk/libTF/simple/libTF.cc 2008-04-18 00:50:56 UTC (rev 127)
+++ pkg/trunk/libTF/simple/libTF.cc 2008-04-18 01:13:41 UTC (rev 128)
@@ -183,24 +183,25 @@
}
-void TransformReference::view(unsigned int target_frame, unsigned int source_frame)
+std::string TransformReference::viewChain(unsigned int target_frame, unsigned int source_frame)
{
+ stringstream mstream;
TransformLists lists = lookUpList(target_frame, source_frame);
- std::cout << "Inverse Transforms:" <<std::endl;
+ mstream << "Inverse Transforms:" <<std::endl;
for (unsigned int i = 0; i < lists.inverseTransforms.size(); i++)
{
- std::cout << lists.inverseTransforms[i]<<", ";
+ mstream << lists.inverseTransforms[i]<<", ";
// retMat *= getFrame(lists.inverseTransforms[i])->getInverseMatrix();
}
- std::cout << std::endl;
+ mstream << std::endl;
- std::cout << "Forward Transforms: "<<std::endl ;
+ mstream << "Forward Transforms: "<<std::endl ;
for (unsigned int i = 0; i < lists.forwardTransforms.size(); i++)
{
- std::cout << lists.forwardTransforms[i]<<", ";
+ mstream << lists.forwardTransforms[i]<<", ";
// retMat *= getFrame(lists.inverseTransforms[lists.forwardTransforms.size() -1 - i])->getMatrix(); //Do this list backwards for it was generated traveling the wrong way
}
- std::cout << std::endl;
-
+ mstream << std::endl;
+ return mstream.str();
}
Modified: pkg/trunk/libTF/simple/libTF.hh
===================================================================
--- pkg/trunk/libTF/simple/libTF.hh 2008-04-18 00:50:56 UTC (rev 127)
+++ pkg/trunk/libTF/simple/libTF.hh 2008-04-18 01:13:41 UTC (rev 128)
@@ -39,15 +39,23 @@
#include <math.h>
#include <vector>
#include "Quaternion3D.hh"
+#include <sstream>
+/** RefFrame *******
+ * An instance of this class is created for each frame in the system.
+ * This class natively handles the relationship between frames.
+ *
+ * The derived class Quaternion3D provides a buffered history of positions
+ * with interpolation.
+ */
+
class RefFrame: public Quaternion3D
{
public:
/* Constructor */
RefFrame();
-
-
+
/* Get the parent node */
inline unsigned int getParent(){return parent;};
@@ -60,6 +68,15 @@
};
+/*** Transform Reference ***********
+ * This class provides a simple interface to allow recording and lookup of
+ * relationships between arbitrary frames of the system.
+ *
+ * The positions of frames over time must be pushed in.
+ *
+ * It will provide interpolated positions out given a time argument.
+ */
+
class TransformReference
{
public:
@@ -87,7 +104,7 @@
// TransformReference::MaxDepthException
/* Debugging function that will print to std::cout the transformation matrix */
- void view(unsigned int target_frame, unsigned int source_frame);
+ std::string viewChain(unsigned int target_frame, unsigned int source_frame);
// Possible exceptions TransformReference::LookupException, TransformReference::ConnectivityException,
// TransformReference::MaxDepthException
Modified: pkg/trunk/libTF/simple/main.cc
===================================================================
--- pkg/trunk/libTF/simple/main.cc 2008-04-18 00:50:56 UTC (rev 127)
+++ pkg/trunk/libTF/simple/main.cc 2008-04-18 01:13:41 UTC (rev 128)
@@ -36,7 +36,7 @@
//Demonstrate InvalidFrame LookupException
try
{
- mTR.view(10,9);
+ std::cout<< mTR.viewChain(10,9);
}
catch (TransformReference::LookupException &ex)
{
@@ -46,7 +46,7 @@
// See the list of transforms to get between the frames
std::cout<<"Viewing (10,8):"<<std::endl;
- mTR.view(10,8);
+ std::cout << mTR.viewChain(10,8);
//See the resultant transform
@@ -62,7 +62,7 @@
mTR.set(6,7,dx,dy,dz,dyaw,dp,dr,atime);
try {
- mTR.view(10,8);
+ std::cout<<mTR.viewChain(10,8);
}
catch (TransformReference::MaxDepthException &ex)
{
@@ -73,7 +73,7 @@
mTR.set(6,0,dx,dy,dz,dyaw,dp,dr,atime);
try {
- mTR.view(10,8);
+ std::cout<<mTR.viewChain(10,8);
}
catch (TransformReference::ConnectivityException &ex)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|