7 #include <gtest/gtest.h> 45 Joint(
SpatialVector(0., 0., 0., 1., 0., 0.),
SpatialVector(0., 0., 0., 0., 1., 0.),
SpatialVector(0., 0., 0., 0., 0., 1.),
46 SpatialVector(0., 0., 1., 0., 0., 0.),
SpatialVector(0., 1., 0., 0., 0., 0.),
SpatialVector(1., 0., 0., 0., 0., 0.)),
50 VectorNd Q = VectorNd::Constant((
size_t)model->dof_count, 0.);
51 VectorNd QDot = VectorNd::Constant((
size_t)model->dof_count, 0.);
52 VectorNd QDDot = VectorNd::Constant((
size_t)model->dof_count, 0.);
53 VectorNd Tau = VectorNd::Constant((
size_t)model->dof_count, 0.);
54 VectorNd TauInv = VectorNd::Constant((
size_t)model->dof_count, 0.);
56 MatrixNd H = MatrixNd::Constant((
size_t)model->dof_count, (
size_t)model->dof_count, 0.);
57 VectorNd C = VectorNd::Constant((
size_t)model->dof_count, 0.);
58 VectorNd QDDot_zero = VectorNd::Constant((
size_t)model->dof_count, 0.);
59 VectorNd QDDot_crba = VectorNd::Constant((
size_t)model->dof_count, 0.);
95 MatrixNd H = MatrixNd::Zero((
size_t)model->dof_count, (
size_t)model->dof_count);
97 VectorNd C = VectorNd::Constant((
size_t)model->dof_count, 0.);
98 VectorNd QDDot_zero = VectorNd::Constant((
size_t)model->dof_count, 0.);
99 VectorNd QDDot_crba = VectorNd::Constant((
size_t)model->dof_count, 0.);
151 MatrixNd H_crba = MatrixNd::Zero((
size_t)model->dof_count, (
size_t)model->dof_count);
152 MatrixNd H_id = MatrixNd::Zero((
size_t)model->dof_count, (
size_t)model->dof_count);
169 assert(model->dof_count == 12);
174 VectorNd H_col = VectorNd::Zero(model->dof_count);
175 VectorNd QDDot_zero = VectorNd::Zero(model->dof_count);
178 for (i = 0; i < model->dof_count; i++)
181 VectorNd delta_a = VectorNd::Zero(model->dof_count);
185 VectorNd id_delta = VectorNd::Zero(model->dof_count);
189 VectorNd id_zero = VectorNd::Zero(model->dof_count);
192 H_col = id_delta - id_zero;
193 H_id.block<12, 1>(0, i) = H_col;
201 MatrixNd H_crba = MatrixNd::Zero((
size_t)model->dof_count, (
size_t)model->dof_count);
202 MatrixNd H_id = MatrixNd::Zero((
size_t)model->dof_count, (
size_t)model->dof_count);
213 assert(model->dof_count == 6);
218 VectorNd H_col = VectorNd::Zero(model->dof_count);
219 VectorNd QDDot_zero = VectorNd::Zero(model->dof_count);
222 for (i = 0; i < 6; i++)
225 VectorNd delta_a = VectorNd::Zero(model->dof_count);
229 VectorNd id_delta = VectorNd::Zero(model->dof_count);
233 VectorNd id_zero = VectorNd::Zero(model->dof_count);
237 H_col = id_delta - id_zero;
239 H_id.block<6, 1>(0, i) = H_col;
250 VectorNd Q = VectorNd::Constant((
size_t)model->q_size, 0.);
252 MatrixNd H = MatrixNd::Constant((
size_t)model->qdot_size, (
size_t)model->qdot_size, 0.);
255 Matrix3d H_ref(2., 0., 0., 0., 2., 0., 0., 0., 3.);
260 int main(
int argc,
char** argv)
262 ::testing::InitGoogleTest(&argc, argv);
263 return RUN_ALL_TESTS();
static bool checkVectorNdEpsilonClose(const RobotDynamics::Math::VectorNd &v1, const RobotDynamics::Math::VectorNd &v2, const double epsilon)
void compositeRigidBodyAlgorithm(Model &model, const Math::VectorNd &Q, Math::MatrixNd &H, bool update_kinematics=true)
Computes the joint space inertia matrix by using the Composite Rigid Body Algorithm.
Describes all properties of a single body.
bool linSolveGaussElimPivot(MatrixNd A, VectorNd b, VectorNd &x)
Solves a linear system using gaussian elimination with pivoting.
Math::MotionVector gravity
the cartesian vector of the gravity
TEST_F(CompositeRigidBodyTestFixture, TestCompositeRigidBodyForwardDynamicsFloatingBase)
Describes a joint relative to the predecessor body.
Quaternion that are used for singularity free joints.
static bool checkMatrixNdEpsilonClose(const RobotDynamics::Math::MatrixNd &t1, const RobotDynamics::Math::MatrixNd &t2, const double epsilon)
Contains all information about the rigid body model.
void updateKinematicsCustom(Model &model, const Math::VectorNd *Q, const Math::VectorNd *QDot=nullptr, const Math::VectorNd *QDDot=nullptr)
Selectively updates model internal states of body positions, velocities and/or accelerations.
Math types such as vectors and matrices and utility functions.
int main(int argc, char **argv)
CompositeRigidBodyTestFixture()
void inverseDynamics(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &QDDot, Math::VectorNd &Tau, Math::SpatialForceV *f_ext=nullptr, bool update_kinematics=true)
3 DoF joint using Quaternions for joint positional variables and
void forwardDynamics(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, Math::VectorNd &QDDot, Math::SpatialForceV *f_ext=nullptr, bool update_kinematics=true)
Computes forward dynamics with the Articulated Body Algorithm.
Namespace for all structures of the RobotDynamics library.
static bool checkMatrix3dEpsilonClose(const RobotDynamics::Math::Matrix3d &t1, const RobotDynamics::Math::Matrix3d &t2, const double epsilon)