Forum Replies Created
-
AuthorPosts
-
29 April 2021 at 11:41 in reply to: [SOLVED] Animation issue Error in phase 3 of MOR plugin. Please Help! #19346FélixBlocked
Hello @pasquale94,
no problem I am happy to help you use it !
Yes you can adjust the scene to make it work for python3.
There are no problems for the c++ mor components to work with python3, its just that the interface I have developed to ease the reduction process is (for the moment) only working with python2…A last remark, when I had reduced your scene last Monday I have noted that even reduced your scene was kind of slow and its probably due to your visual mesh which seems to be maybe too precise for the purpose of a visual model.
28 April 2021 at 16:20 in reply to: [SOLVED] Animation issue Error in phase 3 of MOR plugin. Please Help! #19340FélixBlockedHey again @pasquale94,
Yes if everything works fine, the plugin only generate a python file that you can re-use as a module.
It contains a function with some basic parameters that instantiate the reduced model of the node you give as an argument to nodeToReduce.Doesn’t seems really clear so here an example :
import Sofa import os path = os.path.dirname(os.path.abspath(__file__))+'/design/' from reduced_test import Reduced_test def createScene(rootNode): rootNode.createObject('RequiredPlugin', pluginName='SoftRobots SofaPython SofaOpenglVisual SofaSparseSolver SofaPreconditioner SofaMiscCollision SofaExporter ModelOrderReduction SofaMiscFem SofaMiscForceField') rootNode.createObject('VisualStyle') rootNode.findData('gravity').value=[ 0, 0, -9810] rootNode.findData('dt').value = 0.001 rootNode.createObject('FreeMotionAnimationLoop') rootNode.createObject('GenericConstraintSolver', tolerance=1e-12, maxIterations=10000) rootNode.createObject('DefaultPipeline') rootNode.createObject('BruteForceDetection') rootNode.createObject('DefaultContactManager', response='FrictionContact', responseParams='mu=0.6') rootNode.createObject('LocalMinDistance', name='Proximity', alarmDistance=5, contactDistance=1, angleCone=0.0) rootNode.createObject('BackgroundSetting', color=[0, 0.168627, 0.211765]) rootNode.createObject('OglSceneFrame', style='Arrows', alignment='TopRight') # ADD your controller rootNode.createObject('PythonScriptController', filename='pythonControllers/fingerController.py', classname = 'FingerController') # ADD your reduced model Reduced_test(attachedTo=rootNode,name="Reduced_test",rotation=[0.0, 0.0, 0.0],translation=[0.0, 0.0, 0.0],scale=[1.0, 1.0, 1.0], surfaceMeshFileName=False,surfaceColor=[1.0, 1.0, 1.0],nbrOfModes=3,hyperReduction=True)
28 April 2021 at 14:31 in reply to: [SOLVED] Animation issue Error in phase 3 of MOR plugin. Please Help! #19337FélixBlockedHello @pasquale94,
I am really sorry I forget to tell you that you need to put absolute path into your scene…
import Sofa import os path = os.path.dirname(os.path.abspath(__file__))+'/design/' def createScene(rootNode): rootNode.createObject('RequiredPlugin', pluginName='SoftRobots SofaPython SofaOpenglVisual SofaSparseSolver SofaPreconditioner SofaMiscCollision SofaExporter ModelOrderReduction SofaMiscFem SofaMiscForceField') rootNode.createObject('VisualStyle') #, displayFlags='showVisualModels showBehaviorModels hideCollisionModels hideBoundingCollisionModels showForceFields hideInteractionForceFields hideWireframe') rootNode.findData('gravity').value=[ 0, 0, -9810] rootNode.findData('dt').value = 0.001 rootNode.createObject('FreeMotionAnimationLoop') rootNode.createObject('GenericConstraintSolver', tolerance=1e-12, maxIterations=10000) rootNode.createObject('DefaultPipeline') rootNode.createObject('BruteForceDetection') rootNode.createObject('DefaultContactManager', response='FrictionContact', responseParams='mu=0.6') rootNode.createObject('LocalMinDistance', name='Proximity', alarmDistance=5, contactDistance=1, angleCone=0.0) rootNode.createObject('BackgroundSetting', color=[0, 0.168627, 0.211765]) rootNode.createObject('OglSceneFrame', style='Arrows', alignment='TopRight') #rootNode.createObject('PythonScriptController', filename='pythonControllers/fingerController.py', classname = 'FingerController') finger = rootNode.createChild('finger') finger.createObject('EulerImplicitSolver', name='odesolver', rayleighStiffness=0.1, rayleighMass=0.1) finger.createObject('SparseLDLSolver', name='directSolver') finger.createObject('MeshVTKLoader', name='loader', filename=path+'finger0.vtu') finger.createObject('MechanicalObject', name='tetras', template='Vec3d', src = '@loader') finger.createObject('TetrahedronSetTopologyContainer', name="topo", src ='@loader') finger.createObject('TetrahedronSetTopologyModifier' , name="Modifier") #finger.createObject('TetrahedronSetTopologyAlgorithms', name="TopoAlgo", template="Vec3d") finger.createObject('TetrahedronSetGeometryAlgorithms', template="Vec3d" ,name="GeomAlgo")#, drawTriangles="1") finger.createObject('MeshMatrixMass', massDensity='1.020e-9', src = '@topo') #youngModulus = 120 #poisson = 0.44 mu = 2*109 k0 = 1/1.150e-2 finger.createObject('TetrahedronHyperelasticityFEMForceField', template='Vec3d', name='FEM', src ='@topo', ParameterSet=str(mu)+' '+str(k0),materialName="NeoHookean") #finger.createObject('TetrahedronFEMForceField', template='Vec3d', name='FEM', src ='@topo', youngModulus = 120, poisson = 0.44) finger.createObject('BoxROI', name='boxROI', box=[-10, 0, 0, 10,15, 5], drawBoxes=True) finger.createObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) # finger.createObject('LinearSolverConstraintCorrection', solverName='directSolver') finger.createObject('GenericConstraintCorrection', solverName='directSolver') cavity = finger.createChild('cavity') cavity.createObject('MeshObjLoader', name='cavityLoader', filename=path+'BSPA_New_Design_Inner.obj') cavity.createObject('MeshTopology', src='@cavityLoader', name='cavityMesh') cavity.createObject('MechanicalObject', name='cavity') cavity.createObject('SurfacePressureConstraint', name='SurfacePressureConstraint', template='Vec3d', value= 0, triangles='@cavityMesh.triangles', valueType='pressure') cavity.createObject('BarycentricMapping', name='mapping', mapForces=False, mapMasses=False) collisionFinger = finger.createChild('collisionFinger') collisionFinger.createObject('MeshObjLoader', name='loader', filename=path+'BSPA_New_Design_Outer.obj') collisionFinger.createObject('MeshTopology', src='@loader', name='topo') collisionFinger.createObject('MechanicalObject', name='collisMech') collisionFinger.createObject('TriangleCollisionModel', selfCollision=False) collisionFinger.createObject('LineCollisionModel', selfCollision=False) collisionFinger.createObject('PointCollisionModel', selfCollision=False) collisionFinger.createObject('BarycentricMapping') modelVisu = finger.createChild('visu') modelVisu.createObject('MeshObjLoader', name='loader', filename=path+'BSPA_New_Design_Outer.obj') modelVisu.createObject('OglModel', src='@loader', color='yellow') modelVisu.createObject('BarycentricMapping') return rootNode
Also for the XO NOT FOUND issue if you haven’t pull my recent changes and used what I have put above its normal.
But if you don’t want to complicate yourself you can do it like that:cavity = ObjToAnimate("finger/cavity", incr=5e-4,incrPeriod=1,rangeOfAction=0.1) listObjToAnimate = [cavity] addRigidBodyModes = [0,0,0] # Tolerance tolModes = 0.001 tolGIE = 0.05 # Optional verbose = True nbrCPU = 4 packageName = 'test' addToLib = False reduceMyModel = ReduceModel( originalScene, nodeToReduce, listObjToAnimate, tolModes,tolGIE, outputDir, packageName = packageName, addToLib = addToLib, verbose = verbose, addRigidBodyModes = addRigidBodyModes) reduceMyModel.phase1() reduceMyModel.phase2() reduceMyModel.phase3() reduceMyModel.phase4()
I hope it solve your problems…
Sorry for the inconvenience, some work still need to be done with the documentation to help debug/avoid some little mistake.26 April 2021 at 14:32 in reply to: [SOLVED] Animation issue Error in phase 3 of MOR plugin. Please Help! #19314FélixBlockedLat thing, if you don’t know.
When you do phase 1 & 3 it generate some stateFile.state that you can check by launching the debug/debug_scene.py.
It will show you what happened during the scene execution allowing you to see if the animation function you use do the job.26 April 2021 at 14:17 in reply to: [SOLVED] Animation issue Error in phase 3 of MOR plugin. Please Help! #19313FélixBlockedHello @pasquale94,
they were multiple errors some from the plugin itself and some from your scene.
Concerning your scene:
– you need to add the plugin ModelOrderReduction in your initial scene, I need to add that fact into the documentation…
– use GenericConstraintSolver instead of LinearSolverConstraintCorrection, it seems there is problem with linearSolvers and mor component I also need to add that to the doc…For the reduction:
– you were putting incrPeriod=0.001 but I made a mistake in the documentation, its not the period but the number of dt between each animation. So here I guess you want one to animate each dt then incrPeriod=1.
– I have made some small modification in the python code to correct some issue, pleasecopy/pasteor pull to have the update.In the end I have something like that:
cavity = ObjToAnimate("finger/cavity", incr=5e-4,incrPeriod=1,rangeOfAction=0.1) listObjToAnimate = [cavity] addRigidBodyModes = [0,0,0] # Tolerance tolModes = 0.001 tolGIE = 0.05 # Optional verbose = True nbrCPU = 4 packageName = 'test' addToLib = False reduceMyModel = ReduceModel( originalScene, nodeToReduce, listObjToAnimate, tolModes,tolGIE, outputDir, phaseToSave=[1], packageName = packageName, addToLib = addToLib, verbose = verbose, addRigidBodyModes = addRigidBodyModes) reduceMyModel.phase1(phasesToExecute = [1]) reduceMyModel.phase2() reduceMyModel.phase3(phasesToExecute = [1]) reduceMyModel.phase4()
I hope this help and thanks for the feed back!
23 April 2021 at 10:51 in reply to: [SOLVED] Animation issue Error in phase 3 of MOR plugin. Please Help! #19279FélixBlockedHello @pasquale94,
The easiest way to help you, I think, is that you give us your scene and I will do a quick test with it.
But at first glance it seems that it cannot instantiate a component from the plugin MOR. So maybe it cannot load the plugin for some reason…
Hope it help !
Have a good day,
FélixFélixBlockedHello @amackeith,
I don’t totally see what you want to do with the mapping but I can recommend you to look into the MultiGait-SoftRobot example in the doc which seems to correspond to what you are trying to do (pneumatic actuation with collision).
But at first glance I will use the volume_collision.stl to have triangle for the collision, I have to admit that I don’t really know if you can do proper collision with only point… Anyway if you find the volume_collision.stl to heavy you can always sub-select it or generate a new surface mesh with only the surface you are interested in.
I hope this help you,
FélixFélixBlockedHello Arthur,
sorry for the late reply.
Can you check the log where the reduction is crashing ?
Taking what you have shown above as an example, in :
/tmp/sofa-launcher-cOJiPc/
Maybe we can debug this together by visio if you want, it will be easier.
You can send me a mail directly in order to organize that.Félix
27 February 2019 at 17:29 in reply to: [SOLVED] How to do feasible and stable physical acceleration in force feedback scene? #13127FélixBlockedHello @outtt,
sorry for the delay,
we are currently working on fixing your bug and others…
For the moment we corrected the problem with links you had. So now you can (normally) reduce your scene in one go without completing some files like @olivier-goury explain to you previously.
But for the problem you just shown us in your video, I have currently no clue about where it comes from, also this error only occur on windows.
Anyways thanks for pointing it to us, we will keep you informed when we correct it.
Félix
8 February 2019 at 14:43 in reply to: [SOLVED] How to do feasible and stable physical acceleration in force feedback scene? #13016FélixBlockedHi @outtt,
I just finish to test & fix the different problems, so now it works both for the script and the GUI normally, at least for the diamondRobot & hexaBeam examples which I have tested but the quadruped_snapshotGeneration.py doesn’t seems to work and I don’t know (yet) why…
You can now try it out again if you want.
Just a precision for the hexaBeam example its :
nodesToReduce =‘/M1’Félix
7 February 2019 at 11:24 in reply to: [SOLVED] How to do feasible and stable physical acceleration in force feedback scene? #13014FélixBlockedHi @outtt,
there is a little tutorial here about that but basically:
– nodesToReduce : path to the node we want to reduce in our scene
– listObjToAnimate : here we want specify with which components we will shake our model to do the reduction and with which parameters.
– ObjToAnimate : with ObjToAnimate we can specify an animation, here we want to pull with a CableConstraint with an increment of 1 each 5 steps until 5 -> (“M1/cableNode”, incr=1,incrPeriod=5,rangeOfAction=5)
Giving him only the path to a node (here M1/cableNode) it will search in it an actuator to control (here CableConstraint).– addRigidBodyModes : finally this argument indicate if our reduced model will be fixed ([0,0,0] -> without any translation) or if it will be able to translate and along which axes.
For the windows path I just made some fixes to (normally) correct that for the script modelOrderReduction.py… But I find there are some issues with the sofa-launcher when I launch the reduction examples (diamondRobot.py) that I will try to correct for the end of this week with also fixes to the GUI part.
Sorry for all the trouble but you are our first windows user.
Hopes this helps !Félix
6 February 2019 at 11:09 in reply to: [SOLVED] How to do feasible and stable physical acceleration in force feedback scene? #13003FélixBlockedHi @outtt,
sorry for the delay…
The hexaBeam example was made by @olivier-goury, here are the arguments:
### HEXABEAM
nodesToReduce =[‘/M1’]
actuator = ObjToAnimate(“M1/cableNode”, incr=1,incrPeriod=5,rangeOfAction=5)
listObjToAnimate = [actuator]
addRigidBodyModes = [0,0,0]We recently corrected the compilation issue of ModelOrderReduction plugin on Windows. The problem was two-fold : so PR have been made in MOR & SOFA to correct it, so for the moment the fix isn’t in any binaries. Sorry that you have to debug it yourself.
I will test today to run the different examples and tell you if everything work fine to avoid you some trouble.
Félix
30 January 2019 at 10:34 in reply to: [SOLVED] How to do feasible and stable physical acceleration in force feedback scene? #12959FélixBlockedHi @outtt,
concernig OglSceneFrame component (and others), it was wrongly removed in the last binaries and is being put back maybe for this current week…
I am interested to know what finally was the error with the SparseLDLSolver and if it was concerning our plugin.
Also don’t hesitate to make some pull/issue request to ModelOrderReduction if you find some errors, thanks in advance for that.
Again if you need help or explanations to use MOR, don’t hesitate to ask or search within the documentation that I hope is helpful.
Félix
28 January 2019 at 15:45 in reply to: [SOLVED] How to do feasible and stable physical acceleration in force feedback scene? #12917FélixBlockedHello @outtt,
sorry for all the trouble compiling on windows,
we never really test it on this OS…There is some standalone scn for this plugin but I didn’t write it anywhere explicitly.
Its in doc/examples/SOFIA.Anyways can you give me your error ? I would be glad to help you resolve it.
Félix
20 December 2018 at 15:03 in reply to: [SOLVED] How to do feasible and stable physical acceleration in force feedback scene? #12672FélixBlockedHello @outtt,
Yes you are right for the Geomagic plugin there is an issue for this that has been fixed recently.
Concerning MOR you are right also, the necessary modification in sofa to make this plugin work isn’t included in the current last version 18.06.
Sorry for the false informations.
So currently for you in order to have a working MOR & Geomagic plugin you need to build it yourself from source as explained here:
Or if you can, wait till the next release that will include all the necessary adjustment
and will be public around mid-January normally.I hope this help you,
Félix19 December 2018 at 12:05 in reply to: [SOLVED] How to do feasible and stable physical acceleration in force feedback scene? #12622 -
AuthorPosts