Body' state change
Hi,
If I have a body represented by a gts surface, I would like to know if it is possible to move this body.
During the simulation I would like to change the states of the body (position, rotation, velocity and angular velocity). Is it possible? Besides that, could I obtain the forces and torques acting on this body?
Thanks a lot.
Daniela
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
|
#1 |
1) There is a kinematic engine, which makes any kind of motions [1]. See also examples [2]
2) Forces and torques can be recordered by ForceTorqueRecorder [3]
[1] http://
[2] http://
[3] http://
Revision history for this message
|
#3 |
Hi Anton,
I took a look in the example that you sent me and tried to change it. My goal is that I can change for example the angular velocity of the RotationEngine at each iterPeriod. I tried it:
rotvel=0
O.engines=[
#SubdomainBala
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
GravityEngine(
NewtonIntegrat
RotationEngine(
ids=rotateIDs,
angularVeloci
rotationAxis=
rotateAroundZ
zeroPoint=
HarmonicMotion
HarmonicRotati
PyRunner(
]
def rotation():
global rotvel
rotvel = 100
but the value of rotvel seems to be always 0. How can I change then a variable located inside of the Engine?
Thanks, Daniela
Revision history for this message
|
#4 |
I think that you can use labels:
O.engines = [
...
SomeEngine(
...
]
sEngine.
good luck
Jan
_______
> Od: "Daniela" <email address hidden>
> Komu: <email address hidden>
> Datum: 06.07.2011 15:11
> Předmět: Re: [Yade-users] [Question #163736]: Body' state change
>
>Question #163736 on Yade changed:
>https:/
>
> Status: Solved => Open
>
>Daniela is still having a problem:
>Hi Anton,
>I took a look in the example that you sent me and tried to change it. My goal is that I can change for example the angular velocity of the RotationEngine at each iterPeriod. I tried it:
>
>rotvel=0
>O.engines=[
> #SubdomainBalan
> ForceResetter(),
> InsertionSortCo
> InteractionLoop(
> [Ig2_Sphere_
> [Ip2_FrictMat_
> [Law2_ScGeom_
> ),
> GravityEngine(
> NewtonIntegrato
> RotationEngine(
> ids=rotateIDs,
> angularVelocity
> rotationAxis=
> rotateAroundZero=1,
> zeroPoint=
> HarmonicMotionE
> HarmonicRotatio
> PyRunner(
>]
>def rotation():
> global rotvel
> rotvel = 100
>
>but the value of rotvel seems to be always 0. How can I change then a variable located inside of the Engine?
>Thanks, Daniela
>
>--
>You received this question notification because you are a member of
>yade-users, which is an answer contact for Yade.
>
>______
>Mailing list: https:/
>Post to : <email address hidden>
>Unsubscribe : https:/
>More help : https:/
>
Revision history for this message
|
#5 |
Hi Jan, it works with labels. Thanks!
I still have two questions:
1. I created a RotationEngine and a TranslationEngine, both with the same id, as want that a body (obtained from a mesh for example) has translational and rotational movement. But I see that just the one that is defined in the second place affects the body in the simulation. I saw that there is a CombinedKinemat
2. I want to change the position and orientation of the body at some iterations. Can I do it using some Engine? I cannot imagine that I can do this using the TranslationEngine, as with this Engine I can define just the velocity.
When I include the body with O.bodies.
So, I would be grateful if you could help me with these questions.
Thanks in advance, Daniela
Revision history for this message
|
#6 |
>1. I created a RotationEngine and a TranslationEngine, both with the
>same id, as want that a body (obtained from a mesh for example) has
>translational and rotational movement. But I see that just the one that
>is defined in the second place affects the body in the simulation. I saw
>that there is a CombinedKinemat
>use it for this case. Anyway, how should I proceed in order to have the
>rotation and translation engines acting on the body?
O.engines = [
...
RotationEngine(...) + TranslationalEn
...
]
>
>2. I want to change the position and orientation of the body at some iterations. Can I do it using some Engine? I cannot imagine that I can do this using the TranslationEngine, as with this Engine I can define just the velocity.
O.bodies[
but I am not sure if this works or not...
Jan
Revision history for this message
|
#7 |
Hi Jan, thanks again for the help.
It works what you suggested, but I still have some problems:
1. As I don't want to load the mesh in the begin of the simulation, I wrote a PyRunner that checks the unbalancedForce and loads the mesh. Inside of the def function I defined the new engine using O.engines = O.engine+
2.I also created a PyRunner to change the position of the body. The body is for example defined as:
body1=O.
It tried to make this
for b in O.bodies:
if (b in body1):b.state.pos = Vector3(1,1,1)
but it does not work. If I write body1.id, the message that I receive says that list don't have ids.
How could I then change the position of the body1?
Thansk a lot. Daniela
Revision history for this message
|
#8 |
Hi, the second problem I got to solve: if (b.id in body1):b.state.pos = Vector3(1,1,1)
Revision history for this message
|
#9 |
> 1. I created a RotationEngine and a TranslationEngine, both with the
> same id, as want that a body (obtained from a mesh for example) has
> translational and rotational movement. But I see that just the one that
> is defined in the second place affects the body in the simulation. I saw
> that there is a CombinedKinemat
> use it for this case. Anyway, how should I proceed in order to have the
> rotation and translation engines acting on the body?
Note that if your motion is not too complicated, e.g. constant velocity
or spin, you can do something like:
b=O.bodies[100]
b.state.
b.state.vel=(1,0,0) #impose a velocity
> 2. I want to change the position and orientation of the body at some iterations. Can I do it using some Engine? I cannot imagine that I can do this using the TranslationEngine, as with this Engine I can define just the velocity.
> When I include the body with O.bodies.
>
Basically, the chance that you break something by imposing position
shifts is high, because many DEM algorithms are based on velocity
(updating bounds, contact kinematics, viscous and/or incremental contact
laws, post-processing
consider this method:
b.state.
b.state.
O.run(1)
Then maybe release the body:
b.state.
b.state.vel=(0,0,0)
This is compatible with 100% of Yade algorithms.
Bruno
Revision history for this message
|
#10 |
Hi,
actually I have a file containing information about position, velocity, orientation and angular velocity for a body for many time steps. In this sense, what I need is to "tell" the body in yade these values during the simulation. I suppose that I could do it using the RotationEngine and the TranslationEngine, because then I could already define at least the velocity and the angular velocity. But I have 2 problems here:
1. when I make RotationEngine(
2. the zeroPoint must change, as the body also has a translation movement. Actually I could just give it the value of the position, but I still have the problem described above when I write rotEng.zeroPoint.
I hoppe someone can help me.
Thanks. Daniela
Revision history for this message
|
#11 |
Hi,
I have tried to solve my problem about moving bodies using to steps. At first I give the values of the new position and orientation (mantaining velocity and angular velocity zero) and then the values of the velocity and angular velocity (this one, using a RotationEngine), something like this:
def changeValues():
for i in idArray:
checker.
checker.
def changeValues2():
for i in idArray:
rotEng.
rotEng.
rotEng.
checker.
checker.
I have tested it and it seems to work ok. Can you confirm if this is really compatible with the Yade algorithms?
Thansk in advance, Daniela.
Revision history for this message
|
#13 |
Thanks Chareyre, that solved my question.