about rotate

Asked by xjin

I am trying to model a rigid body like this:

O.reset()
bo=[]
bo.append(O.bodies.append(sphere([0,0,0],1)))
bo.append(O.bodies.append(sphere([2,0,0],1)))
bo.append(O.bodies.append(sphere([4,0,0],1)))
bo.append(O.bodies.append(sphere([6,0,0],1)))
bo.append(O.bodies.append(sphere([8,0,0],1)))
bo.append(O.bodies.append(sphere([8,2,0],1)))
idclump=O.bodies.clump(bo)
s=O.bodies[-1]
s.state.blockedDOFs='xyzXYZ'

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Sphere_L3Geom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_L3Geom_FrictPhys_ElPerfPl()]
   ),
   NewtonIntegrator(gravity=(0,0,0),damping=0.4),
   CombinedKinematicEngine(ids=[s.id],comb=[TranslationEngine(translationAxis=Vector3(0,0,1),velocity=1),
   RotationEngine(angularVelocity=1,rotateAroundZero=1,rotationAxis=(0,1,0),zeroPoint=O.bodies[0].state.pos)])
]
O.dt=0.0005*PWaveTimeStep()

I try to make the rigid body rotate on the rotationaxis=(0,1,0),and the zeroPoint=O.bodies[0].state.pos. Meanwhile I need it to translate in the direction of z-coordinate. when I run the script, I find that it only rotates in a fixed situation.Can you give me some suggestion?
Thanks a lot!
xjin

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Best Jan Stránský (honzik) said :
#1

Hello,
the problem is with fixed zeroPoint. You have to update is each iteration
by PyRunner (at least if I guessed the intended behavior):

O.engines = [
   ...
   CombinedKinematicEngine(...,label='combEngine'),

 PyRunner(iterPeriod=1,command="rotEngine.zeroPoint=O.bodies[0].state.pos"),
]
rotEngine = combEngine.comb[1]

cheers
Jan

2016-11-01 17:18 GMT+01:00 xjin <email address hidden>:

> Question #403708 on Yade changed:
> https://answers.launchpad.net/yade/+question/403708
>
> Description changed to:
> I am trying to model a rigid body like this:
>
> O.reset()
> bo=[]
> bo.append(O.bodies.append(sphere([0,0,0],1)))
> bo.append(O.bodies.append(sphere([2,0,0],1)))
> bo.append(O.bodies.append(sphere([4,0,0],1)))
> bo.append(O.bodies.append(sphere([6,0,0],1)))
> bo.append(O.bodies.append(sphere([8,0,0],1)))
> bo.append(O.bodies.append(sphere([8,2,0],1)))
> idclump=O.bodies.clump(bo)
> s=O.bodies[-1]
> s.state.blockedDOFs='xyzXYZ'
>
> O.engines=[
> ForceResetter(),
> InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
> InteractionLoop(
> [Ig2_Sphere_Sphere_L3Geom()],
> [Ip2_FrictMat_FrictMat_FrictPhys()],
> [Law2_L3Geom_FrictPhys_ElPerfPl()]
> ),
> NewtonIntegrator(gravity=(0,0,0),damping=0.4),
> CombinedKinematicEngine(ids=[s.id],comb=[TranslationEngine(
> translationAxis=Vector3(0,0,1),velocity=1),
> RotationEngine(angularVelocity=1,rotateAroundZero=1,
> rotationAxis=(0,1,0),zeroPoint=O.bodies[0].state.pos)])
> ]
> O.dt=0.0005*PWaveTimeStep()
>
>
> I try to make the rigid body rotate on the rotationaxis=(0,1,0),and the
> zeroPoint=O.bodies[0].state.pos. Meanwhile I need it to translate in the
> direction of z-coordinate. when I run the script, I find that it only
> rotates in a fixed situation.Can you give me some suggestion?
> Thanks a lot!
> xjin
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
xjin (jpeng22) said :
#2

Thanks Jan Stránský, that solved my question.

Revision history for this message
xjin (jpeng22) said :
#3

Thanks for Jan Stránský (honzik), your answer help me solve the problem!