|
From: <tf...@us...> - 2008-04-19 00:33:16
|
Revision: 143
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=143&view=rev
Author: tfoote
Date: 2008-04-18 17:33:20 -0700 (Fri, 18 Apr 2008)
Log Message:
-----------
cleaning up API, standardized DH param order, and getMatrix for get
Modified Paths:
--------------
pkg/trunk/libTF/simple/Quaternion3D.cc
pkg/trunk/libTF/simple/Quaternion3D.hh
pkg/trunk/libTF/simple/libTF.cc
pkg/trunk/libTF/simple/libTF.hh
pkg/trunk/libTF/simple/main.cc
Modified: pkg/trunk/libTF/simple/Quaternion3D.cc
===================================================================
--- pkg/trunk/libTF/simple/Quaternion3D.cc 2008-04-18 23:38:49 UTC (rev 142)
+++ pkg/trunk/libTF/simple/Quaternion3D.cc 2008-04-19 00:33:20 UTC (rev 143)
@@ -121,10 +121,9 @@
fromMatrix(matrixFromEuler(_x,_y,_z,_yaw,_pitch,_roll),time);
};
-void Quaternion3D::fromDH(double theta,
- double length, double distance, double alpha, unsigned long long time)
+void Quaternion3D::fromDH(double length, double alpha, double offset, double theta, unsigned long long time)
{
- fromMatrix(matrixFromDH(theta, length, distance, alpha),time);
+ fromMatrix(matrixFromDH(length, alpha, offset, theta),time);
};
@@ -167,8 +166,8 @@
// Math from http://en.wikipedia.org/wiki/Robotics_conventions
-NEWMAT::Matrix Quaternion3D::matrixFromDH(double theta,
- double length, double distance, double alpha)
+NEWMAT::Matrix Quaternion3D::matrixFromDH(double length,
+ double alpha, double offset, double theta)
{
NEWMAT::Matrix matrix(4,4);
@@ -182,15 +181,15 @@
matrix_pointer[0] = ct;
matrix_pointer[1] = -st*ca;
matrix_pointer[2] = st*sa;
- matrix_pointer[3] = distance * ct;
+ matrix_pointer[3] = length * ct;
matrix_pointer[4] = st;
matrix_pointer[5] = ct*ca;
matrix_pointer[6] = -ct*sa;
- matrix_pointer[7] = distance*st;
+ matrix_pointer[7] = length*st;
matrix_pointer[8] = 0;
matrix_pointer[9] = sa;
matrix_pointer[10] = ca;
- matrix_pointer[11] = length;
+ matrix_pointer[11] = offset;
matrix_pointer[12] = 0.0;
matrix_pointer[13] = 0.0;
matrix_pointer[14] = 0.0;
Modified: pkg/trunk/libTF/simple/Quaternion3D.hh
===================================================================
--- pkg/trunk/libTF/simple/Quaternion3D.hh 2008-04-18 23:38:49 UTC (rev 142)
+++ pkg/trunk/libTF/simple/Quaternion3D.hh 2008-04-19 00:33:20 UTC (rev 143)
@@ -39,7 +39,6 @@
#include <math.h>
#include <pthread.h>
#include <sys/time.h>
-
class Euler3D {
public:
//Constructor
@@ -87,7 +86,7 @@
// Set the values using Euler angles
void fromEuler(double _x, double _y, double _z, double _yaw, double _pitch, double _roll, unsigned long long time);
// Set the values using DH Parameters
- void fromDH(double theta, double length, double distance, double alpha, unsigned long long time);
+ void fromDH(double length, double alpha, double offset, double theta, unsigned long long time);
/** Interpolated Accessors **/
@@ -103,8 +102,7 @@
static unsigned long long Qgettime(void);
// Convert DH Parameters to a Homogeneous Transformation Matrix
- static NEWMAT::Matrix matrixFromDH(double theta,
- double length, double distance, double alpha);
+ static NEWMAT::Matrix matrixFromDH(double length, double alpha, double offset, double theta);
// Convert Euler Angles to a Homogeneous Transformation Matrix
static NEWMAT::Matrix matrixFromEuler(double ax,
double ay, double az, double yaw,
Modified: pkg/trunk/libTF/simple/libTF.cc
===================================================================
--- pkg/trunk/libTF/simple/libTF.cc 2008-04-18 23:38:49 UTC (rev 142)
+++ pkg/trunk/libTF/simple/libTF.cc 2008-04-19 00:33:20 UTC (rev 143)
@@ -76,7 +76,7 @@
}
-NEWMAT::Matrix TransformReference::get(unsigned int target_frame, unsigned int source_frame, unsigned long long time)
+NEWMAT::Matrix TransformReference::getMatrix(unsigned int target_frame, unsigned int source_frame, unsigned long long time)
{
NEWMAT::Matrix myMat(4,4);
TransformLists lists = lookUpList(target_frame, source_frame);
Modified: pkg/trunk/libTF/simple/libTF.hh
===================================================================
--- pkg/trunk/libTF/simple/libTF.hh 2008-04-18 23:38:49 UTC (rev 142)
+++ pkg/trunk/libTF/simple/libTF.hh 2008-04-19 00:33:20 UTC (rev 143)
@@ -38,9 +38,10 @@
#include <newmat/newmatio.h>
#include <math.h>
#include <vector>
-#include "Quaternion3D.hh"
#include <sstream>
+#include "Quaternion3D.hh"
+
/** RefFrame *******
* An instance of this class is created for each frame in the system.
* This class natively handles the relationship between frames.
@@ -92,14 +93,17 @@
/********** Mutators **************/
/* Set a new frame or update an old one. */
- void setWithEulers(unsigned int framid, unsigned int parentid, double,double,double,double,double,double,unsigned long long time);
- void setWithDH(unsigned int framid, unsigned int parentid, double,double,double,double,unsigned long long time);
+ /* 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);
+ /* 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);
// Possible exceptions TransformReference::LookupException
/*********** Accessors *************/
/* Get the transform between two frames by frame ID. */
- NEWMAT::Matrix get(unsigned int target_frame, unsigned int source_frame, unsigned long long time);
+ NEWMAT::Matrix getMatrix(unsigned int target_frame, unsigned int source_frame, unsigned long long time);
// Possible exceptions TransformReference::LookupException, TransformReference::ConnectivityException,
// TransformReference::MaxDepthException
Modified: pkg/trunk/libTF/simple/main.cc
===================================================================
--- pkg/trunk/libTF/simple/main.cc 2008-04-18 23:38:49 UTC (rev 142)
+++ pkg/trunk/libTF/simple/main.cc 2008-04-19 00:33:20 UTC (rev 143)
@@ -19,7 +19,7 @@
//Fill in some transforms
// mTR.setWithEulers(10,2,1,1,1,dyaw,dp,dr,atime); //Switching out for DH params below
- mTR.setWithDH(10,2,1,1,1,dyaw,atime);
+ mTR.setWithDH(10,2,1.0,1.0,1.0,dyaw,atime);
//mTR.setWithEulers(2,3,1-1,1,1,dyaw,dp,dr,atime-1000);
mTR.setWithEulers(2,3,1,1,1,dyaw,dp,dr,atime-100);
mTR.setWithEulers(2,3,1,1,1,dyaw,dp,dr,atime-50);
@@ -29,7 +29,7 @@
mTR.setWithEulers(5,1,dx,dy,dz,dyaw,dp,dr,atime);
mTR.setWithEulers(6,5,dx,dy,dz,dyaw,dp,dr,atime);
mTR.setWithEulers(7,6,1,1,1,dyaw,dp,dr,atime);
- mTR.setWithDH(8,7,1,1,1,dyaw,atime);
+ mTR.setWithDH(8,7,1.0,1.0,1.0,dyaw,atime);
//mTR.setWithEulers(8,7,1,1,1,dyaw,dp,dr,atime); //Switching out for DH params above
@@ -50,11 +50,11 @@
//See the resultant transform
- std::cout <<"Calling get(10,8)"<<std::endl;
- // NEWMAT::Matrix mat = mTR.get(1,1);
- NEWMAT::Matrix mat = mTR.get(10,8,atime);
+ std::cout <<"Calling getMatrix(10,8)"<<std::endl;
+ // NEWMAT::Matrix mat = mTR.getMatrix(1,1);
+ NEWMAT::Matrix mat = mTR.getMatrix(10,8,atime);
- std::cout << "Result of get(10,8,atime):" << std::endl << mat<< std::endl;
+ std::cout << "Result of getMatrix(10,8,atime):" << std::endl << mat<< std::endl;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|