Home › Forum › SOFA › Programming with SOFA › Parameter value update
Tagged: 64_bits, Linux_ubuntu, parameter, SOFA_1706
- This topic has 14 replies, 2 voices, and was last updated 4 years, 11 months ago by Hugo.
-
AuthorPosts
-
1 August 2019 at 18:52 #14055RishabhBlocked
Hello,
There is another problem I came across, if you can please help. The values of an object’s massDensity change only after I press the “Update” button from the GUI. I am updating the values like
self.node.getChild('SquareGravity').getObject('DiagonalMass').findData('massDensity').setValue(0, massDensity)
I can see a change when I print the value but it does not change in the simulation until I press the update button on the GUI.
Thank you,
Rishabh8 August 2019 at 11:52 #14072RishabhBlockedUPDATE:
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,
Rishabh13 August 2019 at 18:17 #14102HugoKeymasterYou are touching a hot topic!
We are currently discussing and changing the API of SOFA to make sure that updates can be made and are properly and consistently taken into account on the fly during the simulation.Can you specify what you intend to do exactly? Why and which values you need to update? (just for my understanding)
Hugo
14 August 2019 at 17:24 #14119RishabhBlockedHello @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 !
Rishabh23 August 2019 at 17:26 #14151HugoKeymasterFor sure you can update to 19.06, you should have better experience with other masses than UniformMass. I worked few months ago in making the Diagonal and MeshMatrixMass able to be updated.
However, you will still face the issue with the ForceFields. It would require a bit of work to make them updatable. Maybe start with the update and we can work together on the update of the other components. How does it sound for you?Hugo
26 August 2019 at 12:21 #14160RishabhBlockedOkay, 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
2 September 2019 at 16:44 #14174HugoKeymasterYes, as you can see from the EulerImplicit code (if it is the OdeSolver, i.e. integration scheme, you are using), the rayleigh stiffness Data is directly used in the code. If you update it, it will be taken into account.
It is really code dependent for the physical parameters (stiffness, i.e. Young modulus).
Which code and which parameters are necessary to update for you?Best
Hugo
5 September 2019 at 13:48 #14211HugoKeymasterThe new API for internal updates of components has recently been introduced in PR #1131.
I will update the mass components and then I will have a look at the ForceFields components. Do not hesitate to make a list of components/Data that you see as crucial for the update.
Hugo
5 September 2019 at 14:46 #14212RishabhBlockedHi @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
10 September 2019 at 10:37 #14223HugoKeymaster1. I will work on it as soon as I can
2. this is ready in PR #1093
3. dt can already be changed, but you must be very careful with this. Some parameters or numerical settings (ODE solvers, constraints) may depend on the time step and can not be updated. I would therefore advise to change it very carefully.
4. Topology change (update in the mesh) is a work in progress thanks to the amazing work of InfinyTech3D (consulting company around SOFA)Best,
Hugo
26 September 2019 at 16:45 #14298RishabhBlockedHi @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
26 September 2019 at 20:36 #14299HugoKeymasterIndeed TriangularBendingSprings do not have yet this update process. But if you look at the PR #1145 for ConstantForceField can inspire to apply this on TriangularBendingSprings. Would you feel confident to implement it?
Hugo
27 September 2019 at 11:20 #14301RishabhBlockedHi @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,
Rishabh5 December 2019 at 11:26 #14681RishabhBlockedHi @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,
Rishabh5 December 2019 at 12:23 #14682HugoKeymasterSorry for not getting back to you earlier. But the SOFA Week kept us busy (with many scientific presentations and technical discussions) and I am current out from the office.
There have been discussions on update. A summary will be made available on the “RoadMap” page on sofa-framework.org. Shortly, a new working project is starting on this to unify and improve the data dependency and update. But it will take a bit of time.
Going for the implementation based on what was done in the PR will be useful for the future as well, your contribution is therefore most welcome. Let us know if you face issues or need guidance. But don’t hesitate to PR and we would guide you afterwards if needed.
Best !
Hugo
-
AuthorPosts
- You must be logged in to reply to this topic.