25 cf(idx+1) = f_final(1);
26 cf(idx+2) = f_final(2);
27 cf(idx+3) = f_final(3);
28 cf(idx+4) = f_final(4);
29 cf(idx+5) = f_final(5);
44 if(n_links > 1) ret = n_outer_joints*n_outer_joints;
45 ret += children[0]->total_cost();
46 if(children[0] != children[1])
47 ret += children[1]->total_cost();
58 if(!
this || n_links == 1)
return 0;
60 if(children[0]) ret0 = children[0]->schedule_depth();
61 if(children[1])
ret1 = children[1]->schedule_depth();
62 return (ret0 >
ret1) ? (ret0+1) : (
ret1+1);
72 if(!
this || n_links == 1)
return 0;
73 if(children[0] && children[1] &&
74 children[0]->n_links == 1 && children[1]->n_links == 1)
78 int ret = children[0]->num_leaves();
79 if(children[0] != children[1])
80 ret += children[1]->num_leaves();
126 if(n_contacts == 0)
return 0;
142 for(
int i=0;
i<org_n_joint;
i++)
155 if(jinfo_save[
i].plink)
delete jinfo_save[
i].
plink;
158 if(jinfo_save)
delete[] jinfo_save;
188 for(
int i=0;
i<org_n_joint;
i++)
196 for(
int i=0;
i<n_contacts;
i++)
210 if(jinfo_save)
delete[] jinfo_save;
297 if(joint->n_root_dof == 0)
return;
299 static fMat33 m11, m12, m22;
300 double sx = joint->loc_com(0), sy = joint->loc_com(1), sz = joint->loc_com(2);
306 m12.
mul(joint->mass, scross);
307 m22.
mul(scross, scross);
309 m22 += joint->inertia;
314 n2J.
mul(joint->gear_ratio*joint->gear_ratio*joint->rotor_inertia, joint->axis);
315 n2Jmat.
mul(n2J, n2J);
324 M(i, j+3) = -m12(i, j);
325 M(i+3, j) = m12(i, j);
326 M(i+3, j+3) = m22(i, j);
345 ost <<
"-- pSubChain ->" << endl;
346 if(last_pjoints[0]) ost <<
"\tlast: " << last_pjoints[0]->joint->name << endl;
347 else ost <<
"\tsingle link" << endl;
348 if(parent) ost <<
"\tparent: " << parent->last_pjoints[0]->joint->name << endl;
349 ost <<
"\touter: " << n_outer_joints << endl;
350 for(i=0; i<n_outer_joints; i++)
351 outer_joints[i]->
dump(ost);
352 ost <<
"\tlinks: " << n_links << endl;
353 for(i=0; i<n_links; i++)
356 ost <<
"\trank: " << rank << endl;
359 children[0]->dump(ost);
360 if(children[1] != children[0]) children[1]->dump(ost);
365 ost <<
"\t\t" << joint->name <<
"->" << link_side->name << endl;
370 ost <<
"\t\t" << joint->name << endl;
virtual int clear_contact()
virtual int init(SceneGraph *sg)
Initialize the parameters.
joint_list contact_vjoints
Joint * child
pointer to the child joint
int contact_vjoint_index(Joint *_jnt)
virtual int clear_data()
Clear arrays only; don't delete joints.
void mul(const fMat33 &mat1, const fMat33 &mat2)
int RemoveJoint(Joint *j)
disconnect joint j from its parent
Forward dynamics computation based on Assembly-Disassembly Algorithm.
int ConstraintForces(fVec &cf)
Extract the constraint forces.
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
int TotalCost()
Approximate indicators of total computational cost.
Joint * root
Chain information.
void identity()
Identity matrix.
virtual int init(SceneGraph *sg)
Initialize the parameters.
std::vector< fVec3 > all_jdot_r
def j(str, encoding="cp932")
std::vector< fVec3 > contact_relvels
std::vector< fVec3 > all_jdot_v
void DumpSchedule(ostream &ost)
Dump the schedule information to ost.
void dump(const SDOPackage::NVList &nv)
Joint * brother
pointer to the brother joint
Class for representing "handle"; two pJoint instances are attached to both sides of each joint...
std::vector< double > fric_coefs
virtual int clear_data()
Clear arrays only; don't delete joints.
void mul(const fVec3 &vec, double d)
The class for representing a joint.
Joint * real
pointer to the real (connected) joint; for closed chains.
int i_joint
index of the joint
std::vector< fMat > all_Jr
std::vector< fMat > all_Jv
Joint * parent
pointer to the parent joint
virtual void Clear()
Remove all joints and clear all parameters.
void setup_pjoint_virtual(Joint *j)
void setup_pjoint(Joint *j)
Class for representing a single link in a schedule tree.