|
From: <tf...@us...> - 2008-04-26 00:37:08
|
Revision: 182
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=182&view=rev
Author: tfoote
Date: 2008-04-25 17:37:15 -0700 (Fri, 25 Apr 2008)
Log Message:
-----------
moving gettime out of quaternion into wrapper as per ticket:19 Also cleaning up things like giving it a datatype ULLtime which is typedefed to ULL, but it makes headers clearer.
Modified Paths:
--------------
pkg/trunk/libTF/doc/libTF_Manual.tex
pkg/trunk/libTF/include/libTF/Quaternion3D.h
pkg/trunk/libTF/include/libTF/libTF.h
pkg/trunk/libTF/src/simple/Quaternion3D.cpp
pkg/trunk/libTF/src/simple/libTF.cpp
pkg/trunk/libTF/src/test/main.cpp
Modified: pkg/trunk/libTF/doc/libTF_Manual.tex
===================================================================
--- pkg/trunk/libTF/doc/libTF_Manual.tex 2008-04-26 00:20:57 UTC (rev 181)
+++ pkg/trunk/libTF/doc/libTF_Manual.tex 2008-04-26 00:37:15 UTC (rev 182)
@@ -191,7 +191,7 @@
dx = dy= dz = 0;
dyaw = dp = dr = 0.1;
- unsigned long long atime = Quaternion3D::Qgettime();
+ unsigned long long atime = mTR.gettime();
//Fill in some transforms
Modified: pkg/trunk/libTF/include/libTF/Quaternion3D.h
===================================================================
--- pkg/trunk/libTF/include/libTF/Quaternion3D.h 2008-04-26 00:20:57 UTC (rev 181)
+++ pkg/trunk/libTF/include/libTF/Quaternion3D.h 2008-04-26 00:37:15 UTC (rev 182)
@@ -98,10 +98,6 @@
// Return the inverse matrix
NEWMAT::Matrix getInverseMatrix(unsigned long long time);
- /**** Utility Functions ****/
- // this is a function to return the current time in nanooseconds from the beginning of 1970
- static unsigned long long Qgettime(void);
-
// Convert DH Parameters to a Homogeneous Transformation Matrix
static NEWMAT::Matrix matrixFromDH(double length, double alpha, double offset, double theta);
// Convert Euler Angles to a Homogeneous Transformation Matrix
Modified: pkg/trunk/libTF/include/libTF/libTF.h
===================================================================
--- pkg/trunk/libTF/include/libTF/libTF.h 2008-04-26 00:20:57 UTC (rev 181)
+++ pkg/trunk/libTF/include/libTF/libTF.h 2008-04-26 00:37:15 UTC (rev 182)
@@ -88,22 +88,24 @@
static const unsigned int MAX_NUM_FRAMES = 100; /* The maximum number of frames possible */
static const unsigned int MAX_GRAPH_DEPTH = 100; /* The maximum number of times to descent before determining that graph has a loop. */
+ typedef unsigned long long ULLtime;
+
/* Constructor */
TransformReference();
/********** Mutators **************/
/* Set a new frame or update an old one. */
/* Use Euler Angles. X forward, Y to the left, Z up, Yaw about Z, pitch about new Y, Roll about new X */
- void setWithEulers(unsigned int framid, unsigned int parentid, double x, double y, double z, double yaw, double pitch, double roll, unsigned long long time);
+ void setWithEulers(unsigned int framid, unsigned int parentid, double x, double y, double z, double yaw, double pitch, double roll, ULLtime time);
/* Using DH Parameters */
// Conventions from http://en.wikipedia.org/wiki/Robotics_conventions
- void setWithDH(unsigned int framid, unsigned int parentid, double length, double alpha, double offset, double theta, unsigned long long time);
+ void setWithDH(unsigned int framid, unsigned int parentid, double length, double alpha, double offset, double theta, ULLtime time);
// Possible exceptions TransformReference::LookupException
/*********** Accessors *************/
/* Get the transform between two frames by frame ID. */
- NEWMAT::Matrix getMatrix(unsigned int target_frame, unsigned int source_frame, unsigned long long time);
+ NEWMAT::Matrix getMatrix(unsigned int target_frame, unsigned int source_frame, ULLtime time);
// Possible exceptions TransformReference::LookupException, TransformReference::ConnectivityException,
// TransformReference::MaxDepthException
@@ -114,9 +116,13 @@
+ /**** Utility Functions ****/
+ // this is a function to return the current time in nanooseconds from the beginning of 1970
+ static ULLtime gettime(void);
+
/************ Possible Exceptions ****************************/
/* An exception class to notify of bad frame number */
@@ -166,7 +172,7 @@
TransformLists lookUpList(unsigned int target_frame, unsigned int source_frame);
/* Compute the transform based on the list of frames */
- NEWMAT::Matrix computeTransformFromList(TransformLists list, unsigned long long time);
+ NEWMAT::Matrix computeTransformFromList(TransformLists list, ULLtime time);
};
#endif //LIBTF_HH
Modified: pkg/trunk/libTF/src/simple/Quaternion3D.cpp
===================================================================
--- pkg/trunk/libTF/src/simple/Quaternion3D.cpp 2008-04-26 00:20:57 UTC (rev 181)
+++ pkg/trunk/libTF/src/simple/Quaternion3D.cpp 2008-04-26 00:37:15 UTC (rev 182)
@@ -312,14 +312,6 @@
};
-unsigned long long Quaternion3D::Qgettime()
-{
- timeval temp_time_struct;
- gettimeofday(&temp_time_struct,NULL);
- return temp_time_struct.tv_sec * 1000000000ULL + (unsigned long long)temp_time_struct.tv_usec * 1000ULL;
-}
-
-
bool Quaternion3D::getValue(Quaternion3DStorage& buff, unsigned long long time, long long &time_diff)
{
Quaternion3DStorage p_temp_1;
Modified: pkg/trunk/libTF/src/simple/libTF.cpp
===================================================================
--- pkg/trunk/libTF/src/simple/libTF.cpp 2008-04-26 00:20:57 UTC (rev 181)
+++ pkg/trunk/libTF/src/simple/libTF.cpp 2008-04-26 00:37:15 UTC (rev 182)
@@ -51,7 +51,7 @@
}
-void TransformReference::setWithEulers(unsigned int frameID, unsigned int parentID, double a,double b,double c,double d,double e,double f, unsigned long long time)
+void TransformReference::setWithEulers(unsigned int frameID, unsigned int parentID, double a,double b,double c,double d,double e,double f, ULLtime time)
{
if (frameID > MAX_NUM_FRAMES || parentID > MAX_NUM_FRAMES || frameID == NO_PARENT || frameID == ROOT_FRAME)
throw InvalidFrame;
@@ -63,7 +63,7 @@
getFrame(frameID)->fromEuler(a,b,c,d,e,f,time);
}
-void TransformReference::setWithDH(unsigned int frameID, unsigned int parentID, double a,double b,double c,double d, unsigned long long time)
+void TransformReference::setWithDH(unsigned int frameID, unsigned int parentID, double a,double b,double c,double d, ULLtime time)
{
if (frameID > MAX_NUM_FRAMES || parentID > MAX_NUM_FRAMES || frameID == NO_PARENT || frameID == ROOT_FRAME)
throw InvalidFrame;
@@ -76,7 +76,7 @@
}
-NEWMAT::Matrix TransformReference::getMatrix(unsigned int target_frame, unsigned int source_frame, unsigned long long time)
+NEWMAT::Matrix TransformReference::getMatrix(unsigned int target_frame, unsigned int source_frame, ULLtime time)
{
NEWMAT::Matrix myMat(4,4);
TransformLists lists = lookUpList(target_frame, source_frame);
@@ -149,7 +149,7 @@
}
-NEWMAT::Matrix TransformReference::computeTransformFromList(TransformLists lists, unsigned long long time)
+NEWMAT::Matrix TransformReference::computeTransformFromList(TransformLists lists, ULLtime time)
{
NEWMAT::Matrix retMat(4,4);
retMat << 1 << 0 << 0 << 0
@@ -194,3 +194,11 @@
mstream << std::endl;
return mstream.str();
}
+
+TransformReference::ULLtime TransformReference::gettime()
+{
+ timeval temp_time_struct;
+ gettimeofday(&temp_time_struct,NULL);
+ return temp_time_struct.tv_sec * 1000000000ULL + (unsigned long long)temp_time_struct.tv_usec * 1000ULL;
+}
+
Modified: pkg/trunk/libTF/src/test/main.cpp
===================================================================
--- pkg/trunk/libTF/src/test/main.cpp 2008-04-26 00:20:57 UTC (rev 181)
+++ pkg/trunk/libTF/src/test/main.cpp 2008-04-26 00:37:15 UTC (rev 182)
@@ -13,7 +13,7 @@
dx = dy= dz = 0;
dyaw = dp = dr = 0.1;
- unsigned long long atime = Quaternion3D::Qgettime();
+ unsigned long long atime = mTR.gettime();
//Fill in some transforms
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|