1 #include <gtest/gtest.h> 26 Joint joint_txtyrz(
SpatialVector(0., 0., 0., 1., 0., 0.),
SpatialVector(0., 0., 0., 0., 1., 0.),
SpatialVector(0., 0., 1., 0., 0., 0.));
140 Vector3d(0.0182 * ModelHeight, 0., 0.) };
177 upper_leg_left_body =
Body(segment_mass[SegmentMassThigh], com_position[COMThigh], rgyration[RGyrationThigh]);
178 lower_leg_left_body =
Body(segment_mass[SegmentMassShank], com_position[COMShank], rgyration[RGyrationShank]);
179 foot_left_body =
Body(segment_mass[SegmentMassFoot], com_position[COMFoot], rgyration[RGyrationFoot]);
188 unsigned int temp_id = 0;
223 heel_point.
set(-0.05, -0.0317, 0.);
240 constraint_set_right.
bind(*model);
241 constraint_set_left.
bind(*model);
242 constraint_set_both.
bind(*model);
245 template <
typename T>
248 memcpy(dest, src, count *
sizeof(T));
286 Vector3d contact_force = Vector3d::Zero();
295 unsigned int body_id = constraint_set_left.
body[0];
303 contact_force[0] = constraint_set_left.
force[0];
304 contact_force[1] = constraint_set_left.
force[1];
307 EXPECT_EQ(contact_point, heel_point);
354 constraint_set_right.
bound =
false;
356 for (
unsigned int i = 0; i < model->
dof_count; i++)
358 for (
unsigned int j = 0; j < model->
dof_count; j++)
360 constraint_set_right.
H(i, j) = 1.234;
364 constraint_set_right.
bind(*model);
374 int main(
int argc,
char** argv)
376 ::testing::InitGoogleTest(&argc, argv);
377 return RUN_ALL_TESTS();
Joint joint_rot_z(SpatialVector(0., 0., 1., 0., 0., 0.))
static bool checkVectorNdEpsilonClose(const RobotDynamics::Math::VectorNd &v1, const RobotDynamics::Math::VectorNd &v2, const double epsilon)
void calcPointJacobian(Model &model, const Math::VectorNd &Q, unsigned int body_id, const Math::Vector3d &point_position, Math::MatrixNd &G, bool update_kinematics=true)
Computes the 3D point jacobian for a point on a body.
TEST(RdlTwoLegModelTests, TestForwardDynamicsContactsDirectFootmodel)
unsigned int upper_leg_left_id
Describes all properties of a single body.
ConstraintSet constraint_set_both
void init_model(Model *model)
unsigned int lower_leg_right_id
unsigned int foot_left_id
bool bound
Whether the constraint set was bound to a model (mandatory!).
ConstraintSet constraint_set_right
ConstraintSet constraint_set_left_flat
SpatialTransform Xtrans(const Vector3d &r)
Get pure translation transform.
unsigned int addConstraint(unsigned int body_id, const Math::Vector3d &body_point, const Math::Vector3d &world_normal, const char *constraint_name=NULL, double normal_acceleration=0.)
Adds a constraint to the constraint set.
std::vector< Math::Vector3d > point
Math::FrameVector calcPointAcceleration(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &QDDot, unsigned int body_id, const Math::Vector3d &point_position, bool update_kinematics=true)
Computes the linear acceleration of a point on a body.
int main(int argc, char **argv)
Math::MotionVector gravity
the cartesian vector of the gravity
Vector3d heel_point(0., 0., 0.)
Body lower_leg_right_body
unsigned int addBody(const unsigned int parent_id, const Math::SpatialTransform &joint_frame, const Joint &joint, const Body &body, std::string body_name="")
Connects a given body to the model.
Math::FrameVector calcPointVelocity(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, unsigned int body_id, const Math::Vector3d &point_position, bool update_kinematics=true)
Computes the velocity of a point on a body.
Structure that contains both constraint information and workspace memory.
unsigned int upper_leg_right_id
void copy_values(T *dest, const T *src, size_t count)
std::vector< unsigned int > body
Describes a joint relative to the predecessor body.
Vector3d joint_location[JointLocationLast]
unsigned int lower_leg_left_id
Vector3d medial_point(0., 0., 0.)
ConstraintSet constraint_set_left
unsigned int foot_right_id
Joint joint_txtyrz(SpatialVector(0., 0., 0., 1., 0., 0.), SpatialVector(0., 0., 0., 0., 1., 0.), SpatialVector(0., 0., 1., 0., 0., 0.))
double segment_mass[SegmentMassLast]
Contains all information about the rigid body model.
bool bind(const Model &model)
Initializes and allocates memory for the constraint set.
Math types such as vectors and matrices and utility functions.
void set(const Eigen::Vector3d &v)
double segment_lengths[SegmentLengthsNameLast]
static bool checkVector3dEpsilonClose(const RobotDynamics::Math::Vector3d &v1, const RobotDynamics::Math::Vector3d &v2, const double epsilon)
Vector3d com_position[COMNameLast]
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.
void forwardDynamicsLagrangian(Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, Math::VectorNd &QDDot, Math::MatrixNd &H, Math::VectorNd &C, Math::LinearSolver linear_solver=Math::LinearSolverColPivHouseholderQR, Math::SpatialForceV *f_ext=nullptr, bool update_kinematics=true)
Computes forward dynamics by building and solving the full Lagrangian equation.
unsigned int dof_count
number of degrees of freedoms of the model
Namespace for all structures of the RobotDynamics library.
Body upper_leg_right_body
Math::MatrixNd H
Workspace for the joint space inertia matrix.
unsigned int qdot_size
The size of the.
Vector3d rgyration[RGyrationLast]