00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef OXYGEN_JOINT_H
00023 #define OXYGEN_JOINT_H
00024
00025 #include "odeobject.h"
00026
00027 namespace oxygen
00028 {
00029 class Body;
00030
00049 class Joint : public ODEObject
00050 {
00051 public:
00052 enum EBodyIndex
00053 {
00054 BI_FIRST = 0,
00055 BI_SECOND = 1
00056 };
00057
00058 enum EAxisIndex
00059 {
00060 AI_FIRST = 0,
00061 AI_SECOND = 1,
00062 AI_THIRD = 2
00063 };
00064
00065 Joint();
00066 virtual ~Joint();
00067
00075 virtual void Attach(boost::shared_ptr<Body> body1,
00076 boost::shared_ptr<Body> body2);
00077
00082 void Attach(const std::string& path1, const std::string& path2);
00083
00087 boost::shared_ptr<Body> GetBody(EBodyIndex idx);
00088
00090 static boost::shared_ptr<Joint> GetJoint(dJointID id);
00091
00097 int GetType();
00098
00101 static bool AreConnected (boost::shared_ptr<Body> body1,
00102 boost::shared_ptr<Body> body2);
00103
00108 static bool AreConnectedExcluding (boost::shared_ptr<Body> body1,
00109 boost::shared_ptr<Body> body2,
00110 int joint_type);
00111
00119 void EnableFeedback(bool enable);
00120
00123 bool FeedBackEnabled();
00124
00128 salt::Vector3f GetFeedbackForce(EBodyIndex idx);
00129
00133 salt::Vector3f GetFeedbackTorque(EBodyIndex idx);
00134
00139 void SetBounce(EAxisIndex idx, float bounce);
00140
00142 float GetBounce(EAxisIndex idx);
00143
00147 void SetLowStopDeg(EAxisIndex idx, float deg);
00148
00150 float GetLowStopDeg(EAxisIndex idx);
00151
00155 void SetHighStopDeg(EAxisIndex idx, float deg);
00156
00158 float GetHighStopDeg(EAxisIndex idx);
00159
00161 void SetLowStopPos(EAxisIndex idx, float deg);
00162
00164 float GetLowStopPos(EAxisIndex idx);
00165
00167 void SetHighStopPos(EAxisIndex idx, float deg);
00168
00170 float GetHighStopPos(EAxisIndex idx);
00171
00174 void SetCFM(EAxisIndex idx, float cfm);
00175
00178 float GetCFM(EAxisIndex idx);
00179
00186 void SetStopCFM(EAxisIndex idx, float cfm);
00187
00189 float GetStopCFM(EAxisIndex idx);
00190
00192 void SetStopERP(EAxisIndex idx, float erp);
00193
00195 float GetStopERP(EAxisIndex idx);
00196
00200 void SetSuspensionERP(EAxisIndex idx, float erp);
00201
00205 float GetSuspensionERP(EAxisIndex idx);
00206
00210 void SetSuspensionCFM(EAxisIndex idx, float cfm);
00211
00215 float GetSuspensionCFM(EAxisIndex idx);
00216
00218 void SetLinearMotorVelocity(EAxisIndex idx, float vel);
00219
00221 float GetLinearMotorVelocity(EAxisIndex idx);
00222
00224 void SetAngularMotorVelocity(EAxisIndex idx, float deg);
00225
00227 float GetAngularMotorVelocity(EAxisIndex idx);
00228
00234 void SetMaxMotorForce(EAxisIndex idx, float f);
00235
00239 float GetMaxMotorForce(EAxisIndex idx);
00240
00241 protected:
00243 virtual void OnLink();
00244
00246 boost::shared_ptr<Body> GetBody(const std::string& path);
00247
00249 virtual void SetParameter(int parameter, float value) = 0;
00250
00252 virtual float GetParameter(int parameter) = 0;
00253
00254 protected:
00256 dJointID mODEJoint;
00257
00259 boost::shared_ptr<dJointFeedback> mFeedback;
00260 };
00261
00262 DECLARE_ABSTRACTCLASS(Joint);
00263
00264 }
00265
00266 #endif // OXYGEN_JOINT_H