/* *_________________________________________________________________________* * POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE * * DESCRIPTION: SEE READ-ME * * FILE NAME: joint.cpp * * AUTHORS: See Author List * * GRANTS: See Grants List * * COPYRIGHT: (C) 2005 by Authors as listed in Author's List * * LICENSE: Please see License Agreement * * DOWNLOAD: Free at www.rpi.edu/~anderk5 * * ADMINISTRATOR: Prof. Kurt Anderson * * Computational Dynamics Lab * * Rensselaer Polytechnic Institute * * 110 8th St. Troy NY 12180 * * CONTACT: anderk5@rpi.edu * *_________________________________________________________________________*/ #include "joints.h" #include "body.h" #include "point.h" #include #include "matrixfun.h" #include "fastmatrixops.h" #include using namespace std; Joint::Joint(){ body1 = body2 = 0; point1 = point2 = 0; pk_C_ko.Identity(); pk_C_k.Identity(); } Joint::~Joint(){ } void Joint::SetBodies(Body* b1, Body* b2){ body1 = b1; body2 = b2; } void Joint::SetPoints(Point* p1, Point* p2){ point1 = p1; point2 = p2; } int Joint::GetBodyID1(){ return body1->GetID(); } int Joint::GetBodyID2(){ return body2->GetID(); } int Joint::GetPointID1(){ return point1->GetID(); } int Joint::GetPointID2(){ return point2->GetID(); } bool Joint::ReadIn(std::istream& in){ in >>setprecision(20)>> qo >> setprecision(20)>>qdoto >> setprecision(20)>>pk_C_ko; q = qo; qdot = qdoto; EP_Normalize(q); return ReadInJointData(in); } void Joint::ResetQdot(){ //EP_Derivatives(q,u,qdot); qdot_to_u(q,u,qdot); } void Joint::ResetQ(){ EP_Normalize(q); } void Joint::SetInitialState(ColMatrix& a, ColMatrix& adot){ if( (qo.GetNumRows() != a.GetNumRows()) || (qdoto.GetNumRows() != adot.GetNumRows()) ){ cout<n_C_k = body1->n_C_k * pk_C_k; FastMult(body1->n_C_k,pk_C_k,body2->n_C_k); } void Joint::ComputeBackwardGlobalTransform(){ // body1->n_C_k = body2->n_C_k * T(pk_C_k); FastMultT(body2->n_C_k,pk_C_k,body1->n_C_k); } // // global joint functions // Joint* NewJoint(int type){ switch( JointType(type) ) { case FREEBODYJOINT : return new FreeBodyJoint; case REVOLUTEJOINT : return new RevoluteJoint; case PRISMATICJOINT : return new PrismaticJoint; case SPHERICALJOINT : return new SphericalJoint; case BODY23JOINT : return new Body23Joint; case MIXEDJOINT : return new MixedJoint; default : return 0; // error } }