Custom joint code

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Emil Walczak
Posts: 50
Joined: Fri Feb 06, 2015 6:45 am

Custom joint code

Post by Emil Walczak » Tue Feb 24, 2015 10:22 am

Hi, I'm makig a simulation of jaw movement with OpenSim and I want to use custom joint to represent temporomandibular joint behaviour but I'm having problems/errors propably with setting parameters for spatialTransform.

My code:

Code: Select all

	//LEFT DISC JOINT WITH GROUND

	SpatialTransform sTransform;
	sTransform[0].setCoordinateNames(OpenSim::Array<std::string>("coord1", 0, 0));
	sTransform[0].setFunction(new LinearFunction());



Vec3 DiscLlocationInParent(0, 0, 0), DiscLorientationInParent(0), DiscLlocationInBody(0), DiscLorientationInBody(0);
CustomJoint *DiscLToGround = new CustomJoint("DiscLToGround", maxillaire, DiscLlocationInParent, DiscLorientationInParent, *DiscL, DiscLlocationInBody, DiscLorientationInBody, sTransform,false);
	CoordinateSet& DiscLjointCoordinateSet = DiscLToGround->upd_CoordinateSet();

	double DiscLangleRange[2] = { -SimTK::Pi / 2, SimTK::Pi / 2 };
	double DiscLpositionRange[2] = { -1, 1 };
	DiscLjointCoordinateSet[0].setRange(DiscLangleRange);
	DiscLjointCoordinateSet[1].setRange(DiscLangleRange);
	DiscLjointCoordinateSet[2].setRange(DiscLangleRange);
	DiscLjointCoordinateSet[3].setRange(DiscLpositionRange);
	DiscLjointCoordinateSet[4].setRange(DiscLpositionRange);
	DiscLjointCoordinateSet[5].setRange(DiscLpositionRange);

User avatar
Ajay Seth
Posts: 136
Joined: Thu Mar 15, 2007 10:39 am

Re: Custom joint code

Post by Ajay Seth » Thu Feb 26, 2015 3:31 pm

What are the problems/errors you are getting?

User avatar
Emil Walczak
Posts: 50
Joined: Fri Feb 06, 2015 6:45 am

Re: Custom joint code

Post by Emil Walczak » Mon Mar 02, 2015 11:03 am

It works now! The error was a result of coordinates declaration for the CustomJoint.
CustomJoint is defined with spatialTransforms so if we put a declaration of coordinates it will give us an arror becouse that kind of declaration is not matching to CustomJoint class.

POST REPLY