33 #ifndef DART_DYNAMICS_DETAIL_TEMPLATEDJACOBIAN_HPP_
34 #define DART_DYNAMICS_DETAIL_TEMPLATEDJACOBIAN_HPP_
42 template <
class NodeType>
44 const Frame* _inCoordinatesOf)
const
46 if (
this == _inCoordinatesOf)
47 return static_cast<const NodeType*
>(
this)->getJacobian();
48 else if (_inCoordinatesOf->
isWorld())
49 return static_cast<const NodeType*
>(
this)->getWorldJacobian();
52 getTransform(_inCoordinatesOf),
53 static_cast<const NodeType*
>(
this)->getJacobian());
57 template <
class NodeType>
59 const Eigen::Vector3d& _offset)
const
61 math::Jacobian J =
static_cast<const NodeType*
>(
this)->getJacobian();
62 J.bottomRows<3>() += J.topRows<3>().colwise().cross(_offset);
68 template <
class NodeType>
70 const Eigen::Vector3d& _offset,
const Frame* _inCoordinatesOf)
const
72 if (
this == _inCoordinatesOf)
73 return getJacobian(_offset);
74 else if (_inCoordinatesOf->
isWorld())
75 return getWorldJacobian(_offset);
77 Eigen::Isometry3d T = getTransform(_inCoordinatesOf);
78 T.translation() = -T.linear() * _offset;
80 return math::AdTJac(T,
static_cast<const NodeType*
>(
this)->getJacobian());
84 template <
class NodeType>
86 const Eigen::Vector3d& _offset)
const
90 += J.topRows<3>().colwise().cross(getWorldTransform().linear() * _offset);
96 template <
class NodeType>
98 const Frame* _inCoordinatesOf)
const
100 if (
this == _inCoordinatesOf)
102 const math::Jacobian& J =
static_cast<const NodeType*
>(
this)->getJacobian();
104 return J.bottomRows<3>();
109 =
static_cast<const NodeType*
>(
this)->getWorldJacobian();
111 return JWorld.bottomRows<3>();
114 const math::Jacobian& J =
static_cast<const NodeType*
>(
this)->getJacobian();
116 return getTransform(_inCoordinatesOf).linear() * J.bottomRows<3>();
120 template <
class NodeType>
122 const Eigen::Vector3d& _offset,
const Frame* _inCoordinatesOf)
const
124 const math::Jacobian& J =
static_cast<const NodeType*
>(
this)->getJacobian();
127 JLinear = J.bottomRows<3>() + J.topRows<3>().colwise().cross(_offset);
129 if (
this == _inCoordinatesOf)
132 return getTransform(_inCoordinatesOf).linear() * JLinear;
136 template <
class NodeType>
138 const Frame* _inCoordinatesOf)
const
140 if (
this == _inCoordinatesOf)
142 const math::Jacobian& J =
static_cast<const NodeType*
>(
this)->getJacobian();
143 return J.topRows<3>();
145 else if (_inCoordinatesOf->
isWorld())
148 =
static_cast<const NodeType*
>(
this)->getWorldJacobian();
149 return JWorld.topRows<3>();
152 const math::Jacobian& J =
static_cast<const NodeType*
>(
this)->getJacobian();
154 return getTransform(_inCoordinatesOf).linear() * J.topRows<3>();
158 template <
class NodeType>
160 const Frame* _inCoordinatesOf)
const
162 if (
this == _inCoordinatesOf)
163 return static_cast<const NodeType*
>(
this)->getJacobianSpatialDeriv();
166 getTransform(_inCoordinatesOf),
167 static_cast<const NodeType*
>(
this)->getJacobianSpatialDeriv());
171 template <
class NodeType>
173 const Eigen::Vector3d& _offset)
const
176 =
static_cast<const NodeType*
>(
this)->getJacobianSpatialDeriv();
178 J_d.bottomRows<3>() += J_d.topRows<3>().colwise().cross(_offset);
184 template <
class NodeType>
186 const Eigen::Vector3d& _offset,
const Frame* _inCoordinatesOf)
const
188 if (
this == _inCoordinatesOf)
189 return getJacobianSpatialDeriv(_offset);
191 Eigen::Isometry3d T = getTransform(_inCoordinatesOf);
192 T.translation() = T.linear() * -_offset;
195 T,
static_cast<const NodeType*
>(
this)->getJacobianSpatialDeriv());
199 template <
class NodeType>
201 const Frame* _inCoordinatesOf)
const
203 if (_inCoordinatesOf->
isWorld())
204 return static_cast<const NodeType*
>(
this)->getJacobianClassicDeriv();
208 static_cast<const NodeType*
>(
this)->getJacobianClassicDeriv());
212 template <
class NodeType>
214 const Eigen::Vector3d& _offset,
const Frame* _inCoordinatesOf)
const
217 =
static_cast<const NodeType*
>(
this)->getJacobianClassicDeriv();
220 =
static_cast<const NodeType*
>(
this)->getWorldJacobian();
222 const Eigen::Vector3d& w = getAngularVelocity();
223 const Eigen::Vector3d& p = (getWorldTransform().linear() * _offset).eval();
225 J_d.bottomRows<3>() += J_d.topRows<3>().colwise().cross(p)
226 + J.topRows<3>().colwise().cross(w.cross(p));
228 if (_inCoordinatesOf->
isWorld())
235 template <
class NodeType>
237 const Frame* _inCoordinatesOf)
const
240 =
static_cast<const NodeType*
>(
this)->getJacobianClassicDeriv();
242 if (_inCoordinatesOf->
isWorld())
243 return J_d.bottomRows<3>();
246 * J_d.bottomRows<3>();
250 template <
class NodeType>
252 const Eigen::Vector3d& _offset,
const Frame* _inCoordinatesOf)
const
255 =
static_cast<const NodeType*
>(
this)->getJacobianClassicDeriv();
258 =
static_cast<const NodeType*
>(
this)->getWorldJacobian();
260 const Eigen::Vector3d& w = getAngularVelocity();
261 const Eigen::Vector3d& p = (getWorldTransform().linear() * _offset).eval();
263 if (_inCoordinatesOf->
isWorld())
264 return J_d.bottomRows<3>() + J_d.topRows<3>().colwise().cross(p)
265 + J.topRows<3>().colwise().cross(w.cross(p));
268 * (J_d.bottomRows<3>() + J_d.topRows<3>().colwise().cross(p)
269 + J.topRows<3>().colwise().cross(w.cross(p)));
273 template <
class NodeType>
275 const Frame* _inCoordinatesOf)
const
278 =
static_cast<const NodeType*
>(
this)->getJacobianClassicDeriv();
280 if (_inCoordinatesOf->
isWorld())
281 return J_d.topRows<3>();
288 template <
class NodeType>
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:79
Entity class is a base class for any objects that exist in the kinematic tree structure of DART.
Definition: Entity.hpp:61
The Frame class serves as the backbone of DART's kinematic tree structure.
Definition: Frame.hpp:58
bool isWorld() const
Returns true if this Frame is the World Frame.
Definition: Frame.cpp:475
const Eigen::Isometry3d & getWorldTransform() const
Get the transform of this Frame with respect to the World Frame.
Definition: Frame.cpp:93
The JacobianNode class serves as a common interface for BodyNodes and EndEffectors to both be used as...
Definition: JacobianNode.hpp:55
virtual const math::Jacobian & getJacobian() const =0
Return the generalized Jacobian targeting the origin of this JacobianNode.
virtual const math::Jacobian & getJacobianClassicDeriv() const =0
Return the classical time derivative of the generalized Jacobian targeting the origin of this BodyNod...
virtual const math::Jacobian & getJacobianSpatialDeriv() const =0
Return the spatial time derivative of the generalized Jacobian targeting the origin of this BodyNode.
virtual const math::Jacobian & getWorldJacobian() const =0
Return the generalized Jacobian targeting the origin of this JacobianNode.
math::AngularJacobian getAngularJacobian(const Frame *_inCoordinatesOf=Frame::World()) const override final
Return the angular Jacobian targeting the origin of this BodyNode.
Definition: TemplatedJacobianNode.hpp:137
TemplatedJacobianNode(BodyNode *bn)
Constructor.
Definition: TemplatedJacobianNode.hpp:289
math::LinearJacobian getLinearJacobian(const Frame *_inCoordinatesOf=Frame::World()) const override final
Return the linear Jacobian targeting the origin of this BodyNode.
Definition: TemplatedJacobianNode.hpp:97
math::AngularJacobian getAngularJacobianDeriv(const Frame *_inCoordinatesOf=Frame::World()) const override final
Return the angular Jacobian time derivative, in terms of any coordinate Frame.
Definition: TemplatedJacobianNode.hpp:274
math::LinearJacobian getLinearJacobianDeriv(const Frame *_inCoordinatesOf=Frame::World()) const override final
Return the linear Jacobian (classical) time derivative, in terms of any coordinate Frame.
Definition: TemplatedJacobianNode.hpp:236
Derived::PlainObject AdRJac(const Eigen::Isometry3d &_T, const Eigen::MatrixBase< Derived > &_J)
Change coordinate Frame of a Jacobian.
Definition: Geometry.hpp:273
Eigen::Matrix< double, 6, Eigen::Dynamic > Jacobian
Definition: MathTypes.hpp:114
Eigen::Matrix< double, 3, Eigen::Dynamic > AngularJacobian
Definition: MathTypes.hpp:113
Derived::PlainObject AdRInvJac(const Eigen::Isometry3d &_T, const Eigen::MatrixBase< Derived > &_J)
Definition: Geometry.hpp:291
Eigen::Matrix< double, 3, Eigen::Dynamic > LinearJacobian
Definition: MathTypes.hpp:112
Derived::PlainObject AdTJac(const Eigen::Isometry3d &_T, const Eigen::MatrixBase< Derived > &_J)
Adjoint mapping for dynamic size Jacobian.
Definition: Geometry.hpp:216
Definition: BulletCollisionDetector.cpp:65