- This topic has 2 replies, 2 voices, and was last updated 8 years, 4 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Using SOFA › [SOLVED] Adding Forces to Mechanical Objects
Tagged: 64_bits, Linux_ubuntu, SOFA_1512
Hi Everyone,
I want to initialize a Mechanical Object by specifying the position, velocity, and initial forces on the object. I’ve stored the relevant variables in the position elements of vtk files, and I have loaded them with:
<MeshVTKLoader name=”positionLoader” filename=”object-position.vtu” />
<MeshVTKLoader name=”velocityLoader” filename=”object-velocity.vtu” />
<MeshVTKLoader name=”forceLoader” filename=”object-force.vtu” />
I then want to set the values of the mechanical object as follows:
<MechanicalObject name=”mechObj” template=”Vec3d” position=”@/positionLoader.position” velocity=”@/velocityLoader.position” force=”@/forceLoader.position” />
When I then examine the datas, I see that the correct values are stored in each of the references (…Loader.position) and the mechanical object has the correct values for the positions and velocities. However, the forces are all identically zero. The mechanical object shows the correct link to @/forceLoader.position.
Can anyone explain what I’m doing wrong?
Thanks for your kind help.
-J
Dear Jason,
Loading the initial positions and velocities of your object is indeed possible as you did. However, the vector “force” of the MechanicalObject is a bit different.
The vector force actually corresponds to the vector b in the matrix system Ax=b. b is the explicit forces applied to your object, computed by your forcefields. Therefore, it does not really make physically sense to define this input.
What kind of forces do you want to apply at the beginning of your simulation?
Cheers,
Hugo
In addition, the fact that your input file is not taken into account for the “force” might be due to the mappings. At the scene initialization, your file loads the initial “force” values, but when the backward init (bottom –> up visitors) is called, the mappings might erase these values and set a zero vector.
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.