11 #ifndef __RDL_MATHUTILS_H__ 12 #define __RDL_MATHUTILS_H__ 58 for (
unsigned int i = 0; i < n; i++)
72 for (
unsigned int i = 0; i < rows; i++)
74 for (
unsigned int j = 0; j < cols; j++)
76 result(i, j) = ptr[i * cols + j];
82 for (
unsigned int i = 0; i < rows; i++)
84 for (
unsigned int j = 0; j < cols; j++)
86 result(i, j) = ptr[i + j * rows];
156 return Matrix3d(1., 0., 0., 0., c, s, 0., -s, c);
165 return Matrix3d(c, 0., -s, 0., 1., 0., s, 0., c);
174 return Matrix3d(c, s, 0., -s, c, 0., 0., 0., 1.);
183 return Matrix3d(0., 0., 0., 0., -s * xdot, c * xdot, 0., -c * xdot, -s * xdot);
192 return Matrix3d(-s * ydot, 0., -c * ydot, 0., 0., 0., c * ydot, 0., -s * ydot);
201 return Matrix3d(-s * zdot, c * zdot, 0., -c * zdot, -s * zdot, 0., 0., 0., 0.);
206 double sy = sin(zyx_angles[1]);
207 double cy = cos(zyx_angles[1]);
208 double sx = sin(zyx_angles[2]);
209 double cx = cos(zyx_angles[2]);
211 return Vector3d(zyx_angle_rates[2] - sy * zyx_angle_rates[0], cx * zyx_angle_rates[1] + sx * cy * zyx_angle_rates[0],
212 -sx * zyx_angle_rates[1] + cx * cy * zyx_angle_rates[0]);
225 double sy = sin(zyx_angles[1]);
226 double cy = cos(zyx_angles[1]);
227 double sx = sin(zyx_angles[2]);
228 double cx = cos(zyx_angles[2]);
229 double xdot = zyx_angle_rates[2];
230 double ydot = zyx_angle_rates[1];
231 double zdot = zyx_angle_rates[0];
232 double xddot = zyx_angle_rates_dot[2];
233 double yddot = zyx_angle_rates_dot[1];
234 double zddot = zyx_angle_rates_dot[0];
236 return Vector3d(xddot - (cy * ydot * zdot + sy * zddot), -sx * xdot * ydot + cx * yddot + cx * xdot * cy * zdot + sx * (-sy * ydot * zdot + cy * zddot),
237 -cx * xdot * ydot - sx * yddot - sx * xdot * cy * zdot + cx * (-sy * ydot * zdot + cy * zddot));
255 #endif // ifndef __RDL_MATHUTILS_H__
MatrixNd matrixFromPtr(unsigned int rows, unsigned int cols, double *ptr, bool row_major=true)
SpatialVector SpatialVectorZero
SpatialMatrix SpatialMatrixZero
Vector3d angular_velocity_from_angle_rates(const Vector3d &zyx_angles, const Vector3d &zyx_angle_rates)
void SparseMultiplyLTx(Model &model, Math::MatrixNd &L)
Vector3d global_angular_velocity_from_rates(const Vector3d &zyx_angles, const Vector3d &zyx_rates)
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.
SpatialMatrix XtransRotZYXEuler(const Vector3d &displacement, const Vector3d &zyx_euler)
Creates a spatial transformation for given parameters.
LinearSolver
Available solver methods for the linear systems.
Matrix3d roty(const double &yrot)
Vector3d angular_acceleration_from_angle_rates(const Vector3d &zyx_angles, const Vector3d &zyx_angle_rates, const Vector3d &zyx_angle_rates_dot)
Quaternion that are used for singularity free joints.
Matrix3d rotzdot(const double &z, const double &zdot)
Matrix3d rotydot(const double &y, const double &ydot)
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
Matrix3d rotx(const double &xrot)
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.
Matrix3d rotz(const double &zrot)
VectorNd vectorFromPtr(unsigned int n, double *ptr)
Namespace for all structures of the RobotDynamics library.
Matrix3d rotxdot(const double &x, const double &xdot)