[Opal-commits] opal/src BlueprintManager.cpp,1.33,1.34 SpringMotor.cpp,1.10,1.11 SpringMotor.h,1.12,
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-03-23 04:53:02
|
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21909/src Modified Files: BlueprintManager.cpp SpringMotor.cpp SpringMotor.h SpringMotorData.h Log Message: added an 'attachOffset' point option to the spring motor which allows the spring to be attached to a solid at a point offset from the solid's center Index: SpringMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/SpringMotor.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SpringMotor.cpp 23 Mar 2005 04:04:31 -0000 1.10 --- SpringMotor.cpp 23 Mar 2005 04:52:36 -0000 1.11 *************** *** 41,51 **** } - //void SpringMotor::init(Mode m, Solid* s) - //{ - // Motor::init(); - // mSolid = s; - // mMode = m; - //} - void SpringMotor::init(const SpringMotorData& data) { --- 41,44 ---- *************** *** 102,106 **** Force f; f.singleStep = true; ! f.type = GLOBAL_FORCE; f.vec = mData.linearKs * error - mData.linearKd * mData.solid->getGlobalLinearVel(); --- 95,100 ---- Force f; f.singleStep = true; ! f.type = GLOBAL_FORCE_AT_LOCAL_POS; ! f.pos = mData.attachOffset; f.vec = mData.linearKs * error - mData.linearKd * mData.solid->getGlobalLinearVel(); *************** *** 176,179 **** --- 170,183 ---- } + void SpringMotor::setAttachOffset(const Point3r& offset) + { + mData.attachOffset = offset; + } + + const Point3r& SpringMotor::getAttachOffset()const + { + return mData.attachOffset; + } + void SpringMotor::setDesiredTransform(const Matrix44r& transform) { Index: SpringMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/SpringMotor.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SpringMotor.h 23 Mar 2005 04:04:31 -0000 1.12 --- SpringMotor.h 23 Mar 2005 04:52:36 -0000 1.13 *************** *** 69,72 **** --- 69,79 ---- virtual void OPAL_CALL setEnabled(bool e); + /// Sets the spring's attach point on the Solid. This is a local + // offset point from the Solid's position. + virtual void OPAL_CALL setAttachOffset(const Point3r& offset); + + /// Returns the spring's attach point on the Solid. + virtual const Point3r& OPAL_CALL getAttachOffset()const; + /// Sets the desired position and orientation. virtual void OPAL_CALL setDesiredTransform(const Matrix44r& transform); Index: BlueprintManager.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/BlueprintManager.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** BlueprintManager.cpp 14 Mar 2005 22:36:31 -0000 1.33 --- BlueprintManager.cpp 23 Mar 2005 04:52:26 -0000 1.34 *************** *** 982,985 **** --- 982,995 ---- } + // Load AttachOffset element if it exists. + paramNodePtr = + const_cast<TiXmlNode*>(nodePtr)->FirstChild("AttachOffset"); + if (NULL != paramNodePtr) + { + data->attachOffset[0] = getAttributeReal(paramNodePtr, "x"); + data->attachOffset[1] = getAttributeReal(paramNodePtr, "y"); + data->attachOffset[2] = getAttributeReal(paramNodePtr, "z"); + } + // Load DesiredPos element if it exists. paramNodePtr = Index: SpringMotorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/SpringMotorData.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SpringMotorData.h 11 Mar 2005 05:31:56 -0000 1.4 --- SpringMotorData.h 23 Mar 2005 04:52:36 -0000 1.5 *************** *** 60,63 **** --- 60,64 ---- internal_solidName = ""; mode = LINEAR_MODE; + // "attachOffset" is initialized in its own constructor. // "desiredPos" is initialized in its own constructor. desiredForward = defaults::motor::spring::desiredForward; *************** *** 91,94 **** --- 92,96 ---- internal_solidName = data.internal_solidName; mode = data.mode; + attachOffset = data.attachOffset; desiredPos = data.desiredPos; desiredForward = data.desiredForward; *************** *** 113,116 **** --- 115,123 ---- SpringMotorMode mode; + /// Local offset (relative to the Solid's position) that defines + /// where the SpringMotor attaches to the Solid. This is only + /// used in linear mode. + Point3r attachOffset; + /// The Motor's desired position. This is only used if the /// appropriate mode is set. |