|
From: <tf...@us...> - 2008-04-17 23:52:02
|
Revision: 122
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=122&view=rev
Author: tfoote
Date: 2008-04-17 16:52:04 -0700 (Thu, 17 Apr 2008)
Log Message:
-----------
overloading << operator and adding const correctness checking
Modified Paths:
--------------
pkg/trunk/libTF/simple/Quaternion3D.cc
pkg/trunk/libTF/simple/Quaternion3D.hh
Modified: pkg/trunk/libTF/simple/Quaternion3D.cc
===================================================================
--- pkg/trunk/libTF/simple/Quaternion3D.cc 2008-04-17 23:37:45 UTC (rev 121)
+++ pkg/trunk/libTF/simple/Quaternion3D.cc 2008-04-17 23:52:04 UTC (rev 122)
@@ -238,14 +238,22 @@
return mystream;
};
+Quaternion3D::Quaternion3DStorage Quaternion3D::asQuaternion(unsigned long long time)
+{
+ Quaternion3DStorage temp;
+ long long diff_time; //todo Find a way to use this offset. pass storage by reference and return diff_time??
+ getValue(temp, time, diff_time);
+ return temp;
+};
+
NEWMAT::Matrix Quaternion3D::asMatrix(unsigned long long time)
{
Quaternion3DStorage temp;
long long diff_time;
getValue(temp, time, diff_time);
- std::cout << temp;
+ // std::cout << temp;
// printStorage(temp);
// std::cout <<"Locally: "<< xt <<", "<< yt <<", "<< zt <<", "<< xr <<", "<<yr <<", "<<zr <<", "<<w<<std::endl;
//std::cout << "time Difference: "<< diff_time<<std::endl;
Modified: pkg/trunk/libTF/simple/Quaternion3D.hh
===================================================================
--- pkg/trunk/libTF/simple/Quaternion3D.hh 2008-04-17 23:37:45 UTC (rev 121)
+++ pkg/trunk/libTF/simple/Quaternion3D.hh 2008-04-17 23:52:04 UTC (rev 122)
@@ -57,11 +57,17 @@
class Quaternion3DStorage
{
public:
+
+ /** Unary operators preserve timestamps
+ * Binary operators destroy timestamps */
+
// Utility functions to normalize and get magnitude.
void Normalize();
double getMagnitude();
Quaternion3DStorage & operator=(const Quaternion3DStorage & input);
-
+
+
+ /* Internal Data */
double xt, yt, zt, xr, yr, zr, w;
unsigned long long time;
};
@@ -90,13 +96,14 @@
double pitch, double roll);
- /** Accessors **/
+ /** Interpolated Accessors **/
// Return a Matrix
+ Quaternion3D::Quaternion3DStorage asQuaternion(unsigned long long time);
NEWMAT::Matrix asMatrix(unsigned long long time);
//Print as a matrix
- void printMatrix(unsigned long long time);
- void printStorage(const Quaternion3DStorage &storage);
+ void printMatrix(unsigned long long time); //Not a critical part either
+ void printStorage(const Quaternion3DStorage &storage); //Do i need this now that i've got the ostream method??
// this is a function to return the current time in microseconds from the beginning of 1970
static unsigned long long Qgettime(void);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|