29 #include "taoDJoint.h"
30 #include "taoABJoint.h"
33 #include <tao/matrix/TaoDeMath.h>
48 taoJoint() : _type(scl::JOINT_TYPE_NOTASSIGNED), _clamp_dQ(0), _max_dQ(5), _damping(0), _inertia(0), _var(NULL),
_next(NULL) {}
51 virtual deInt getDOF() = 0;
52 virtual void reset() = 0;
54 virtual void setDVar(
taoDVar* var) { _var = var; }
55 virtual taoDVar* getDVar() {
return _var; }
56 virtual taoDVar const * getDVar()
const {
return _var; }
61 virtual void setABJoint(
taoABJoint* joint) = 0;
63 virtual taoABJoint const * getABJoint()
const = 0;
65 void setDQclamp(deInt b) { _clamp_dQ = b; }
66 deInt getDQclamp() {
return _clamp_dQ; }
71 virtual void setDQmax(deFloat dq) { _max_dQ = dq; }
72 virtual deFloat getDQmax() {
return _max_dQ; }
74 virtual void setDamping(deFloat d) { _damping = d; }
75 virtual deFloat getDamping() {
return _damping; }
77 virtual void setInertia(deFloat i) { _inertia = i; }
78 virtual deFloat getInertia() {
return _inertia; }
80 virtual void clampDQ() = 0;
81 virtual void integrate(
const deFloat dt) = 0;
82 virtual void updateFrameLocal(
deFrame* local) = 0;
85 virtual void setTau(
const deFloat* v) = 0;
86 virtual void zeroTau() = 0;
89 virtual void setDDQ(
const deFloat* v) = 0;
90 virtual void zeroDDQ() = 0;
93 virtual void setDQ(
const deFloat* v) = 0;
94 virtual void zeroDQ() = 0;
97 virtual void setQ(
const deFloat* v) = 0;
98 virtual void zeroQ() = 0;
101 virtual void getTau(deFloat* v)
const = 0;
104 virtual void getDDQ(deFloat* v)
const = 0;
107 virtual void getDQ(deFloat* v)
const = 0;
110 virtual void getQ(deFloat* v)
const = 0;
157 virtual deInt getDOF() {
return 3; }
158 virtual void reset();
168 std::cout <<
"\ntaoJointPrismatic::setABJoint(): Incorrect joint type passed. Can't set ABJoint";
171 if(NULL== _abJoint) {
delete _abJoint; }
175 virtual taoABJoint* getABJoint(){
return _abJoint; }
176 virtual taoABJoint const * getABJoint()
const {
return _abJoint; }
179 virtual void addDQdelta();
180 virtual void zeroTau() { getVarSpherical()->
force_gc_.
zero(); }
181 virtual void zeroDDQ() { getVarSpherical()->
ddq_.
zero(); }
186 virtual void setDQ(
const deFloat* v) { getVarSpherical()->
dq_.
set(v); }
190 virtual void getDQ(deFloat* v)
const { getVarSpherical()->
dq_.
get(v); }
191 virtual void getQ(deFloat* v)
const {
deQuaternion const & q = getVarSpherical()->
q_quat_; v[0] = q[0]; v[1] = q[1]; v[2] = q[2]; v[3] = q[3]; }
193 virtual void clampDQ();
194 virtual void integrate(
const deFloat dt);
260 taoJointType getJointType()
const {
return _axis; }
261 virtual deInt getDOF() {
return 1; }
267 getVarDOF1()->
q_ = 0;
268 getVarDOF1()->
dq_ = 0;
269 getVarDOF1()->
ddq_ = 0;
270 getVarDOF1()->
tau_ = 0;
276 virtual void addQdelta() { getVarDOF1()->
q_ += getVarDOF1()->
ddq_; }
277 virtual void addDQdelta() { getVarDOF1()->
dq_ += getVarDOF1()->
ddq_;
if (getDQclamp()) clampDQ(); }
278 virtual void zeroTau() { getVarDOF1()->
tau_ = 0; }
279 virtual void zeroDDQ() { getVarDOF1()->
ddq_ = 0; }
280 virtual void zeroDQ() { getVarDOF1()->
dq_ = 0; }
281 virtual void zeroQ() { getVarDOF1()->
q_ = 0; }
283 virtual void setTau(
const deFloat* v) { getVarDOF1()->
tau_ = *v; }
284 virtual void setDDQ(
const deFloat* v) { getVarDOF1()->
ddq_ = *v; }
285 virtual void setDQ(
const deFloat* v) { getVarDOF1()->
dq_ = *v; }
286 virtual void setQ(
const deFloat* v) { getVarDOF1()->
q_ = *v; }
287 virtual void getTau(deFloat* v)
const { *v = getVarDOF1()->
tau_; }
288 virtual void getDDQ(deFloat* v)
const { *v = getVarDOF1()->
ddq_; }
289 virtual void getDQ(deFloat* v)
const { *v = getVarDOF1()->
dq_; }
290 virtual void getQ(deFloat* v)
const { *v = getVarDOF1()->
q_; }
292 virtual void clampDQ();
293 virtual void integrate(
const deFloat dt);
327 virtual void updateFrameLocal(
deFrame* local)
335 std::cout <<
"\ntaoJointPrismatic::setABJoint(): Incorrect joint type passed. Can't set ABJoint";
338 if(NULL== _abJoint) {
delete _abJoint; }
342 virtual taoABJoint* getABJoint(){
return _abJoint; }
343 virtual taoABJoint const * getABJoint()
const {
return _abJoint; }
360 virtual void updateFrameLocal(
deFrame* local)
362 local->
rotation().
set(getJointType(), getVarDOF1()->q_);
370 std::cout <<
"\ntaoJointPrismatic::setABJoint(): Incorrect joint type passed. Can't set ABJoint";
373 if(NULL== _abJoint) {
delete _abJoint; }
377 virtual taoABJoint* getABJoint(){
return _abJoint; }
378 virtual taoABJoint const * getABJoint()
const {
return _abJoint; }
400 if(NULL== _abJoint) {
delete _abJoint; }
404 virtual taoABJoint* getABJoint(){
return _abJoint; }
405 virtual taoABJoint const * getABJoint()
const {
return _abJoint; }
411 #endif // _taoJoint_h
virtual void getQ(deFloat *v) const
Definition: taoJoint.h:191
deQuaternion q_quat_
joint position
Definition: taoVar.h:71
1-DOF joint variable class for articulated bodyThis provides joint variables necessary for articulate...
Definition: taoVar.h:53
abstract joint class for articulated bodyThis class should be used as a base class and implemented ac...
Definition: taoDJoint.h:43
Definition: taoABJoint.h:285
virtual void getJgColumns(deVector6 *Jg_columns) const =0
virtual void setTau(const deFloat *v)
Definition: taoJoint.h:283
virtual void getDQ(deFloat *v) const
Definition: taoJoint.h:289
virtual void setTau(const deFloat *v)=0
deFloat dq_
joint velocity
Definition: taoVar.h:57
virtual void setDDQ(const deFloat *v)
Definition: taoJoint.h:185
deQuaternion & rotation()
Definition: TaoDeFrame.h:49
deVector3 dq_rotated_
joint velocity in reference (parent) frame
Definition: taoVar.h:75
User defined joint class for articulated bodyThis provides a user defined joint for articulated body ...
Definition: taoJoint.h:391
virtual void getDDQ(deFloat *v) const =0
virtual void setDQ(const deFloat *v)
Definition: taoJoint.h:186
virtual void setTau(const deFloat *v)
Definition: taoJoint.h:184
Articulated body joint classThis class provides joint for articulated body.
Definition: taoABJoint.h:45
deFloat q_
joint position
Definition: taoVar.h:56
deFloat ddq_
joint acceleration
Definition: taoVar.h:58
virtual void getTau(deFloat *v) const
Definition: taoJoint.h:287
6x1 vector classThis class consists of two 3x1 vectors.
Definition: TaoDeVector6.h:33
spherical joint variable class for articulated bodyThis provides joint variables necessary for articu...
Definition: taoVar.h:68
virtual ~taoJoint()
Definition: taoJoint.cpp:29
deVector3 ddq_
joint acceleration
Definition: taoVar.h:73
virtual void setDQ(const deFloat *v)=0
1 DOF joint class for articulated bodyThis provides a 1-DOF joint for articulated body dynamics ...
Definition: taoJoint.h:255
deFloat tau_
joint force (torque)
Definition: taoVar.h:59
DE_MATH_API void get(deFloat *v) const
[x y z] = this
Definition: TaoDeVector3Inl.h:42
virtual void setDQ(const deFloat *v)
Definition: taoJoint.h:285
virtual void getTau(deFloat *v) const
Definition: taoJoint.h:188
virtual void getJgColumns(deVector6 *Jg_columns) const
Definition: taoJoint.cpp:146
Quaternion classThis is a C++ wrapper class of deQuaternionf.
Definition: TaoDeQuaternion.h:35
virtual void setQ(const deFloat *v)
Definition: taoJoint.h:286
DE_MATH_API void set(const deFloat x, const deFloat y, const deFloat z)
this = (x, y, z)
Definition: TaoDeVector3Inl.h:40
virtual void getJgColumns(deVector6 *Jg_columns) const
Definition: taoJoint.cpp:127
Transformation class using quaternionThis class consists of a quaternion for rotation and a vector fo...
Definition: TaoDeFrame.h:36
virtual void setQ(const deFloat *v)=0
abstract joint variable class for articulated bodyThis class should be used as a base class and imple...
Definition: taoVar.h:42
virtual deMatrix3 * getJg()
Definition: taoJoint.cpp:122
Prismatic joint class for articulated bodyThis provides a prismatic joint for articulated body dynami...
Definition: taoJoint.h:323
deVector3 & translation()
Definition: TaoDeFrame.h:53
Revolute joint class for articulated bodyThis provides a revolute joint for articulated body dynamics...
Definition: taoJoint.h:356
virtual void getQ(deFloat *v) const =0
deVector3 force_gc_
joint force (torque)
Definition: taoVar.h:74
Base joint class for articulated bodyThis provides a joint for articulated body dynamics.
Definition: taoJoint.h:45
virtual void setQ(const deFloat *v)
Definition: taoJoint.h:187
virtual void getDQ(deFloat *v) const
Definition: taoJoint.h:190
DE_MATH_API void identity()
this = (0, 0, 0, 1)
Definition: TaoDeQuaternionInl.h:33
virtual void getDQ(deFloat *v) const =0
Spherical joint class for articulated bodyThis provides a spherical joint for articulated body dynami...
Definition: taoJoint.h:152
virtual void setDDQ(const deFloat *v)
Definition: taoJoint.h:284
virtual void getDDQ(deFloat *v) const
Definition: taoJoint.h:288
3x3 matrix classThis is a C++ wrapper class of deMatrix3f.
Definition: TaoDeMatrix3.h:33
virtual void addQdelta()
Definition: taoJoint.cpp:50
virtual void getDDQ(deFloat *v) const
Definition: taoJoint.h:189
EJointType
Definition: DataTypes.hpp:110
Definition: taoABJoint.h:171
virtual deVector6 & getJg() const
Definition: taoJoint.cpp:141
deVector3 dq_
joint velocity in local frame
Definition: taoVar.h:72
virtual void getTau(deFloat *v) const =0
virtual void setDDQ(const deFloat *v)=0
virtual void getQ(deFloat *v) const
Definition: taoJoint.h:290
taoJoint * _next
Definition: taoJoint.h:142
DE_MATH_API void zero()
this = 0
Definition: TaoDeVector3Inl.h:38
DE_MATH_API void set(const deMatrix3 &m)
this = m
Definition: TaoDeQuaternionInl.h:37
Definition: taoABJoint.h:264