Commits

Martin Felis committed 29d8b94

removed Model::Init() function (initialization is now done in the constructor)

  • Participants
  • Parent commits 4af2cf9
  • Branches dev

Comments (0)

Files changed (17)

addons/benchmark/benchmark.cc

 double contacts_benchmark (int sample_count, ContactsBenchmark contacts_benchmark) {
 	// initialize the human model
 	Model *model = new Model();
-	model->Init();
 	generate_human36model(model);
 
 	// initialize the constraint sets
 	Model *model = NULL;
 
 	model = new Model();
-	model->Init();
 	generate_human36model (model);
 	cout << "Human dofs = " << model->dof_count << endl;
 	delete model;
 		cout << "= Forward Dynamics: ABA =" << endl;
 		for (int depth = 1; depth <= benchmark_model_max_depth; depth++) {
 			model = new Model();
-			model->Init();
 			model->gravity = Vector3d (0., -9.81, 0.);
 
 			generate_planar_tree (model, depth);
 		cout << "= Forward Dynamics: Lagrangian (Piv. LU decomposition) =" << endl;
 		for (int depth = 1; depth <= benchmark_model_max_depth; depth++) {
 			model = new Model();
-			model->Init();
 			model->gravity = Vector3d (0., -9.81, 0.);
 
 			generate_planar_tree (model, depth);
 		cout << "= Inverse Dynamics: RNEA =" << endl;
 		for (int depth = 1; depth <= benchmark_model_max_depth; depth++) {
 			model = new Model();
-			model->Init();
 			model->gravity = Vector3d (0., -9.81, 0.);
 
 			generate_planar_tree (model, depth);
 		cout << "= Joint Space Inertia Matrix: CRBA =" << endl;
 		for (int depth = 1; depth <= benchmark_model_max_depth; depth++) {
 			model = new Model();
-			model->Init();
 			model->gravity = Vector3d (0., -9.81, 0.);
 
 			generate_planar_tree (model, depth);

addons/luamodel/rbdl_luamodel_util.cc

 	}
 
 	RigidBodyDynamics::Model model;
-	model.Init();
 
 	if (!RigidBodyDynamics::Addons::LuaModelReadFromFile(filename.c_str(), &model, verbose)) {
 		cerr << "Loading of lua model failed!" << endl;

examples/luamodel/example_luamodel.cc

 	Model* model = NULL;
 
 	model = new Model();
-	model->Init();
 
 	if (!Addons::LuaModelReadFromFile ("./samplemodel.lua", model, true)) {
 		std::cerr << "Error loading model ./samplemodel.lua" << std::endl;

examples/simple/example.cc

 	Joint joint_a, joint_b, joint_c;
 
 	model = new Model();
-	model->Init();
 
 	model->gravity = Vector3d (0., -9.81, 0.);
 

include/rbdl/Model.h

  *
  * All model related values are stored in the model structure \link
  * RigidBodyDynamics::Model\endlink. The functions 
- * \link RigidBodyDynamics::Model::Init Model::Init()\endlink,
  * \link RigidBodyDynamics::Model::AddBody Model::AddBody(...)\endlink,
  * \link RigidBodyDynamics::Model::AppendBody Model::AppendBody(...)\endlink, and
  * \link RigidBodyDynamics::Model::GetBodyId Model::GetBodyId(...)\endlink,
- * are used to initialize and construct the \ref model_structure.
+ * are used to construct the \ref model_structure.
  *
  * \section model_construction Model Construction
  *
  * \note To query the number of degrees of freedom use Model::dof_count.
  */
 struct Model {
+	Model();
+
 	// Structural information
 
 	/// \brief The id of the parents body
 		}
 		return false;
 	}
-	/// \brief Initializes the helper values for the dynamics algorithm
-	void Init ();
 };
 
 /** @} */
 using namespace RigidBodyDynamics;
 using namespace RigidBodyDynamics::Math;
 
-void Model::Init() {
+Model::Model() {
 	Body root_body;
 	Joint root_joint;
 

tests/CalcVelocitiesTests.cc

 	ModelVelocitiesFixture () {
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 
 		body_a = Body (1., Vector3d (1., 0., 0.), Vector3d (1., 1., 1.));
 		joint_a = Joint(
 	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,
 	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,

tests/CompositeRigidBodyTests.cc

 	CompositeRigidBodyFixture () {
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 		model->gravity = Vector3d (0., -9.81, 0.);
 	}
 	~CompositeRigidBodyFixture () {

tests/ContactsTests.cc

 	FixedBase6DoF9DoF () {
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 
 		model->gravity = Vector3d  (0., -9.81, 0.);
 
 	FixedBase6DoF12DoFFloatingBase () {
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 
 		model->gravity = Vector3d  (0., -9.81, 0.);
 
 // 
 TEST ( TestForwardDynamicsContactsLagrangianSimple ) {
 	Model model;
-	model.Init();
 	model.gravity = Vector3d  (0., -9.81, 0.);
 	Body base_body (1., Vector3d (0., 0., 0.), Vector3d (1., 1., 1.));
 	unsigned int base_body_id = model.SetFloatingBaseBody(base_body);
 
 TEST ( TestForwardDynamicsContactsLagrangianMoving ) {
 	Model model;
-	model.Init();
 	model.gravity = Vector3d  (0., -9.81, 0.);
 	Body base_body (1., Vector3d (0., 0., 0.), Vector3d (1., 1., 1.));
 	unsigned int base_body_id = model.SetFloatingBaseBody(base_body);

tests/DynamicsTests.cc

 	DynamicsFixture () {
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 		model->gravity = Vector3d (0., -9.81, 0.);
 	}
 	~DynamicsFixture () {
 
 TEST (TestForwardDynamicsLagrangian) {
 	Model model;
-	model.Init();
 	Body base_body(1., Vector3d (1., 0., 0.), Vector3d (1., 1., 1.));
 
 	model.SetFloatingBaseBody(base_body);
  */
 TEST (TestForwardDynamics3DoFModel) {
 	Model model;
-	model.Init();
 
 	model.gravity = Vector3d (0., -9.81, 0.);
 
  */
 TEST (TestForwardDynamics3DoFModelLagrangian) {
 	Model model;
-	model.Init();
 
 	model.gravity = Vector3d (0., -9.81, 0.);
 
 
 	model = new Model();
 
-	model->Init();
-
 	model->gravity = Vector3d (0., -9.81, 0.);
 
 	joint_rot_z = Joint (JointTypeRevolute, Vector3d (0., 0., 1.));
 
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 
 		/* Basically a model like this, where X are the Center of Masses
 		 * and the CoM of the last (3rd) body comes out of the Y=X=0 plane.
 
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 
 		model->gravity = Vector3d  (0., -9.81, 0.);
 
 
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 
 		model->gravity = Vector3d  (0., -9.81, 0.);
 
 	SimpleFixture () {
 		ClearLogOutput();
 		model = new RigidBodyDynamics::Model;
-		model->Init();
 		model->gravity = RigidBodyDynamics::Math::Vector3d (0., -9.81, 0.);
 	}
 	~SimpleFixture () {
 
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 
 		/* Basically a model like this, where X are the Center of Masses
 		 * and the CoM of the last (3rd) body comes out of the Y=X=0 plane.
 
 		ClearLogOutput();
 		model_movable = new Model;
-		model_movable->Init();
 
 		/* Basically a model like this, where X are the Center of Masses
 		 * and the CoM of the last (3rd) body comes out of the Y=X=0 plane.
 
 		// Assemble the fixed joint model
 		model_fixed = new Model;
-		model_fixed->Init();
 
 		body_a_fixed_id = model_fixed->AddBody(0, Xtrans(Vector3d(0., 0., 0.)), joint_a, body_a);
 		Joint joint_fixed (JointTypeFixed);

tests/FloatingBaseTests.cc

 	FloatingBaseFixture () {
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 		model->gravity = Vector3d (0., -9.81, 0.);
 
 		base = Body (1., Vector3d (1., 0., 0.), Vector3d (1., 1., 1.));

tests/ImpulsesTests.cc

 	ImpulsesFixture () {
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 
 		model->gravity = Vector3d (0., -9.81, 0.);
 

tests/InverseDynamicsTests.cc

 	InverseDynamicsFixture () {
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 		model->gravity = Vector3d  (0., -9.81, 0.);
 	}
 	~InverseDynamicsFixture () {

tests/KinematicsTests.cc

 	KinematicsFixture () {
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 
 		/* Basically a model like this, where X are the Center of Masses
 		 * and the CoM of the last (3rd) body comes out of the Y=X=0 plane.
 	KinematicsFixture6DoF () {
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 
 		model->gravity = Vector3d  (0., -9.81, 0.);
 
 
 TEST(TestCalcPointJacobian) {
 	Model model;
-	model.Init();
 	Body base_body (1., Vector3d (0., 0., 0.), Vector3d (1., 1., 1.));
 	unsigned int base_body_id = model.SetFloatingBaseBody(base_body);
 
 	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,
 	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,
 	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,
 	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,
 	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,
 	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,

tests/ModelTests.cc

 	ModelFixture () {
 		ClearLogOutput();
 		model = new Model;
-		model->Init();
 		model->gravity = Vector3d (0., -9.81, 0.);
 	}
 	~ModelFixture () {
 			);
 
 	Model model_std;
-	model_std.Init();
 	model_std.gravity = Vector3d (0., -9.81, 0.);
 
 	model_std.AddBody(0, Xtrans(Vector3d(1., 0., 0.)), joint_rot_z, null_body); 
 		);
 
 	Model model_2;
-	model_2.Init();
 	model_2.gravity = Vector3d (0., -9.81, 0.);
 
 	model_2.AddBody(0, Xtrans(Vector3d(1., 0., 0.)), joint_rot_zx, body);
 			);
 
 	Model model_std;
-	model_std.Init();
 	model_std.gravity = Vector3d (0., -9.81, 0.);
 
 	unsigned int body_id;
 		);
 
 	Model model_2;
-	model_2.Init();
 	model_2.gravity = Vector3d (0., -9.81, 0.);
 
 	// in total we add two bodies to make sure that the transformations are
 			);
 
 	Model model_std;
-	model_std.Init();
 	model_std.gravity = Vector3d (0., -9.81, 0.);
 
 	unsigned int body_id;
 		);
 
 	Model model_2;
-	model_2.Init();
 	model_2.gravity = Vector3d (0., -9.81, 0.);
 
 	// in total we add two bodies to make sure that the transformations are
 	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,
 	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,
 	Body fixed_body(fixed_mass, fixed_com, Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,
 	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,
 	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,
 	Body fixed_body(1., Vector3d (1., 0.4, 0.4), Vector3d (1., 1., 1.));
 
 	Model model;
-	model.Init();
 
 	Joint joint_rot_z (
 			JointTypeRevolute,

tests/TwolegModelTests.cc

 void init_model () {
 	assert (model);
 
-	model->Init();
-
 	model->gravity = Vector3d (0., -9.81, 0.);
 
 	joint_rot_z = Joint (JointTypeRevolute, Vector3d (0., 0., 1.));