Couldn't build model after I add CoordinateSet

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Hao Lee
Posts: 32
Joined: Sun Jun 12, 2016 11:52 pm

Couldn't build model after I add CoordinateSet

Post by Hao Lee » Fri Nov 11, 2016 1:39 am

I try to build my own model from my solidwork files, but it crashes after I add CoordinateSet
I believe I follow the tutorial
My code looks like this

Code: Select all

	
	double lHipJointMidMass=0.03685667;
	Vec3 lHipJointMidMassCenter(-0,0.03979000,0);
	Inertia lHipJointMidInertia(Mat33(0.00001597,0.00000000,0.00000000,0.00000000,0.00000479,0.00000000,0.00000000,0.00000000,0.00001597));
	OpenSim::Body *lHipJointMid = new OpenSim::Body("lHipJointMid",lHipJointMidMass,lHipJointMidMassCenter,lHipJointMidInertia);
	lHipJointMid->addDisplayGeometry("..\\Geometry\\exo\\JointMid.STL");
	Vec3 lHipJointMidOriParent(Vec3(SimTK::Pi,0,0));
	Vec3 lHipJointMidLocatParent(Vec3(0,0.017144999999999994,-0.017145000000000001));
	Vec3 lHipJointMidLocatBody(Vec3(0,0.062434999999994439,-0.016645000000000042));
	Vec3 lHipJointMidOriBody(Vec3(SimTK::Pi,0,0));
	PinJoint *lHipJointMidToTop=new PinJoint("lHipJointMidToTop",*lHipJointTop,lHipJointMidLocatParent,lHipJointMidOriParent,*lHipJointMid,lHipJointMidLocatBody,lHipJointMidOriBody);
	CoordinateSet& lHipJointMidToTopCorSet = lHipJointMidToTop->upd_CoordinateSet();
	lHipJointMidToTopCorSet[0].setRange(angleRange);
	lHipJointMidToTopCorSet[1].setRange(angleRange);
	lHipJointMidToTopCorSet[2].setRange(angleRange);
	lHipJointMidToTopCorSet[3].setRange(positionRange);
	lHipJointMidToTopCorSet[4].setRange(positionRange);
	lHipJointMidToTopCorSet[5].setRange(positionRange);
	osimModel.addBody(lHipJointMid);
Is there any problem with it?

User avatar
Vinh Nguyen
Posts: 21
Joined: Fri Sep 26, 2014 8:53 pm

Re: Couldn't build model after I add CoordinateSet

Post by Vinh Nguyen » Fri Nov 11, 2016 5:06 pm

I might know why it crashes.
your "lHipJointMidToTop" joint is a pin joint, so it has only 1 degree of freedom.
That means you can only access lHipJointMidToTopCorSet[0].
Try delete the other and build again.

Vinh

User avatar
Hao Lee
Posts: 32
Joined: Sun Jun 12, 2016 11:52 pm

Re: Couldn't build model after I add CoordinateSet

Post by Hao Lee » Sat Nov 12, 2016 5:59 am

thanks!!! my problem is solved now

POST REPLY