Forum Replies Created
-
AuthorPosts
-
NassimBlocked
Hello,
Thank you really much for your answer, it worked well.
My controller is now efficient.
After that, I wanted to add some parts to my jumping cylinder.First, I have add an other cylinder which represents a body, and two others cylinders which represent the arms.
I have created one big node, called body, which contains all the different part.
To link, the different part, I used the same technique which helps us to create the link between the fiber and the cylinder : the barycentric Mapping.How ever, I have some trouble to fix the arm with the body, because just like the human body, there is an angle between the body and the arms, and the barycentric mapping can’t create the link properly.
Is there an other way to create that link?
(I tried the rigid Mapping, but the arm didn’t stay fixe to the body)Moreover, the calculation time and the scene became really slow when I have created my node “Body” and put the solvers( EulerImplicit,CGLinear), and I don’t know why.
Here is my code with the other parts added :<Node name="root" gravity="0 -9.81 0" dt="0.1"> <!-- Basic Components to perform the collision detection --> <RequiredPlugin name="SofaPython" pluginName="SofaPython" /> <RequiredPlugin pluginName='SofaMiscCollision'/> <GenericConstraintSolver tolerance="0.001" maxIterations="1000"/> <VisualStyle displayFlags="showBehaviorModels showForceFields showVisual showWireframe" /> <DefaultMotionAnimationLoop /> <DefaultPipeline name="DefaultCollisionPipeline" verbose="0" /> <BruteForceDetection name="Detection" /> <MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" /> <DefaultContactManager name="Response" /> <DefaultCollisionGroupManager name="Group" /> <CollisionResponse name="Response" response="FrictionContact" responseParams="10"/> <CollisionGroup name="Group" /> <Node name="Floor"> <MeshTopology name="Topology Floor" filename="mesh/floorFlat.obj" /> <MechanicalObject name="Particles Floor" /> <UncoupledConstraintCorrection /> <PointModel name="FrictionCoeff" contactFriction="100" /> <TetrahedronModel name="FrictionCoeff4" contactFriction="1" /> <TriangleModel name="Triangle For Collision Floor" moving="0" simulated="0" /> <LineModel name="Lines For Collision" moving="0" simulated="0" /> <PointModel name="Points For Collision" moving="0" simulated="0"/> </Node> <Node name="Body" activated="1"> <EulerImplicitSolver name="cg_odesolver" printLog="0" /> <CGLinearSolver name="linear solver" template="GraphScattered" iterations="50" tolerance="1e-10" threshold="1e-10" /> <Node name="Cylinder" activated="1"> <MeshGmshLoader name="loader" filename="mesh/cylinder.msh" /> <EulerImplicitSolver name="cg_odesolver" printLog="0" /> <CGLinearSolver name="linear solver" template="GraphScattered" iterations="25" tolerance="1e-09" threshold="1e-09" /> <TetrahedronSetTopologyContainer src="@loader" name="Topology Container" fileTopology="mesh/cylinder.msh" /> <TetrahedronSetTopologyModifier name="Topology Modifier" /> <TetrahedronSetTopologyAlgorithms name="Topology Algorithms" template="Vec3d" /> <TetrahedronSetGeometryAlgorithms name="Geometry Algorithms" template="Vec3d" /> <MechanicalObject src="@loader" name="Cylinder" template="Vec3d" translation="0 16 0" rotation="90 0 0" scale="12" /> <TetrahedronFEMForceField name="FEM" template="Vec3d" method="polar" poissonRatio="0.32" youngModulus="1300" assembling="0" /> <UniformMass name="Mass" template="Vec3d" totalMass="2" /> <Node name="Visual Model"> <OglModel name="Visual" template="ExtVec3f" color="green" /> <IdentityMapping name="Mapping" template="Vec3d,ExtVec3f" input="@.." output="@Visual" /> </Node> <Node name="Collision Model"> <Mesh name="Cylinder Mesh" filename="mesh/cylinder.obj" /> <MechanicalObject name="Collision" /> <Triangle name="Cube Triangle For Collision" /> <Line name="Cube Edge For Collision" /> <Point name="Cube Point For Collision" /> <IdentityMapping name="RigidMapping Collision-RigidDOF" input="@../Cylinder" output="@Collision" /> </Node> <Node name="Wire1"> <EulerImplicitSolver name="cg_odesolver" printLog="0" /> <CGLinearSolver name="linear solver" template="GraphScattered" iterations="25" tolerance="1e-09" threshold="1e-09" /> <CylinderGridTopology name="Regular Mesh1" n="5 5 5" axis="0 1 0" radius="0.5" length="12" /> <MechanicalObject name="DOFs1" template="Vec3d" translation="-1.45 4 0" rotation="0 0 0" /> <TetrahedronFEMForceField name="FEM1" template="Vec3d" method="polar" poissonRatio="0.3" youngModulus="28.2" assembling="0" /> <UniformMass name="Mass1" template="Vec3d" totalmass="0.5" /> <BarycentricMapping name="Mapping-fiber2" output="@." input="@.." /> <PythonScriptController filename="ForceControl.py" classname="KeyboardControl" listening="true"/> <Node name="Visual Model"> <OglModel name="Visual1" template="ExtVec3f" color="blue" /> <IdentityMapping name="Mapping1" template="Vec3d,ExtVec3f" input="@.." output="@Visual1" /> </Node> </Node> <Node name="Wire2"> <EulerImplicitSolver name="cg_odesolver" printLog="0" /> <CGLinearSolver name="linear solver" template="GraphScattered" iterations="25" tolerance="1e-09" threshold="1e-09" /> <CylinderGridTopology name="Regular Mesh2" n="5 5 5" axis="0 1 0" radius="0.5" length="12" /> <MechanicalObject name="DOFs2" template="Vec3d" translation="1.45 4 0" rotation="0 0 0" /> <TetrahedronFEMForceField name="FEM2" template="Vec3d" method="polar" poissonRatio="0.3" youngModulus="28.2" assembling="0" /> <UniformMass name="Mass2" template="Vec3d" totalMass="0.5" /> <BarycentricMapping name="Mapping-fiber2" output="@." input="@.." /> <PythonScriptController filename="ForceControl.py" classname="KeyboardControl" listening="true"/> <Node name="Visual Model"> <OglModel name="Visual2" template="ExtVec3f" color="blue" /> <IdentityMapping name="Mapping2" template="Vec3d,ExtVec3f" input="@.." output="@Visual2" /> </Node> </Node> </Node> <Node name="corps"> <EulerImplicitSolver name="cg_odesolver" printLog="0" /> <CGLinearSolver name="linear solver" template="GraphScattered" iterations="50" tolerance="1e-09" threshold="1e-09" /> <CylinderGridTopology name="Regular Mesh3" n="5 5 5" axis="0 1 0" radius="0.5" length="12" /> <MechanicalObject name="DOFs3" template="Vec3d" translation="0 15 0" rotation="0 0 0" /> <TetrahedronFEMForceField name="FEM3" template="Vec3d" method="polar" poissonRatio="0.3" youngModulus="28.2" assembling="0" /> <UniformMass name="Mass3" template="Vec3d" totalmass="0.1" /> <BarycentricMapping name="Mapping-fiber3" output="@." input="@../Cylinder" /> <!-- <ConstantForceField force="5 0 0 0 0 0" /> --> <Node name="Visual Model"> <OglModel name="Visual3" template="ExtVec3f" color="red" /> <IdentityMapping name="Mappng3" template="Vec3d,ExtVec3f" input="@.." output="@Visual3" /> </Node> </Node> <Node name="bras1"> <EulerImplicitSolver name="cg_odesolver" printLog="0" /> <CGLinearSolver name="linear solver" template="GraphScattered" iterations="50" tolerance="1e-09" threshold="1e-09" /> <CylinderGridTopology name="Regular Mesh3" n="5 5 5" axis="0 1 0" radius="0.3" length="8" /> <MechanicalObject name="DOFs4" template="Vec3d" translation="0 24 0.5" rotation="120 0 0" /> <TetrahedronFEMForceField name="FEM4" template="Vec3d" method="polar" poissonRatio="0.3" youngModulus="28.2" assembling="0" /> <UniformMass name="Mass4" template="Vec3d" totalmass="0.1" /> <RigidMapping name="Mapping-fiber4" output="@." input="@../corps" /> <Node name="Visual Model"> <OglModel name="Visual4" template="ExtVec3f" color="blue" /> <IdentityMapping name="Mapping4" template="Vec3d,ExtVec3f" input="@.." output="@Visual4" /> </Node> </Node> <Node name="bras2"> <EulerImplicitSolver name="cg_odesolver" printLog="0" /> <CGLinearSolver name="linear solver" template="GraphScattered" iterations="25" tolerance="1e-09" threshold="1e-09" /> <CylinderGridTopology name="Regular Mesh3" n="5 5 5" axis="0 1 0" radius="0.3" length="8" /> <MechanicalObject name="DOFs5" template="Vec3d" translation="0 24 -0.5" rotation="120 180 0" /> <TetrahedronFEMForceField name="FEM4" template="Vec3d" method="polar" poissonRatio="0.3" youngModulus="28.2" assembling="0" /> <UniformMass name="Mass5" template="Vec3d" totalmass="0.1" /> <BarycentricMapping name="Mapping-fiber5" output="@." input="@../corps" /> <Node name="Visual Model"> <OglModel name="Visual5" template="ExtVec3f" color="blue" /> <IdentityMapping name="Mapping5" template="Vec3d,ExtVec3f" input="@.." output="@Visual5" /> </Node> </Node> </Node> </Node>
Thank you really much for your help !
Best regards,
Nassim
NassimBlockedHi @Hugo,
The method of the mapping works well to combine the fibers and the cylinder, how ever, i have some troubles concerning the control of the fibers.
I have created a Python controller which helps me to create a constantForceField.Then I have put this controller in the Node of the fiber.
However, even if the force is created, it does nothing on the big cylinder. It’s acting as if there was no ForceField.
I tried my Controller on the big cylinder, it works and it creates a movement, how ever, when I’m trying to control the fibers nothing happen and I don’t know why.
I think the problem is caused by the BarycentricMapping. The fiber is considered as the child of the cylinder, and when I’m applying force on the fiber, it doesn’t affect the parent cylinder. However, in the opposite case, if I apply a force on the parent cylinder, it is transmitted to the child fiber.
What can I do in order to apply a force on the child fiber which is transmitted to the parent cylinder?Here is my code and the file for the controller :
<Node name=”root” gravity=”0 -1 0″ dt=”0.1″> <!– Basic Components to perform the collision detection –> <RequiredPlugin name=”SofaPython” pluginName=”SofaPython” /> <RequiredPlugin pluginName=’SofaMiscCollision’/> <GenericConstraintSolver tolerance=”0.001″ maxIterations=”1000″/> <VisualStyle displayFlags=”showBehaviorModels showForceFields showVisual showWireframe” /> <DefaultMotionAnimationLoop /> <DefaultPipeline name=”DefaultCollisionPipeline” verbose=”0″ /> <BruteForceDetection name=”Detection” /> <MinProximityIntersection name=”Proximity” alarmDistance=”0.8″ contactDistance=”0.5″ /> <DefaultContactManager name=”Response” /> <DefaultCollisionGroupManager name=”Group” /> <CollisionResponse name=”Response” response=”FrictionContact” responseParams=”10″/> <CollisionGroup name=”Group” /> <Node name=”Floor”> <MeshTopology name=”Topology Floor” filename=”mesh/floorFlat.obj” /> <MechanicalObject name=”Particles Floor” /> <UncoupledConstraintCorrection /> <PointModel name=”FrictionCoeff” contactFriction=”100″ /> <TetrahedronModel name=”FrictionCoeff4″ contactFriction=”1″ /> <TriangleModel name=”Triangle For Collision Floor” moving=”0″ simulated=”0″ /> <LineModel name=”Lines For Collision” moving=”0″ simulated=”0″ /> <PointModel name=”Points For Collision” moving=”0″ simulated=”0″/> </Node> <!–Test de cylindre 2 –> <Node name=”Cylinder” activated=”1″> <MeshGmshLoader name=”loader” filename=”mesh/cylinder.msh” /> <EulerImplicitSolver name=”cg_odesolver” printLog=”0″ /> <CGLinearSolver name=”linear solver” template=”GraphScattered” iterations=”25″ tolerance=”1e-09″ threshold=”1e-09″ /> <TetrahedronSetTopologyContainer src=”@loader” name=”Topology Container” fileTopology=”mesh/cylinder.msh” /> <TetrahedronSetTopologyModifier name=”Topology Modifier” /> <TetrahedronSetTopologyAlgorithms name=”Topology Algorithms” template=”Vec3d” /> <TetrahedronSetGeometryAlgorithms name=”Geometry Algorithms” template=”Vec3d” /> <TetrahedronModel name=”Models” /> <TetrahedronModel name=”FrictionCoeff2″ contactFriction=”1″ /> <MechanicalObject src=”@loader” name=”Cylinder” template=”Vec3d” translation=”0 16 0″ rotation=”90 0 0″ scale=”12″ /> <TetrahedronFEMForceField name=”FEM” template=”Vec3d” method=”polar” poissonRatio=”0.3″ youngModulus=”1500″ assembling=”0″ /> <UniformMass name=”Mass” template=”Vec3d” totalmass=”300″ /> <Node name=”Visual Model”> <OglModel name=”Visual” template=”ExtVec3f” color=”green” /> <IdentityMapping name=”Mapping” template=”Vec3d,ExtVec3f” input=”@..” output=”@Visual” /> </Node> <Node name=”Collision Model”> <Mesh name=”Cylinder Mesh” filename=”mesh/cylinder.obj” /> <MechanicalObject name=”Collision” /> <Triangle name=”Cube Triangle For Collision” /> <Line name=”Cube Edge For Collision” /> <Point name=”Cube Point For Collision” /> <IdentityMapping name=”RigidMapping Collision-RigidDOF” input=”@../Cylinder” output=”@Collision” /> </Node> </Node> <Node name=”Wire2″> <EulerImplicitSolver name=”cg_odesolver” printLog=”0″ /> <CGLinearSolver name=”linear solver” template=”GraphScattered” iterations=”25″ tolerance=”1e-09″ threshold=”1e-09″ /> <CylinderGridTopology name=”Regular Mesh2″ n=”5 5 5″ axis=”0 1 0″ radius=”0.5″ length=”12″ /> <MechanicalObject name=”DOFs” template=”Vec3d” translation=”0 4 0″ rotation=”0 0 0″ /> <TetrahedronFEMForceField name=”FEM2″ template=”Vec3d” method=”polar” poissonRatio=”0.1″ youngModulus=”1300″ assembling=”0″ /> <UniformMass name=”Mass2″ template=”Vec3d” totalmass=”100″ /> <BarycentricMapping name=”Mapping-fiber2″ output=”@.” input=”@../Cylinder” /> <Node name=”Visual Model”> <OglModel name=”Visual2″ template=”ExtVec3f” color=”blue” /> <IdentityMapping name=”Mapping2″ template=”Vec3d,ExtVec3f” input=”@..” output=”@Visual2″ /> </Node> <PythonScriptController filename=”ForceControl.py” classname=”KeyboardControl” printLog=”true”/> </Node> </Node>
the controller and the files can be find here : https://drive.google.com/drive/folders/19NfVqqvVybeF3EtaNF4NhWqO6Klxja2F?usp=sharing
Thank you for your help to fix that problem !
Best regards,
Nassim
NassimBlockedHey @Hugo!
Thank you for your answer !I was thinking about the collision, but is there a way to put collision only on the external part of the cylinder? Cause when I’m putting collision, it also creates collision in the cylinder and then the muscle is stuck in the cylinder and collide everytime.
For the moment no, I’m gonna search about it, but I think that the python controller and a constraint force field is enough for my work at this level. I tried to look at the example of the use of this Plugin, but I can’t found any thing linked to the creation of Force with Python.
I worked on two models of my scene, one with muscle, and the other one with only some “fibers”.
I have a model with one and two fibers.
With these models, maybe it’s easier to put control on it, directly on the fibers.
Here are the files for these versions : https://drive.google.com/drive/folders/19NfVqqvVybeF3EtaNF4NhWqO6Klxja2F?usp=sharingActually I notice something with my scenes : Everytime, my cylinder is rotating a bit, and it doesn’t stop. It’s as if there was no friction between the cylinder and the ground( we can especially see that with the model with 1 fiber : “programmeVersionfil”).
How can I do to create this kind of friction with the ground to stop that rotational movement?Thank you for looking my scene and try on it!
Best regards,
Nassim
NassimBlockedHi Hugo,
Thanks for your advices ! I have write a new code, and correct the mistakes.
Here it is : https://drive.google.com/drive/folders/19NfVqqvVybeF3EtaNF4NhWqO6Klxja2F?usp=sharingIn this simulation the muscle present in the cylinder can go outside the boundaries of the cylinder, which is not realistic.. I don’t know how I can force the muscle to be confine in the cylinder. If you have any ideas I will be glad !
The cylinder is only for the collision with the ground. It’s the container for the muscle. thanks to this cylinder, the hopping movement ( bouncing) will be created. So the cylinder is in soft material.
The force to create this movement has to be created by the muscle. It’s the muscle who lead the movement. So for hopping, the muscle is retracting, which also make the cylinder retracting, and then a phase of release is present ( model of contraction and detente). Thanks to that, we could normally create a hopping movement for the robot.
I’m thinking how I can create a control of the force threw the muscle. I think a python controller will be necessary.I have also think about an other way to explore the hopping movement. Instead of a muscle, I will just create a wire model, with 4 wires side line which traverse the cylinder.
It will be this line model which will create directly the force on the cylinder to create the hopping movement. ( the line can be only line model, not even hill model)
This model is also acceptable due to the fact that my cylinder is already soft.
Again, if you think of something regardings the control of force and a way to do it, please let me know !Thank you for your precious help and your time !
Regards,
Nassim
-
AuthorPosts