8#ifndef RBDL_SPATIALALGEBRAOPERATORS_H
9#define RBDL_SPATIALALGEBRAOPERATORS_H
20 0., -vector[2], vector[1],
21 vector[2], 0., -vector[0],
22 -vector[1], vector[0], 0.
31 Ixx (0.), Iyx(0.), Iyy(0.), Izx(0.), Izy(0.), Izz(0.)
35 m (mass), h (com_mass),
37 Iyx (inertia(1,0)), Iyy(inertia(1,1)),
38 Izx (inertia(2,0)), Izy(inertia(2,1)), Izz(inertia(2,2))
48 Izx (Izx), Izy(Izy), Izz(Izz)
52 Vector3d mv_lower (mv[3], mv[4], mv[5]);
55 Ixx * mv[0] + Iyx * mv[1] + Izx * mv[2],
56 Iyx * mv[0] + Iyy * mv[1] + Izy * mv[2],
57 Izx * mv[0] + Izy * mv[1] + Izz * mv[2]
58 ) + h.cross(mv_lower);
59 Vector3d res_lower = m * mv_lower - h.cross (
Vector3d (mv[0], mv[1], mv[2]));
62 res_upper[0], res_upper[1], res_upper[2],
63 res_lower[0], res_lower[1], res_lower[2]
72 Iyx + rbi.
Iyx, Iyy + rbi.
Iyy,
73 Izx + rbi.
Izx, Izy + rbi.
Izy, Izz + rbi.
Izz
79 h.set (-Ic(1,5), Ic(0,5), -Ic(0,4));
81 Iyx = Ic(1,0); Iyy = Ic(1,1);
82 Izx = Ic(2,0); Izy = Ic(2,1); Izz = Ic(2,2);
87 result(0,0) = Ixx; result(0,1) = Iyx; result(0,2) = Izx;
88 result(1,0) = Iyx; result(1,1) = Iyy; result(1,2) = Izy;
89 result(2,0) = Izx; result(2,1) = Izy; result(2,2) = Izz;
93 result.block<3,3>(3,3) = Matrix3d::Identity() * m;
99 mat(0,0) = Ixx; mat(0,1) = Iyx; mat(0,2) = Izx;
100 mat(1,0) = Iyx; mat(1,1) = Iyy; mat(1,2) = Izy;
101 mat(2,0) = Izx; mat(2,1) = Izy; mat(2,2) = Izz;
103 mat(3,0) = 0.; mat(3,1) = h[2]; mat(3,2) = -h[1];
104 mat(4,0) = -h[2]; mat(4,1) = 0.; mat(4,2) = h[0];
105 mat(5,0) = h[1]; mat(5,1) = -h[0]; mat(5,2) = 0.;
107 mat(0,3) = 0.; mat(0,4) = -h[2]; mat(0,5) = h[1];
108 mat(1,3) = h[2]; mat(1,4) = 0.; mat(1,5) = -h[0];
109 mat(2,3) = -h[1]; mat(2,4) = h[0]; mat(2,5) = 0.;
111 mat(3,3) = m; mat(3,4) = 0.; mat(3,5) = 0.;
112 mat(4,3) = 0.; mat(4,4) = m; mat(4,5) = 0.;
113 mat(5,3) = 0.; mat(5,4) = 0.; mat(5,5) = m;
119 result.
h = com * mass;
161 v_sp[3] - r[1]*v_sp[2] + r[2]*v_sp[1],
162 v_sp[4] - r[2]*v_sp[0] + r[0]*v_sp[2],
163 v_sp[5] - r[0]*v_sp[1] + r[1]*v_sp[0]
166 E(0,0) * v_sp[0] + E(0,1) * v_sp[1] + E(0,2) * v_sp[2],
167 E(1,0) * v_sp[0] + E(1,1) * v_sp[1] + E(1,2) * v_sp[2],
168 E(2,0) * v_sp[0] + E(2,1) * v_sp[1] + E(2,2) * v_sp[2],
169 E(0,0) * v_rxw[0] + E(0,1) * v_rxw[1] + E(0,2) * v_rxw[2],
170 E(1,0) * v_rxw[0] + E(1,1) * v_rxw[1] + E(1,2) * v_rxw[2],
171 E(2,0) * v_rxw[0] + E(2,1) * v_rxw[1] + E(2,2) * v_rxw[2]
181 E(0,0) * f_sp[3] + E(1,0) * f_sp[4] + E(2,0) * f_sp[5],
182 E(0,1) * f_sp[3] + E(1,1) * f_sp[4] + E(2,1) * f_sp[5],
183 E(0,2) * f_sp[3] + E(1,2) * f_sp[4] + E(2,2) * f_sp[5]
187 E(0,0) * f_sp[0] + E(1,0) * f_sp[1] + E(2,0) * f_sp[2] - r[2] * E_T_f[1] + r[1] * E_T_f[2],
188 E(0,1) * f_sp[0] + E(1,1) * f_sp[1] + E(2,1) * f_sp[2] + r[2] * E_T_f[0] - r[0] * E_T_f[2],
189 E(0,2) * f_sp[0] + E(1,2) * f_sp[1] + E(2,2) * f_sp[2] - r[1] * E_T_f[0] + r[0] * E_T_f[1],
201 E * (rbi.
h - rbi.
m * r),
219 Vector3d E_T_mr = E.transpose() * rbi.
h + rbi.
m * r;
241 E(0,0) * f_sp[3] + E(0,1) * f_sp[4] + E(0,2) * f_sp[5],
242 E(1,0) * f_sp[3] + E(1,1) * f_sp[4] + E(1,2) * f_sp[5],
243 E(2,0) * f_sp[3] + E(2,1) * f_sp[4] + E(2,2) * f_sp[5]
255 result.block<3,3>(0,0) = E;
256 result.block<3,3>(0,3) = Matrix3d::Zero();
257 result.block<3,3>(3,0) = -_Erx;
258 result.block<3,3>(3,3) = E;
271 result.block<3,3>(0,0) = E;
272 result.block<3,3>(0,3) = -_Erx;
273 result.block<3,3>(3,0) = Matrix3d::Zero();
274 result.block<3,3>(3,3) = E;
287 result.block<3,3>(0,0) = E.transpose();
288 result.block<3,3>(0,3) = -_Erx.transpose();
289 result.block<3,3>(3,0) = Matrix3d::Zero();
290 result.block<3,3>(3,3) = E.transpose();
307 r = XT.
r + XT.
E.transpose() * r;
316 output <<
"rbi.m = " << rbi.
m << std::endl;
317 output <<
"rbi.h = " << rbi.
h.transpose();
318 output <<
"rbi.Ixx = " << rbi.
Ixx << std::endl;
319 output <<
"rbi.Iyx = " << rbi.
Iyx <<
" rbi.Iyy = " << rbi.
Iyy << std::endl;
320 output <<
"rbi.Izx = " << rbi.
Izx <<
" rbi.Izy = " << rbi.
Izy <<
" rbi.Izz = " << rbi.
Izz << std::endl;
325 output <<
"X.E = " << std::endl << X.
E << std::endl;
326 output <<
"X.r = " << X.
r.transpose();
337 axis[0] * axis[0] * (1.0f - c) + c,
338 axis[1] * axis[0] * (1.0f - c) + axis[2] * s,
339 axis[0] * axis[2] * (1.0f - c) - axis[1] * s,
341 axis[0] * axis[1] * (1.0f - c) - axis[2] * s,
342 axis[1] * axis[1] * (1.0f - c) + c,
343 axis[1] * axis[2] * (1.0f - c) + axis[0] * s,
345 axis[0] * axis[2] * (1.0f - c) + axis[1] * s,
346 axis[1] * axis[2] * (1.0f - c) - axis[0] * s,
347 axis[2] * axis[2] * (1.0f - c) + c
398 Matrix3d::Identity(),
405 0, -v[2], v[1], 0, 0, 0,
406 v[2], 0, -v[0], 0, 0, 0,
407 -v[1], v[0], 0, 0, 0, 0,
408 0, -v[5], v[4], 0, -v[2], v[1],
409 v[5], 0, -v[3], v[2], 0, -v[0],
410 -v[4], v[3], 0, -v[1], v[0], 0
416 -v1[2] * v2[1] + v1[1] * v2[2],
417 v1[2] * v2[0] - v1[0] * v2[2],
418 -v1[1] * v2[0] + v1[0] * v2[1],
419 -v1[5] * v2[1] + v1[4] * v2[2] - v1[2] * v2[4] + v1[1] * v2[5],
420 v1[5] * v2[0] - v1[3] * v2[2] + v1[2] * v2[3] - v1[0] * v2[5],
421 -v1[4] * v2[0] + v1[3] * v2[1] - v1[1] * v2[3] + v1[0] * v2[4]
427 0, -v[2], v[1], 0, -v[5], v[4],
428 v[2], 0, -v[0], v[5], 0, -v[3],
429 -v[1], v[0], 0, -v[4], v[3], 0,
430 0, 0, 0, 0, -v[2], v[1],
431 0, 0, 0, v[2], 0, -v[0],
432 0, 0, 0, -v[1], v[0], 0
438 -v1[2] * v2[1] + v1[1] * v2[2] - v1[5] * v2[4] + v1[4] * v2[5],
439 v1[2] * v2[0] - v1[0] * v2[2] + v1[5] * v2[3] - v1[3] * v2[5],
440 -v1[1] * v2[0] + v1[0] * v2[1] - v1[4] * v2[3] + v1[3] * v2[4],
441 - v1[2] * v2[4] + v1[1] * v2[5],
442 v1[2] * v2[3] - v1[0] * v2[5],
443 - v1[1] * v2[3] + v1[0] * v2[4]
MX_Xd_static< nrows, ncols > operator*(const MX_Xd_static< nrows, ncols > &me, const MX_Xd_scalar &other)
MX_Xd_static< nrows, ncols > operator+(const MX_Xd_static< nrows, ncols > &me, const MX_Xd_dynamic &other)
SpatialMatrix_t SpatialMatrix
SpatialTransform Xrotz(const Scalar &zrot)
SpatialMatrix crossf(const SpatialVector &v)
SpatialTransform Xroty(const Scalar &yrot)
SpatialVector_t SpatialVector
SpatialMatrix crossm(const SpatialVector &v)
SpatialTransform Xtrans(const Vector3d &r)
Matrix3d VectorCrossMatrix(const Vector3d &vector)
SpatialTransform Xrot(Scalar angle_rad, const Vector3d &axis)
std::ostream & operator<<(std::ostream &output, const SpatialRigidBodyInertia &rbi)
SpatialTransform Xrotx(const Scalar &xrot)
MX_Xd_scalar cos(const MX_Xd_scalar &x)
MX_Xd_scalar sin(const MX_Xd_scalar &x)
Compact representation for Spatial Inertia.
static SpatialRigidBodyInertia createFromMassComInertiaC(Scalar mass, const Vector3d &com, const Matrix3d &inertia_C)
SpatialMatrix toMatrix() const
SpatialRigidBodyInertia()
Vector3d h
Coordinates of the center of mass.
void createFromMatrix(const SpatialMatrix &Ic)
void setSpatialMatrix(SpatialMatrix &mat) const
Scalar Ixx
Inertia expressed at the origin.
SpatialRigidBodyInertia(Scalar m, const Vector3d &h, const Scalar &Ixx, const Scalar &Iyx, const Scalar &Iyy, const Scalar &Izx, const Scalar &Izy, const Scalar &Izz)
SpatialRigidBodyInertia(Scalar mass, const Vector3d &com_mass, const Matrix3d &inertia)
Compact representation of spatial transformations.
SpatialVector applyTranspose(const SpatialVector &f_sp)
SpatialVector apply(const SpatialVector &v_sp)
SpatialRigidBodyInertia apply(const SpatialRigidBodyInertia &rbi)
SpatialMatrix toMatrix() const
SpatialTransform inverse() const
SpatialVector applyAdjoint(const SpatialVector &f_sp)
SpatialTransform(const Matrix3d &rotation, const Vector3d &translation)
SpatialMatrix toMatrixTranspose() const
SpatialRigidBodyInertia applyTranspose(const SpatialRigidBodyInertia &rbi)
SpatialMatrix toMatrixAdjoint() const