Page 1 of 1

Custom joint code

Posted: Tue Feb 24, 2015 10:22 am
by manifik
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);

Re: Custom joint code

Posted: Thu Feb 26, 2015 3:31 pm
by aseth
What are the problems/errors you are getting?

Re: Custom joint code

Posted: Mon Mar 02, 2015 11:03 am
by manifik
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.