8#ifndef RBDL_MATHUTILS_H
9#define RBDL_MATHUTILS_H
27enum RBDL_DLLAPI LinearSolver {
44 for (
unsigned int i = 0; i < n; i++) {
55 for (
unsigned int i = 0; i < rows; i++) {
56 for (
unsigned int j = 0; j < cols; j++) {
57 result(i,j) = ptr[i * cols + j];
61 for (
unsigned int i = 0; i < rows; i++) {
62 for (
unsigned int j = 0; j < cols; j++) {
63 result(i,j) = ptr[i + j * rows];
71#ifndef RBDL_USE_CASADI_MATH
79#ifndef RBDL_USE_CASADI_MATH
178 0., -s * xdot, c * xdot,
179 0., -c * xdot,-s * xdot
188 -s * ydot, 0., - c * ydot,
190 c * ydot, 0., - s * ydot
199 -s * zdot, c * zdot, 0.,
200 -c * zdot, -s * zdot, 0.,
212 zyx_angle_rates[2] - sy * zyx_angle_rates[0],
213 cx * zyx_angle_rates[1] + sx * cy * zyx_angle_rates[0],
214 -sx * zyx_angle_rates[1] + cx * cy * zyx_angle_rates[0]
224 + RzT *
Vector3d (0., zyx_rates[1], 0.)
225 + RzT * RyT *
Vector3d (zyx_rates[2], 0., 0.)
234 Scalar xdot = zyx_angle_rates[2];
235 Scalar ydot = zyx_angle_rates[1];
236 Scalar zdot = zyx_angle_rates[0];
237 Scalar xddot = zyx_angle_rates_dot[2];
238 Scalar yddot = zyx_angle_rates_dot[1];
239 Scalar zddot = zyx_angle_rates_dot[0];
242 xddot - (cy * ydot * zdot + sy * zddot),
243 -sx * xdot * ydot + cx * yddot + cx * xdot * cy * zdot + sx * ( - sy * ydot * zdot + cy * zddot),
244 -cx * xdot * ydot - sx * yddot - sx * xdot * cy * zdot + cx * ( - sy * ydot * zdot + cy * zddot)
RBDL_DLLAPI Vector3d global_angular_velocity_from_rates(const Vector3d &zyx_angles, const Vector3d &zyx_rates)
RBDL_DLLAPI Matrix3d rotxdot(const Scalar &x, const Scalar &xdot)
RBDL_DLLAPI SpatialMatrix XtransRotZYXEuler(const Vector3d &displacement, const Vector3d &zyx_euler)
Creates a spatial transformation for given parameters.
RBDL_DLLAPI SpatialMatrix Xrotx_mat(const Scalar &xrot)
Creates a rotational transformation around the X-axis.
RBDL_DLLAPI Matrix3d rotz(const Scalar &zrot)
RBDL_DLLAPI Matrix3d rotx(const Scalar &xrot)
RBDL_DLLAPI Vector3d angular_acceleration_from_angle_rates(const Vector3d &zyx_angles, const Vector3d &zyx_angle_rates, const Vector3d &zyx_angle_rates_dot)
RBDL_DLLAPI void SpatialMatrixSetSubmatrix(SpatialMatrix &dest, unsigned int row, unsigned int col, const Matrix3d &matrix)
RBDL_DLLAPI VectorNd VectorFromPtr(unsigned int n, Scalar *ptr)
RBDL_DLLAPI MatrixNd MatrixFromPtr(unsigned int rows, unsigned int cols, Scalar *ptr, bool row_major=true)
RBDL_DLLAPI void SparseMultiplyLx(Model &model, Math::MatrixNd &L)
RBDL_DLLAPI Matrix3d rotydot(const Scalar &y, const Scalar &ydot)
RBDL_DLLAPI Matrix3d rotzdot(const Scalar &z, const Scalar &zdot)
RBDL_DLLAPI void SparseFactorizeLTL(Model &model, Math::MatrixNd &H)
RBDL_DLLAPI void SparseSolveLx(Model &model, Math::MatrixNd &L, Math::VectorNd &x)
RBDL_DLLAPI Matrix3d roty(const Scalar &yrot)
RBDL_DLLAPI bool LinSolveGaussElimPivot(MatrixNd A, VectorNd b, VectorNd &x)
Solves a linear system using gaussian elimination with pivoting.
RBDL_DLLAPI bool SpatialVectorCompareEpsilon(const SpatialVector &vector_a, const SpatialVector &vector_b, Scalar epsilon)
RBDL_DLLAPI void SparseMultiplyHx(Model &model, Math::MatrixNd &L)
RBDL_DLLAPI void SparseSolveLTx(Model &model, Math::MatrixNd &L, Math::VectorNd &x)
RBDL_DLLAPI SpatialMatrix Xroty_mat(const Scalar &yrot)
Creates a rotational transformation around the Y-axis.
RBDL_DLLAPI void SparseMultiplyLTx(Model &model, Math::MatrixNd &L)
RBDL_DLLAPI Matrix3d parallel_axis(const Matrix3d &inertia, Scalar mass, const Vector3d &com)
Translates the inertia matrix to a new center.
RBDL_DLLAPI SpatialMatrix Xrotz_mat(const Scalar &zrot)
Creates a rotational transformation around the Z-axis.
RBDL_DLLAPI SpatialMatrix Xtrans_mat(const Vector3d &r)
Creates a transformation of a linear displacement.
RBDL_DLLAPI Matrix3d Matrix3dZero
RBDL_DLLAPI Matrix3d Matrix3dIdentity
RBDL_DLLAPI Vector3d Vector3dZero
RBDL_DLLAPI Vector3d angular_velocity_from_angle_rates(const Vector3d &zyx_angles, const Vector3d &zyx_angle_rates)
RBDL_DLLAPI bool SpatialMatrixCompareEpsilon(const SpatialMatrix &matrix_a, const SpatialMatrix &matrix_b, Scalar epsilon)
MX_Xd_scalar cos(const MX_Xd_scalar &x)
MX_Xd_scalar sin(const MX_Xd_scalar &x)
LinearSolverColPivHouseholderQR
LinearSolverHouseholderQR