|
From: <tf...@us...> - 2008-04-28 14:06:08
|
Revision: 209
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=209&view=rev
Author: tfoote
Date: 2008-04-28 07:05:55 -0700 (Mon, 28 Apr 2008)
Log Message:
-----------
history of transforms destroyed when parent frame is changes ticket:18.
Modified Paths:
--------------
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/test/main.cpp
Modified: pkg/trunk/libTF/include/libTF/Quaternion3D.h
===================================================================
--- pkg/trunk/libTF/include/libTF/Quaternion3D.h 2008-04-28 04:57:01 UTC (rev 208)
+++ pkg/trunk/libTF/include/libTF/Quaternion3D.h 2008-04-28 14:05:55 UTC (rev 209)
@@ -108,6 +108,9 @@
//Print as a matrix
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??
+
+ // Remove all nodes from the list
+ void clearList();
private:
Modified: pkg/trunk/libTF/include/libTF/libTF.h
===================================================================
--- pkg/trunk/libTF/include/libTF/libTF.h 2008-04-28 04:57:01 UTC (rev 208)
+++ pkg/trunk/libTF/include/libTF/libTF.h 2008-04-28 14:05:55 UTC (rev 209)
@@ -60,8 +60,10 @@
/* Get the parent node */
inline unsigned int getParent(){return parent;};
- /* Return tha parent node */
- inline void setParent(unsigned int parentID){parent = parentID;};
+ /* Set the parent node
+ * return: false => change of parent, cleared history
+ * return: true => no change of parent */
+ inline bool setParent(unsigned int parentID){if (parent != parentID){parent = parentID; clearList(); return false;} return true;};
private:
/* Storage of the parent */
Modified: pkg/trunk/libTF/src/simple/Quaternion3D.cpp
===================================================================
--- pkg/trunk/libTF/src/simple/Quaternion3D.cpp 2008-04-28 04:57:01 UTC (rev 208)
+++ pkg/trunk/libTF/src/simple/Quaternion3D.cpp 2008-04-28 14:05:55 UTC (rev 209)
@@ -457,8 +457,26 @@
};
+void Quaternion3D::clearList()
+{
+ data_LL * p_current = first;
+ data_LL * p_last = NULL;
+ // Delete all nodes in list
+ while (p_current != NULL)
+ {
+ p_last = p_current;
+ p_current = p_current->next;
+ delete p_last;
+ }
+ //Clean up pointers
+ first = NULL;
+ last = NULL;
+
+};
+
+
int Quaternion3D::findClosest(Quaternion3DStorage& one, Quaternion3DStorage& two, const unsigned long long target_time, long long &time_diff)
{
Modified: pkg/trunk/libTF/src/test/main.cpp
===================================================================
--- pkg/trunk/libTF/src/test/main.cpp 2008-04-28 04:57:01 UTC (rev 208)
+++ pkg/trunk/libTF/src/test/main.cpp 2008-04-28 14:05:55 UTC (rev 209)
@@ -79,6 +79,9 @@
{
std::cout <<"caught unconnected frame"<<std::endl;
}
+
+ //Testing clearing the history with parent change
+ mTR.setWithEulers(7,5,1,1,1,dyaw,dp,dr,atime);
return 0;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|