27 abs_pos = parent->abs_pos + parent->abs_att * rel_pos;
28 abs_att = parent->abs_att * rel_att;
31 abs_pos.mul(parent->abs_att, rel_pos);
32 abs_pos += parent->abs_pos;
33 abs_att.mul(parent->abs_att, rel_att);
37 child->calc_position();
38 brother->calc_position();
52 t_rel_att.
tran(rel_att);
54 v1.
cross(parent->loc_ang_vel, rel_pos);
55 v2.
mul(t_rel_att, parent->loc_lin_vel);
56 loc_lin_vel.mul(t_rel_att, v1);
58 loc_lin_vel += rel_lin_vel;
60 loc_ang_vel.
mul(t_rel_att, parent->loc_ang_vel);
61 loc_ang_vel += rel_ang_vel;
63 v1.
cross(loc_ang_vel, loc_com);
64 loc_com_vel.add(loc_lin_vel, v1);
71 child->calc_velocity();
72 brother->calc_velocity();
85 static fVec3 v1, v2, v3, v4;
86 t_rel_att.
tran(rel_att);
88 v1.
mul(t_rel_att, parent->loc_ang_vel);
91 v2.
cross(v1, rel_lin_vel);
92 loc_lin_acc.add(rel_lin_acc, v2);
93 v2.
cross(parent->loc_ang_acc, rel_pos);
94 v1.
add(parent->loc_lin_acc, v2);
95 v2.
cross(parent->loc_ang_vel, rel_pos);
96 v3.
cross(parent->loc_ang_vel, v2);
98 v4.
mul(t_rel_att, v1);
102 v1.
cross(loc_ang_vel, rel_ang_vel);
103 loc_ang_acc.add(rel_ang_acc, v1);
104 v1.
mul(t_rel_att, parent->loc_ang_acc);
107 v1.
cross(loc_ang_acc, loc_com);
108 loc_com_acc.add(loc_lin_acc, v1);
109 v1.
cross(loc_ang_vel, loc_com);
110 v2.
cross(loc_ang_vel, v1);
125 child->calc_acceleration();
126 brother->calc_acceleration();
139 int is_target =
false;
147 if(my_chname && !strcmp(my_chname, chname))
155 double ret = brother->total_com(b_com, chname) + child->total_com(c_com, chname);
157 com.
add(b_com, c_com);
160 static fVec3 abs_com_pos, my_com;
162 abs_com_pos.
mul(abs_att, loc_com);
163 abs_com_pos += abs_pos;
164 my_com.
mul(abs_com_pos, mass);
void add(const fVec3 &vec1, const fVec3 &vec2)
double TotalCOM(fVec3 &com, const char *chname=0)
Center of mass of the chain.
char * CharName(const char *_name)
Extracts the character name from a joint name.
void zero()
Creates a zero vector.
friend fMat33 tran(const fMat33 &m)
Returns the transpose.
void cross(const fVec3 &vec1, const fVec3 &vec2)
Cross product.
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
Joint * root
Chain information.
void CalcPosition()
Forward kinematics.
double total_com(fVec3 &com, const char *chname)
Classes for defining open/closed kinematic chains.
void mul(const fVec3 &vec, double d)