27 Matrix3d
Matrix3dZero(0., 0., 0., 0., 0., 0., 0., 0., 0.);
32 SpatialMatrix
SpatialMatrixIdentity(1., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 1.);
34 SpatialMatrix
SpatialMatrixZero(0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.);
41 assert (A.rows() == A.cols());
43 unsigned int n = A.rows();
48 size_t *pivot =
new size_t[n];
55 for(i = 0; i < n; i++)
60 for(j = 0; j < n; j++)
63 double pv = fabs(A(j, pivot[j]));
66 for(k = j; k < n; k++)
68 double pt = fabs(A(j, pivot[k]));
73 unsigned int p_swap = pivot[j];
79 for(i = j + 1; i < n; i++)
81 if(fabs(A(j, pivot[j])) <= std::numeric_limits<double>::epsilon())
83 std::cerr <<
"Error: pivoting failed for matrix A = " << std::endl;
84 std::cerr <<
"A = " << std::endl << A << std::endl;
85 std::cerr <<
"b = " << b << std::endl;
88 double d = A(i, pivot[j]) / A(j, pivot[j]);
92 for(k = j; k < n; k++)
94 A(i, pivot[k]) -= A(j, pivot[k]) * d;
107 for(j = i + 1; j < n; j++)
109 px[i] += A(i, pivot[j]) * px[j];
111 px[i] = (b[i] - px[i]) / A(i, pivot[i]);
116 for(i = 0; i < n; i++)
130 return inertia + mass * com_cross * com_cross.transpose();
135 return SpatialMatrix(1., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., r[2], -r[1], 1., 0., 0., -r[2], 0., r[0], 0., 1., 0., r[1], -r[0], 0., 0., 0., 1.);
144 return SpatialMatrix(1., 0., 0., 0., 0., 0., 0., c, s, 0., 0., 0., 0., -s, c, 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., c, s, 0., 0., 0., 0., -s, c);
153 return SpatialMatrix(c, 0., -s, 0., 0., 0., 0., 1., 0., 0., 0., 0., s, 0., c, 0., 0., 0., 0., 0., 0., c, 0., -s, 0., 0., 0., 0., 1., 0., 0., 0., 0., s, 0., c);
162 return SpatialMatrix(c, s, 0., 0., 0., 0., -s, c, 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., c, s, 0., 0., 0., 0., -s, c, 0., 0., 0., 0., 0., 0., 1.);
172 for(
unsigned int i = 0; i < model.
qdot_size; i++)
174 for(
unsigned int j = i + 1; j < model.
qdot_size; j++)
180 for(
unsigned int k = model.
qdot_size; k > 0; k--)
182 H(k - 1, k - 1) = sqrt(H(k - 1, k - 1));
186 H(k - 1, i - 1) = H(k - 1, i - 1) / H(k - 1, k - 1);
196 H(i - 1, j - 1) = H(i - 1, j - 1) - H(k - 1, i - 1) * H(k - 1, j - 1);
206 assert (0 && !
"Not yet implemented!");
211 assert (0 && !
"Not yet implemented!");
216 assert (0 && !
"Not yet implemented!");
221 for(
unsigned int i = 1; i <= model.
qdot_size; i++)
226 x[i - 1] = x[i - 1] - L(i - 1, j - 1) * x[j - 1];
229 x[i - 1] = x[i - 1] / L(i - 1, i - 1);
237 x[i - 1] = x[i - 1] / L(i - 1, i - 1);
241 x[j - 1] = x[j - 1] - L(i - 1, j - 1) * x[i - 1];
std::vector< unsigned int > lambda_q
SpatialVector SpatialVectorZero
SpatialMatrix SpatialMatrixZero
void SparseMultiplyLTx(Model &model, Math::MatrixNd &L)
SpatialMatrix Xrotx_mat(const double &xrot)
Creates a rotational transformation around the X-axis.
Matrix3d Matrix3dIdentity
void SparseMultiplyHx(Model &model, Math::MatrixNd &L)
bool linSolveGaussElimPivot(MatrixNd A, VectorNd b, VectorNd &x)
Solves a linear system using gaussian elimination with pivoting.
void SparseMultiplyLx(Model &model, Math::MatrixNd &L)
SpatialMatrix Xtrans_mat(const Vector3d &displacement)
Creates a transformation of a linear displacement.
static Matrix3d toTildeForm(const Point3d &p)
SpatialMatrix XtransRotZYXEuler(const Vector3d &displacement, const Vector3d &zyx_euler)
Creates a spatial transformation for given parameters.
SpatialMatrix Xroty_mat(const double &yrot)
Creates a rotational transformation around the Y-axis.
Contains all information about the rigid body model.
void SparseFactorizeLTL(Model &model, Math::MatrixNd &H)
SpatialMatrix SpatialMatrixIdentity
Quaternion QuaternionIdentity
void SparseSolveLTx(Model &model, Math::MatrixNd &L, Math::VectorNd &x)
Matrix3d parallel_axis(const Matrix3d &inertia, double mass, const Vector3d &com)
Translates the inertia matrix to a new center.
void SparseSolveLx(Model &model, Math::MatrixNd &L, Math::VectorNd &x)
SpatialMatrix Xrotz_mat(const double &zrot)
Creates a rotational transformation around the Z-axis.
Namespace for all structures of the RobotDynamics library.
unsigned int qdot_size
The size of the.