00001 #ifndef ARTICULATEDLINK_H 00002 #define ARTICULATEDLINK_H 00003 00004 #include "ArticulatedComponent.h" 00005 00006 00007 class Simulator; 00008 00010 const real DEFAULT_K=(real)0.01; //0.01 00012 const real DEFAULT_ETA=(real)0.15; 00013 00014 00015 class ArticulatedLimb; 00016 00017 class ArticulatedLink; 00018 typedef std::vector<ArticulatedLink*> ArticulatedLinkPVector; 00019 00020 00024 class ArticulatedLink : public ArticulatedComponent { 00025 public: 00026 ArticulatedLink(const std::string &label); 00027 virtual ~ArticulatedLink(); 00028 00031 void computeForceQuasistatic(GlobalContactInfoVector* globalContacts); 00032 00034 void normalizeTheta(); 00035 00037 void computeSinCos(); 00038 00041 void integrate(const Integrator &integrator); 00042 00044 void rollback(){ 00045 theta=thetaOld; 00046 ComposedPhysicalObject::rollback(); 00047 } 00048 00049 00052 bool hasElasticTorque; 00053 00055 void computeMotorTorque(); 00056 00057 void setParentLink(ArticulatedLink* parentLink); 00058 00061 void fillContactMatrix(ContactSolver* contactSolver, ContactInfo* contactInfo) { 00062 } 00063 00064 ContactInfo* torqueContact; 00065 void deleteContacts(){ 00066 PhysicalObject::deleteContacts(); 00067 if(torqueContact!=NULL){ 00068 delete torqueContact; 00069 torqueContact=NULL; 00070 } 00071 force.setToZero(); 00072 } 00073 00074 void detectTorqueContact(GlobalContactInfoVector* contacts); 00075 00076 void draw(GUI *gui); 00077 00079 real totalTorque; 00081 Vector2 force; 00083 Vector2 forceLocal; 00085 Vector2 totalForce; 00086 00089 real theta; 00090 real thetaOld; 00091 00093 real sinTheta, cosTheta, sin2, cos2, sinCos; 00094 00096 Vector3 coriolis; 00097 00099 real thetaD; 00100 00101 real thetaDD; 00102 00104 real theta0; 00106 real theta0Min, theta0Max; 00108 real deltaThetaMax; 00110 real motorTorque; 00111 00113 real k; 00115 real eta; 00116 00118 real l; 00119 00121 ArticulatedLink* parentLink; 00122 00125 ArticulatedLinkPVector childLinks; 00126 }; 00127 00128 00129 00130 00131 #endif //ARTICULATEDLINK_H
Thyrix homepage Users' guide
(C) Arxia 2004-2005