← Back to team overview

yade-users team mailing list archive

[Question #690104]: torque

 

New question #690104 on Yade:
https://answers.launchpad.net/yade/+question/690104

Hi All,

I want to get the torque of a body.

I use the following code to get the torque as well as the force.
#####################
def coon():

	friction_force_cal0 = sum(O.forces.f(b)[0] for b in cylinderIDS)
	friction_force_cal1 = sum(O.forces.f(b)[1] for b in cylinderIDS)
	friction_force_cal2 = sum(O.forces.f(b)[2] for b in cylinderIDS)
	#friction_force_cal = sum(O.forces.f(b) for b in cylinderIDS)

	#torque_cal = sum(O.forces.t(b) for b in cylinderIDS)
	torque_cal0 = sum(O.forces.t(b)[0] for b in cylinderIDS)
	torque_cal1 = sum(O.forces.t(b)[1] for b in cylinderIDS)
	torque_cal2 = sum(O.forces.t(b)[2] for b in cylinderIDS)

	f_0=utils.sumForces(ids=cylinderIDS,direction =(1,0,0))
	f_1=utils.sumForces(ids=cylinderIDS,direction =(0,1,0))
	f_2=utils.sumForces(ids=cylinderIDS,direction =(0,0,1))
	torque_0 = utils.sumTorques(ids=cylinderIDS,axis = (1,0,0),axisPt = (0.2,0,0))
	torque_1 = utils.sumTorques(ids=cylinderIDS,axis = (0,1,0),axisPt = (0,0.2,0))	
	torque_2 = utils.sumTorques(ids=cylinderIDS,axis = (0,0,1),axisPt = (0,0,0.2))
	plot.addData(f1 =f_0,f2 = f_1,f3 = f_2, friction1 = friction_force_cal0,
		friction2 = friction_force_cal1, friction3 = friction_force_cal2,
		torque1 = torque_cal0, torque2 = torque_cal1, torque3 = torque_cal2,
		t1 = torque_0, t2 = torque_1,t3 = torque_2,unbalanced=unbalancedForce(),i=O.iter)

	plot.saveDataTxt('alldata.txt')

#######################
the results show that f1 = friction1, f2 = friction2, f3 = friction3. this testify the above code for forces.
while the code for torque don't give me the expeted results. (I'm thinking the t1 should be equal to torque1.)

I found that t1 = -t2.

I don't know which one is correct for the torque. 
or because of the axisPt so the torque is different.







-- 
You received this question notification because your team yade-users is
an answer contact for Yade.