body shift

Asked by Christian Jakob

Hi,

I want to shift a moving body (a box) and adapt its position relative to another body (clump). I tried this:

def readjustBoxes():
  for ii in id_boxes:
    O.bodies[ii].state.pos[2] = newposition

O.engines=O.engines+[PyRunner(iterPeriod=1000,command='readjustBoxes()')]

Unfortunately this does not work. Note, that i do want to shift the body with a given velocity, it should just appear with another position (without a erase-recreate procedure).

Is it possible somehow?

christian

Question information

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

Hi Christian,

not sure if it works (can't test it just now), but try

def readjustBoxes():
  for ii in id_boxes:
    oldPos = O.bodies[ii].state.pos
    O.bodies[ii].state.pos = Vector3(oldPos[0],oldPos[1],newpositionZ) #
i.e. setting pos a a whole Vector3 instance

cheers
Jan

2013/9/9 Christian Jakob <email address hidden>

> New question #235405 on Yade:
> https://answers.launchpad.net/yade/+question/235405
>
> Hi,
>
> I want to shift a moving body (a box) and adapt its position relative to
> another body (clump). I tried this:
>
> def readjustBoxes():
> for ii in id_boxes:
> O.bodies[ii].state.pos[2] = newposition
>
> O.engines=O.engines+[PyRunner(iterPeriod=1000,command='readjustBoxes()')]
>
> Unfortunately this does not work. Note, that i do want to shift the body
> with a given velocity, it should just appear with another position (without
> a erase-recreate procedure).
>
> Is it possible somehow?
>
> christian
>
> --
> You received this question notification because you are a member of
> yade-users, which 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
Best Bruno Chareyre (bruno-chareyre) said :
#2

Note sure I get what you are trying to do, but maybe have a look here:
https://www.yade-dem.org/doc/user.html#imposed-velocity
I added this section recently.
Namely:///"modifying the position directly is likely to break Yade’s
algorithms//"/

If you want to go from position x0 to x1, then impose the velocity
(x1-x0)/dt for this step.

Revision history for this message
Christian Jakob (jakob-ifgt) said :
#3

Thanks Bruno Chareyre, that solved my question.

Revision history for this message
Alexander Eulitz [Eugen] (kubeu) said :
#4

Ah, good to read this. I wanted to modify bodies position recently, too.
Great, that this part of the documentation has been detailed.
Thank you!