Martin  Felis avatar Martin Felis committed fb5fb39

moved tests to more logical places

Comments (0)

Files changed (3)

tests/BodyTests.cc

 	CHECK_ARRAY_CLOSE (reference_inertia.data(), body.mSpatialInertia.data(), 36, TEST_PREC);
 }
 
+TEST ( TestBodyConstructorMassComInertia ) {
+	double mass = 1.1;
+	Vector3d com (1.5, 1.2, 1.3);
+	Matrix3d inertia_C (
+			8.286, -3.96, -4.29,
+			-3.96, 10.668, -3.432,
+			-4.29, -3.432, 11.118
+			);
+
+	Body body (mass, com, inertia_C);
+
+	SpatialMatrix reference_inertia (
+			4.843, -1.98, -2.145, 0, -1.43, 1.32,
+			-1.98, 6.334, -1.716, 1.43, 0, -1.65,
+			-2.145, -1.716, 7.059, -1.32, 1.65, 0,
+			0, 1.43, -1.32, 1.1, 0, 0,
+			-1.43, 0, 1.65, 0, 1.1, 0,
+			1.32, -1.65, 0, 0, 0, 1.1
+			);
+
+	CHECK_ARRAY_CLOSE (reference_inertia.data(), body.mSpatialInertia.data(), 36, TEST_PREC);
+}
+
 TEST ( TestBodyJoinNullbody ) {
 	ClearLogOutput();
 	Body body(1.1, Vector3d (1.5, 1.2, 1.3), Vector3d (1.4, 2., 3.));
 	Body body_joined (body_a);
 	body_joined.Join (Xrotz(M_PI*0.5) * Xtrans(Vector3d (1., 1., 0.)), body_b);
 	
-	cout << LogOutput.str() << endl;
+	// cout << LogOutput.str() << endl;
 	// cout << "body_joined = " << endl << body_joined.mSpatialInertia << endl;
 
 	SpatialMatrix reference_inertia (
 	CHECK_ARRAY_CLOSE (Vector3d (0., 0., 0.).data(), body_joined.mCenterOfMass.data(), 3, TEST_PREC);
 	CHECK_ARRAY_CLOSE (reference_inertia.data(), body_joined.mSpatialInertia.data(), 36, TEST_PREC);
 }
-
-TEST ( TestBodyConstructorMassComInertia ) {
-	double mass = 1.1;
-	Vector3d com (1.5, 1.2, 1.3);
-	Matrix3d inertia_C (
-			8.286, -3.96, -4.29,
-			-3.96, 10.668, -3.432,
-			-4.29, -3.432, 11.118
-			);
-
-	Body body (mass, com, inertia_C);
-
-	SpatialMatrix reference_inertia (
-			4.843, -1.98, -2.145, 0, -1.43, 1.32,
-			-1.98, 6.334, -1.716, 1.43, 0, -1.65,
-			-2.145, -1.716, 7.059, -1.32, 1.65, 0,
-			0, 1.43, -1.32, 1.1, 0, 0,
-			-1.43, 0, 1.65, 0, 1.1, 0,
-			1.32, -1.65, 0, 0, 0, 1.1
-			);
-
-	CHECK_ARRAY_CLOSE (reference_inertia.data(), body.mSpatialInertia.data(), 36, TEST_PREC);
-}

tests/KinematicsTests.cc

 	effector = CalcBodyToBaseCoordinates(*model, Qres, body_ids[1], body_points[1], false);
 	CHECK_ARRAY_CLOSE (target_pos[1].data(), effector.data(), 3, 1.0e-1);	
 }
+
+TEST ( FixedJointBodyCalcBodyToBase ) {
+	// the standard modeling using a null body
+	Body null_body;
+	Body body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
+	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
+
+	Model model;
+	model.Init();
+
+	Joint joint_rot_z (
+			JointTypeRevolute,
+			Vector3d(0., 0., 1.)
+			);
+	model.AddBody (0, Xtrans(Vector3d(0., 0., 0.)), joint_rot_z, body);
+	unsigned int fixed_body_id = model.AppendBody (Xtrans(Vector3d(0., 1., 0.)), Joint(JointTypeFixed), fixed_body);
+
+	VectorNd Q_zero = VectorNd::Zero (model.dof_count);
+	Vector3d base_coords = CalcBodyToBaseCoordinates (model, Q_zero, fixed_body_id, Vector3d (1., 1., 0.1));
+
+	CHECK_ARRAY_CLOSE (Vector3d (1., 2., 0.1).data(), base_coords.data(), 3, TEST_PREC);
+}
+
+TEST ( FixedJointBodyCalcBaseToBody ) {
+	// the standard modeling using a null body
+	Body null_body;
+	Body body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
+	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
+
+	Model model;
+	model.Init();
+
+	Joint joint_rot_z (
+			JointTypeRevolute,
+			Vector3d(0., 0., 1.)
+			);
+	model.AddBody (0, Xtrans(Vector3d(0., 0., 0.)), joint_rot_z, body);
+	unsigned int fixed_body_id = model.AppendBody (Xtrans(Vector3d(0., 1., 0.)), Joint(JointTypeFixed), fixed_body);
+
+	VectorNd Q_zero = VectorNd::Zero (model.dof_count);
+	Vector3d base_coords = CalcBaseToBodyCoordinates (model, Q_zero, fixed_body_id, Vector3d (1., 2., 0.1));
+
+	CHECK_ARRAY_CLOSE (Vector3d (1., 1., 0.1).data(), base_coords.data(), 3, TEST_PREC);
+}

tests/ModelTests.cc

 
 	CHECK_ARRAY_CLOSE (QDDot_std.data(), QDDot_2.data(), model_std.dof_count, TEST_PREC);
 }
-
-TEST ( ModelFixedBodyCalcBodyToBase ) {
-	// the standard modeling using a null body
-	Body null_body;
-	Body body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
-	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
-
-	Model model;
-	model.Init();
-
-	Joint joint_rot_z (
-			JointTypeRevolute,
-			Vector3d(0., 0., 1.)
-			);
-	model.AddBody (0, Xtrans(Vector3d(0., 0., 0.)), joint_rot_z, body);
-	unsigned int fixed_body_id = model.AppendBody (Xtrans(Vector3d(0., 1., 0.)), Joint(JointTypeFixed), fixed_body);
-
-	VectorNd Q_zero = VectorNd::Zero (model.dof_count);
-	Vector3d base_coords = CalcBodyToBaseCoordinates (model, Q_zero, fixed_body_id, Vector3d (1., 1., 0.1));
-
-	CHECK_ARRAY_CLOSE (Vector3d (1., 2., 0.1).data(), base_coords.data(), 3, TEST_PREC);
-}
-
-TEST ( ModelFixedBodyCalcBaseToBody ) {
-	// the standard modeling using a null body
-	Body null_body;
-	Body body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
-	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
-
-	Model model;
-	model.Init();
-
-	Joint joint_rot_z (
-			JointTypeRevolute,
-			Vector3d(0., 0., 1.)
-			);
-	model.AddBody (0, Xtrans(Vector3d(0., 0., 0.)), joint_rot_z, body);
-	unsigned int fixed_body_id = model.AppendBody (Xtrans(Vector3d(0., 1., 0.)), Joint(JointTypeFixed), fixed_body);
-
-	VectorNd Q_zero = VectorNd::Zero (model.dof_count);
-	Vector3d base_coords = CalcBaseToBodyCoordinates (model, Q_zero, fixed_body_id, Vector3d (1., 2., 0.1));
-
-	CHECK_ARRAY_CLOSE (Vector3d (1., 1., 0.1).data(), base_coords.data(), 3, TEST_PREC);
-}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.