Forum Replies Created
-
AuthorPosts
-
EulalieBlocked
Hi everyone,
Sorry for the late reply. We are still working on a version of STLIB that is compatible with SofaPython3. It’s not all done yet but you can checkout the WIP branch… It is a work in progress, thus some examples and tutorials of SoftRobots may still not be working. For instance the latest version of SoftRobots/docs/tutorials/Tripod/details/sofapython3/ only works until the step6. We appologize for that, and we are doing our best to improve this as fast as possible.
Otherwise, for those struggling with the set up… here’s what I suggest to do for SofaPython3.
1- The extension “.pyscn” (“.py3scn”, “.py”, and “.py3”) is only recognized by runSofa if the plugin SofaPython3 is added to the runSofa/Edit/Plugin Manager.
2- If you have an error at this stage it’s very likely that python3 and/or numpy is missing. Once installed, on Windows, check that your python path (typically
C:\Python38\
) is added to your SystemProperties/EnvironmentVariable/Path. Don’t forget the\
at the end or it may not browse the repository. You should be able to runpython3
in a terminal, and thenimport numpy
should not return an error.3- Once the above steps work, checkout the WIP branch and verify that STLIB (
.../STLIB/python3/src/stlib3/
and.../STLIB/python3/src/splib3/
) is in your PYTHONPATH: runpython3
in a terminal, thenimport sys
andprint(sys.path)
, you should see the paths to stlib3 and splib3, and the commandimport stlib3
should not return an error. If not, follow these [instructions](https://bic-berkeley.github.io/psych-214-fall-2016/using_pythonpath.html).I hope this helps.
Eulalie23 April 2019 at 15:07 in reply to: [SOLVED] Using SOFA to build pneumatic actuated robot arm #13425EulalieBlockedHi zhongyi,
Could you provide a link with everything needed to launch the simulation (i.e a ZIP with the scene and the meshes). I’ll have a look at it.
Thanks
EulalieEulalieBlockedHi,
Sorry I forgot that the SparseLDLSolver isn’t built by default. You need to enable the SOFA_BUILD_METIS option from the Cmake GUI to use it.
Use the SparseLUSolver instead.EulalieBlockedHi Luigi,
Try to use this for both palm and fingers:
<TriangleModel group=”1″/> <LineModel group=”1″/> <PointModel group=”1″/>
I think it is required to use the three components together.
For the FrictionContact response, I started from the example MultipleObjectsTwoCubes.scn provided with Sofa. I tried to change the scene to add friction. It looks like there is a problem with the LCPConstraintSolver. Try to use FreeMotionAnimationLoop and GenericConstraintSolver instead. We’ll have a look at the failing component. The friction coef can be changed in the DefaultContactManager, responseParams=”mu=…”. Use also a SparseLDLSolver (instead of the CG) and add a LinearSolverConstraintCorrection. I don’t know if it is the best/simplest solution… But it works 😉
Here’s an example:<?xml version=”1.0″ ?> <!– See http://wiki.sofa-framework.org/wiki/TutorialCollisionCubeObstacle.scn –> <Node name=”root” dt=”0.01″ gravity=”0 -9.81 0″> <!– Basic Components to perform the collision detection –> <VisualStyle displayFlags=”showBehavior showCollisionModels” /> <CollisionPipeline /> <BruteForceDetection /> <FreeMotionAnimationLoop/> <GenericConstraintSolver maxIterations=”1000″ tolerance=”0.001″/> <DefaultContactManager response=”FrictionContact” responseParams=”mu=0.6″/> <MinProximityIntersection alarmDistance=”1″ contactDistance=”0.5″/> <!– Using a deformable cube using collision spheres –> <Node name=”Cube1″> <EulerImplicitSolver name=”EulerImplicit Cube1″ /> <SparseLDLSolver name=”Solver Cube1″ /> <MechanicalObject name=”Particles Cube1″ template=”Vec3d” position=”0 0 1 1 0 1 0 1 1 1 1 1 0 0 2 1 0 2 0 1 2 1 1 2″ translation=”0.5 2 0″ /> <MeshTopology name=”Topology Cube1″ hexas=”0 4 6 2 1 5 7 3″ /> <UniformMass name=”Mass Cube1″ totalmass=”1″ /> <MeshSpringForceField name=”Springs Cube1″ stiffness=”100″ damping=”1″ /> <!– Collision Models –> <SphereModel name=”Spheres For Collision Cube1″ radius=”0.2″ /> <LinearSolverConstraintCorrection/> </Node> <!– Using a deformable cube using collision triangles, lines and points –> <Node name=”Cube2″> <EulerImplicitSolver name=”EulerImplicit Cube2″ /> <SparseLDLSolver name=”Solver Cube2″ /> <MechanicalObject name=”Particles Cube2″ template=”Vec3d” position=”0 0 1 1 0 1 0 1 1 1 1 1 0 0 2 1 0 2 0 1 2 1 1 2″ /> <MeshTopology name=”Topology Cube2″ hexas=”0 4 6 2 1 5 7 3″ /> <UniformMass name=”Mass Cube2″ totalmass=”1″ /> <MeshSpringForceField name=”Springs Cube2″ stiffness=”15″ damping=”1″ /> <!– Collision Models –> <TriangleModel name=”Triangles For Collision” /> <LineModel name=”Lines For Collision” /> <PointModel name=”Points For Collision” /> <LinearSolverConstraintCorrection/> </Node> <Node name=”Floor”> <MeshTopology name=”Topology Floor” filename=”mesh/floor.obj” /> <MechanicalObject name=”Particles Floor” /> <TriangleModel name=”Triangle For Collision Floor” moving=”0″ simulated=”0″ /> </Node> </Node>
EulalieBlockedThe ConstraintCorrection component computes and applies the correction:
dx_correction = A^{-1}*Ht*lambda
dx = dx_free + dx_correctionWith lambda given by the Gauss Seidel algorithm implemented in the GenericConstraintSolver. Note that we do not compute the inverse of A. In practice we use a LDLt factorization of the matrix A.
I think that the main benefit of this approach is the computation time.
About the three other solvers, I don’t know. Maybe someone else can help you.EulalieBlockedYes it is.
Only the constraints that implement buildConstraintMatrix(), getConstraintViolation() and getConstraintResolution() can be solved by the GenericConstraintSolver.
EulalieBlockedI see the confusion. I’m not used to the LMConstraintSolver component and LMConstraint class. As I said, I’m used to the GenericConstraintSolver which is different in the way of solving the Lagrange Multipliers (and thus in the way of building the scene).
I think that LMConstraintSolver actually increases the size of the system (as Matthieu mentioned). Unlike the GenericConstraintSolver which projects the mechanics into the constraint space and solves the reduced problem.
Maybe I should let someone else help you with LMConstraintSolver.
But if you want to try the approach described in https://hal.archives-ouvertes.fr/tel-00785118/document you should have a look at those examples:
examples/Components/constraint/SlidingConstraint.scn
examples/Components/constraint/BilateralInteractionConstraint.scnEulalie
EulalieBlockedHi,
To use LM constraints you need a ConstraintSolver in your scene. I’m used to the GenericConstraintSolver which is based on a Gauss Seidel algorithm. Also add a FreeMotionAnimationLoop and a ConstraintCorrection.
You can have a look at these examples:
examples/Components/constraint/SlidingConstraint.scn
examples/Components/constraint/BilateralInteractionConstraint.scnHere is a link https://hal.archives-ouvertes.fr/tel-00785118/document to help you understand how the constraint problem is set and solved (see section 2.2.3 Constraint-based response).
If you want to implement your own constraint, you can have a look at the SlidingConstraint and BilateralInteractionConstraint implementation.
The three main functions are buildConstraintMatrix, getConstraintViolation and getConstraintResolution.
These functions are called by the GenericConstraintSolver to respectively, build the constraint matrix H (in the link I gave you), get the constraint violation delta_free which is computed from the free motion x_free and finaly you will need to provide a class for the resolution of your constraint. This is specific to the Gauss Seidel resolution which iterates and converges by solving each constraint while freezing the others.No changes in your ODESolver is required. The correction is computed and applied by the ConstraintCorrection component.
Hope this helps.
Eulalie
-
AuthorPosts