26 LinkTraverse::LinkTraverse()
32 LinkTraverse::LinkTraverse(
int size)
41 find(root, doUpward, doDownward);
55 traverse(root, doUpward, doDownward,
false, 0);
61 links.push_back(link);
66 if(doUpward && link->
parent){
72 traverse(child,
false,
true,
false, 0);
91 link->
R.noalias() = child->
R *
rodrigues(child->
a, child->
q).transpose();
92 arm.noalias() = link->
R * child->
b;
93 link->
p = child->
p - arm;
96 child->
sw.noalias() = link->
R * child->
a;
97 link->
w = child->
w - child->
dq * child->
sw;
98 link->
v = child->
v - link->
w.cross(arm);
100 if(calcAcceleration){
101 link->
dw = child->
dw - child->
dq * child->
w.cross(child->
sw) - (child->
ddq * child->
sw);
102 link->
dv = child->
dv - child->
w.cross(child->
w.cross(arm)) - child->
dw.cross(arm);
109 arm.noalias() = link->
R * (child->
b + child->
q * child->
d);
110 link->
p = child->
p - arm;
113 child->
sv.noalias() = link->
R * child->
d;
115 link->
v = child->
v - child->
dq * child->
sv;
117 if(calcAcceleration){
118 link->
dw = child->
dw;
119 link->
dv = child->
dv - child->
w.cross(child->
w.cross(arm)) - child->
dw.cross(arm)
120 - 2.0 * child->
dq * child->
w.cross(child->
sv) - child->
ddq * child->
sv;
128 link->
p = child->
p - (link->
R * child->
b);
134 if(calcAcceleration){
135 link->
dw = child->
dw;
136 link->
dv = child->
dv;
153 arm.noalias() = parent->
R * link->
b;
154 link->
p = parent->
p + arm;
157 link->
sw.noalias() = parent->
R * link->
a;
158 link->
w = parent->
w + link->
sw * link->
dq;
159 link->
v = parent->
v + parent->
w.cross(arm);
161 if(calcAcceleration){
162 link->
dw = parent->
dw + link->
dq * parent->
w.cross(link->
sw) + (link->
ddq * link->
sw);
163 link->
dv = parent->
dv + parent->
w.cross(parent->
w.cross(arm)) + parent->
dw.cross(arm);
170 arm.noalias() = parent->
R * (link->
b + link->
q * link->
d);
171 link->
p = parent->
p + arm;
174 link->
sv.noalias() = parent->
R * link->
d;
176 link->
v = parent->
v + link->
sv * link->
dq;
178 if(calcAcceleration){
179 link->
dw = parent->
dw;
180 link->
dv = parent->
dv + parent->
w.cross(parent->
w.cross(arm)) + parent->
dw.cross(arm)
181 + 2.0 * link->
dq * parent->
w.cross(link->
sv) + link->
ddq * link->
sv;
189 link->
p = parent->
R * link->
b + parent->
p;
195 if(calcAcceleration){
196 link->
dw = parent->
dw;
197 link->
dv = parent->
dv;
221 for(
int i=0;
i <
n; ++
i){
The header file of the LinkTraverse class.
void traverse(Link *link, bool doUpward, bool doDownward, bool isUpward, Link *prev)
double ddq
joint acceleration
bool isDownward(int index) const
void calcForwardKinematics(bool calcVelocity=false, bool calcAcceleration=false) const
translational joint (1 dof)
Vector3 w
angular velocity, omega
Link * link(int index) const
std::ostream & operator<<(std::ostream &os, LinkTraverse &traverse)
unsigned int numLinks() const
virtual void find(Link *root, bool doUpward=false, bool doDownward=true)
Vector3 dv
linear acceleration
Matrix33 rodrigues(const Vector3 &axis, double q)
Vector3 b
relative position (parent local)
Vector3 dw
derivative of omega
std::vector< Link * > links
Vector3 a
rotational joint axis (self local)
Vector3 d
translation joint axis (self local)