Forum Replies Created
-
AuthorPosts
-
RishabhBlocked
Hello @omar,
Good to see this thread. I am working on a similar robotics problem where I need the RGBD information from a virtual camera inside the simulation (possibly frame-by-frame while the simulation is running?)Is this possible? and can I change the view point as well?
Thanks,
RishabhRishabhBlockedHi @hugo, how are you?
I see that all the above mentioned PRs have been merged, thanks a lot for that!
I’m on the master branch now, and can’t update TriangularFEMForceField and TriangularBendingSprings. The values only take effect after I press the update button.So, I was thinking about implementing this by replicating the changes similar to the above PRs.
Can you please tell me about the recent updates on this? Which PRs do I have to replicate
Thanks,
RishabhRishabhBlockedHi @hugo
If it’s only about replicating the same changes I can give it a shot, but I see this PR is still not merged, are the changes safe?
Thanks,
RishabhRishabhBlockedHi @hugo
Thank you very much, I have started to work on this again, I moved to the master branch now and have been checking it out,
PR #1093 is about Stiff Springs, so does that mean the same change would not work for Bending Springs?Rishabh
RishabhBlockedHi @hugo, that’s good news !
Here’s a list of data fields that I think would be very useful for the robotics learning community in SOFA:
1. FEM Force fields – Young’s modulus, Poisson ratio
2. Spring Force fields – Stiffness, damping
3. Simulation timestep ‘dt’
4. If possible, being able to update the mesh structure of a object would be nice. For example changing from mesh/square2.msh to mesh/square2.msh.Currently I am using Euler Implicit solver and CGLinearSolver
Rishabh
RishabhBlockedOkay, alright, I see where the problem lies. I am working towards a paper deadline next month, so it won’t be possible to delve into this before that as you said it would require a bit of work.
But if the rayleigh stiffness is being able to update, would it be different to update other similar parameters as stiffness and damping?
Also, I have never looked into the source code, if it’s not too much work, could you point me towards which files to check
Rishabh
26 August 2019 at 12:17 in reply to: [SOLVED] Attach constraint and Fixed constraint difference #14159RishabhBlockedOkay, for now the simulation units mentioned in the script are alright. All my experiments are in simulation so that does not affect the problem. So yes, the numbers in the script can be used.
24 August 2019 at 13:05 in reply to: [SOLVED] Attach constraint and Fixed constraint difference #14153RishabhBlockedHi hugo, what do you mean by the unit of simulation?
Rishabh
14 August 2019 at 18:27 in reply to: [SOLVED] Attach constraint and Fixed constraint difference #14120RishabhBlockedHi @hugo,
The scene file can be found here in gist, https://gist.github.com/jangirrishabh/3753c2a877535a47c82a954cf6c5a168
I tried the ‘twoWay = True’ param but did not notice any change in the deformations. Although adjusting VelocityFactor, PositionFactor and radius parameters has some minor effects.
I need to move the red balls around as actuators, they are physical objects who can interact with the environment, and controlled by two other virtual input balls, whose position I am essentially changing (and having a spring force field between them). Am I doing something complex here? Is there an easy way to just move the red balls around without having to attach them to virtual balls with a force field
Thanks,
RishabhRishabhBlockedHello @Hugo,
I have a simulation of a cloth, and I want to change it’s physical parameters such as mass, damping and stiffness from BendingSprings force field, and YoungModulus and PoissonRatio from TriangularFEMForceField.
In Robotics we have a technique called Domain Randomization where we can directly transfer control policies from Simulation to a real robot by randomizing certain parameters in the simulation itself and learning a robust policy. I am intending to do the same for cloth simulation,
Currently I can change the UniformMass of the cloth, but I can not change any dynamical properties of the cloth (mentioned above) after reset except the Rayleigh stiffness (which is kinda odd).
But also I am on sofa v17.06, do you think you have anything better than this on the newer versions so that I can try? I would only move forward and invest time in the newer versions if you suggest
Thanks a lot, hope you are enjoying summers in France, it’s quite pleasant here in Barcelona too !
RishabhRishabhBlockedUPDATE:
Hello, on further investigation I found out that using ‘UniformMass’ instead of ‘DiagonalMass’ lets me update the mass of the object when resetting. But there are many other parameters of the cloth simulation, such as TriangularFEMForceField.youngModulus and TriangularBendingSprings.stiffness that I want to update but it is not happening in the simulation.
One interesting thing is that I am able to update the ‘rayleighstiffness’ but not the ‘stiffness’ of the springs. Any insights would be appreciated
Thank you,
RishabhRishabhBlockedHi @faichele,
Yes that worked, reinitializing positions in the reset function this way is the solution !
Thank you
RishabhBlockedHi @Hugo,
I believe so, but to not keep any margin of error, let me just post this new git file for you π
Gist files link: https://gist.github.com/jangirrishabh/ce96d4208d6be4e9cbaddf69870ef50f
Both files included here, they should work without any changes
Yes the version might be the culprit here, cause the red ball does not move if I do not update the free_position of the blue ball !
Merci,
RishabhRishabhBlockedHello @Hugo,
Thank you for your input, now the reference model is also moving. This is not what the problem was, but this really helps me to explain the problem better to you ! Let me use a video for explaining the problem,
Video: https://drive.google.com/file/d/1q2IwcQpYk8ZpJ3rk0Mo-MoH7QGQfzCkf/view?usp=sharing
Now here the red ball (which is attached to the blue ball through vectorSpringField) has collision, and it stops when an obstacle comes, but for the blue ball I can not put explicit sphere collision model (virtual object) and thus the blue ball keeps moving downwards. Thus my guess is that I need a kind of two-way constraint/springfield between these balls for achieving a good behavior.
Please note that my goal is solely to control motion of the red ball (under gravity) through the keyboard. Kindly help with your inputs
I had to make a little change for the red ball to follow the blue ball i.e. update the free_position of the Mechanical object as well:
if ord(k)==19: self.rootNode.reset() # DOWN key : rear if ord(k)==21: self.rootNode.cleanup() # LEFT key : left if ord(k)==23: free_position[0][1]-=speed self.MechanicalState.findData('position').value=free_position self.MechanicalState.free_position=free_position # RIGHT key : right if ord(k)==22: free_position[0][1]+=speed self.MechanicalState.findData('position').value=free_position self.MechanicalState.free_position=free_position # PAGEUP key : up if ord(k)==18: free_position[0][0]-=speed self.MechanicalState.findData('position').value=free_position self.MechanicalState.free_position=free_position # PAGEDN key : down if ord(k)==20: free_position[0][0]+=speed self.MechanicalState.findData('position').value=free_position self.MechanicalState.free_position=free_position return 0
Thank you,
RishabhRishabhBlockedHi @hugo,
I just checked the script, it does work on v17.06 I can confirm.
The green ball (input/DOFs) is indeed “activated” in the code, I’m not sure why you can’t see it, sofa version problem maybe.
And to move the red ball use the keyboard.py script attached in the same github gist link. It so happens that sometimes it does not move at the start so you have to reset the scene again and/or click on the GUI screen and it starts working !
I do not have the v18 right now, cause I remember having troubles with the SofaPython plugin in that version (not being able to move the ball !, or even the examples provided were not really working). In any case please let me know if I should try it out on the latest version as well and report.
Thanks,
RishabhRishabhBlockedHi @hugo,
Okay thank you, the collision detection is causing a little problems in the main problem. I will state a small part of my setup here and I request your help in that too
Task: So I have a ball which acts as a gripper which I am manipulating through keyboard. Using the code from the examples this ball is attached (by VectorSpringForceField) to an input object whose position is controlled by the keyboard.py. The ball and the floor have a collision by using (MinProximityIntersection) but the collision does not work with LocalMinDistance. which is not a huge problem so it’s okay.
Problem:
1. The main problem (as you can see in the video) is that the ball obeys the collision, but the input object does not, they are connected by a VectorSpringForceField. How can I manipulate the ball naturally with collisions?Video: https://drive.google.com/file/d/1pTaZBkkXM28gGZgSZEdamZAfdYbvmYiX/view?usp=sharing
In the video I am first trying to move the ball (red) down and then up again. It collides with the floor and stays there, but it takes multiple “UP” key presses to get the ball going up again, this is because the DOFs object does not obey collisions and goes down anyway.
Scene File: https://gist.github.com/jangirrishabh/3ec355d28e7d01bd9d36f52afa632026
KeyboardControlFile: Attached in the gistRishabhBlockedHere is a picture of what I mean by the unwanted stretching of the border when gripped
Link: https://ibb.co/5LFTkCV
RishabhBlockedHi @Hugo, thank you for your prompt reply
Oh okay good, I’m still on branch 17.06, I have some python issues with the master branch.
Using a coarser mesh for collision sounds like a nice idea, i’ll try that soon thanks.
The additional stiffness in the borders was required because of the unwanted stretching of the cloth when gripped at a single point for manipulation (gripped at vertex). Do you think that slows down the simulation? I did not find any significant change in the speed with addition of this.
A question, could you please explain me the difference between
<LocalMinDistance name="Proximity" alarmDistance="03" contactDistance="01" useLMDFilters="0" />
and
<MinProximityIntersection name="Proximitty" alarmDistance="3.0" contactDistance="1.0" />
Yes! I saw the CUDA plugin but haven’t tried it yet, it would be lovely if that could work, i’ll let you know for sure. For the indie dev, it would rather be better that I stick to stable branches as the simulation is a tool but my main project drifts towards learning, so thanks anyway !
Cheers,
RishabhRishabhBlockedHi @Hugo,
Thank you very much, I am currently able to achieve all the above required functionalities with your inputs !
One of my only concern is the speed of simulation, adding friction has slowed it down quite a bit, could you suggest ways to speed up the simulation (like without rendering is one solution that I use), I have also tried to decrease the collision pipeline depth hoping the speed improves, thoughts?
There we just a few minor typos in the above script, embedding the working slightly modified script here for reference of others,
<Node name="root" dt="0.05" gravity="0 -9.810 0"> <VisualStyle displayFlags="hideBehaviorModels hideCollisionModels hideMappings hideForceFields showVisualModels hideInteractionForceFields" /> <RequiredPlugin name='SofaMiscCollision'/> <FreeMotionAnimationLoop solveVelocityConstraintFirst="0" /> <LCPConstraintSolver maxIt="1000" tolerance="1e-6" initial_guess="false" build_lcp="true" multi_grid="false" printLog="0" mu="1.9"/> <CollisionPipeline depth="6" verbose="0" draw="0" /> <BruteForceDetection name="N2" /> <LocalMinDistance name="Proximity" alarmDistance="03" contactDistance="01" useLMDFilters="0" /> <CollisionResponse name="Response" response="FrictionContact" /> <Node name="cloth"> <EulerImplicitSolver name="cg_odesolver" printLog="false" rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" /> <MeshGmshLoader name="loader" filename="mesh/square3.msh" createSubelements="true" rotation="90 0 0" scale="100" /> <TriangleSetTopologyContainer name="topo" src="@loader"/> <TriangleSetGeometryAlgorithms name="algo" template="Vec3d" recomputeTrianglesOrientation="1"/> <MechanicalObject name='clothMech' src="@loader" template="Vec3d" /> <DiagonalMass massDensity="0.01" /> <!-- <FixedConstraint indices="1" /> --> <TriangularFEMForceField name="FEM" youngModulus="1000" template="Vec3d" poissonRatio="0.1" method="large" /> <TriangularBendingSprings name="FEM-Bend" stiffness="1" template="Vec3d" damping="2.0" /> <UncoupledConstraintCorrection compliance="100"/> <Node name="TriangularSurface"> <TriangleSetTopologyContainer name="Container" /> <TriangleSetTopologyModifier name="Modifier" /> <Tetra2TriangleTopologicalMapping input="@../topo" output="@Container" /> <Triangle name="models" /> <Line /> <Point /> </Node> <Node name="clothVisual"> <OglModel name="Visual" src="@../loader" color="red" template="ExtVec3f"/> <IdentityMapping input="@.." output="@Visual" /> </Node> <Node name="Edge Mesh"> <EdgeSetTopologyContainer name="Container" /> <EdgeSetTopologyModifier name="Modifier" /> <EdgeSetGeometryAlgorithms template="Vec3d" name="GeomAlgo" drawEdges="1" /> <EdgeSetTopologyAlgorithms template="Vec3d" name="TopoAlgo" /> <Triangle2EdgeTopologicalMapping name="Mapping" input="@../topo" output="@Container" /> <MeshSpringForceField template="Vec3d" stiffness="10" damping="1.0" /> </Node> </Node> <Node name="Floor"> <MeshObjLoader name="loader" filename="mesh/floorFlat.obj" triangulate="true" scale="10" translation="50 -10 50" /> <MeshTopology src="@loader" /> <MechanicalObject src="@loader" name="DOFs" template="Vec3d" /> <Triangle simulated="0" moving="0" contactFriction="100"/> <Line simulated="0" moving="0" contactFriction="100"/> <Point simulated="0" moving="0" contactFriction="100"/> <OglModel name="FloorV" /> </Node> </Node>
Thanks! Rishabh
RishabhBlockedHi @eleonora, your suggestion was very valuable! I finally figured out how to carry out my task by the method mentioned in the post that you suggested, thanks a lot π
Hello @meldiwiny I figured out a solution, AttachConstraint works here! thanks a lot for your help
Cheers!
RishabhRishabhBlockedHello, excuse me for the recurring posts, but I figured out how to solve this π
Thanks a lot @hugo
Rishabh
RishabhBlockedHi, by the way I also tried to just make the
constraintFactor = 0
but that does not seem to work, it does not allow me to change the constraint factor from the python script. Any help on this would be appreciated!Thanks,
Rishabh
RishabhBlockedHi @hugo
Thanks a lot, I figured out how to AttachConstraint the cloth with the object π
But now, I am trying to find a way to deactivate the AttachConstraint through a python script, simply doing
attachConstraintObj.activated = False
does not help as there is no activated attribute. Is there a way I can deactivate the constraint through a python script?Thanks,
RishabhRishabhBlockedThank you for your reply on post
That question was a part of a bigger problem I am trying to solve, so I will ask you about the main problem here which is more related to this thread
I am working on a cloth simulation as shown in this image,
image
and my task is to attach a given point on the cloth to another object (can be anything) whose motion I control through external commands. I have been looking at AttachConstraint without any luck, can you please help in this regardThe script to my scene is pasted here
Feel free to change the scene file as required
Thank you,
Rishabh3 October 2018 at 15:53 in reply to: [SOLVED] How can I get the index of the tetrahedron which contain a particular point? #12084 -
AuthorPosts