Commits

Martin Felis committed e9fa708

fixed some more invalid initializations (i.e. not using VectorNd::Zero())

Comments (0)

Files changed (3)

 	if (H.rows() != Q.size() || H.cols() != Q.size()) 
 		H.resize(Q.size(), Q.size());
 
-	H.Zero(H.rows(), H.cols());
+	H.setZero();
 
 	unsigned int i;
 	for (i = 1; i < model.mBodies.size(); i++) {
 	// transformations etc.!
 
 	// Compute C
-	VectorNd QDDot_zero (model.dof_count);
+	VectorNd QDDot_zero = VectorNd::Zero (model.dof_count);
 	VectorNd C (model.dof_count);
 
 	InverseDynamics (model, Q, QDot, QDDot_zero, C);

tests/ContactsTests.cc

 			TEST_PREC
 			);
 
-	cout << "LagrangianSimple Logoutput Start" << endl;
-	cout << LogOutput.str() << endl;
-	cout << "LagrangianSimple Logoutput End" << endl;
+	// cout << "LagrangianSimple Logoutput Start" << endl;
+	// cout << LogOutput.str() << endl;
+	// cout << "LagrangianSimple Logoutput End" << endl;
 
 	/*
 	unsigned int i;

tests/DynamicsTests.cc

 // QDDot =  6.31843e-07 -6.12442e-07  9.22595e-14   3.3712e-07  4.27368e-07 -7.91795e-07   3.3712e-07  4.27368e-07 -7.91795e-07
 // QDDAB = -0.00192794    -9.81419        -0.2    0.198972 -0.00130243    0.100141    0.198972 -0.00130243    0.100141
 
-
 	ForwardDynamics (*model, Q, QDot, Tau, QDDotABA);
-
 	ClearLogOutput();
-
 	ForwardDynamicsLagrangian (*model, Q, QDot, Tau, QDDot);
 
-	cout << LogOutput.str() << endl;
+//	cout << LogOutput.str() << endl;
+
+	// run it again to make sure the calculations give the same results and
+	// no invalid state information lingering in the model structure is being used
+	ForwardDynamics (*model, Q, QDot, Tau, QDDotABA);
+	ClearLogOutput();
+	ForwardDynamicsLagrangian (*model, Q, QDot, Tau, QDDot);
 
 	CHECK_ARRAY_CLOSE (QDDotABA.data(), QDDot.data(), QDDotABA.size(), TEST_PREC);
 }