Home › Forum › SOFA › Using SOFA › [SOLVED] SofaHAPI loading failed
Tagged: 32_bits, Plugin_other, SOFA_1912, SOFAHapi, Windows_10
- This topic has 10 replies, 3 voices, and was last updated 4 years, 4 months ago by mikelitu.
-
AuthorPosts
-
9 July 2020 at 22:31 #16854mikelituBlocked
Hello everyone,
I am new with SOFA and Haptic interfaces and I am trying to use my Novint Falcon device in SOFA for my master’s thesis.
I have managed to correctly compile SOFA with the SofaHAPI plugin using Visual Studio 2017 and Win32 platform to include the Novint drivers. However, when I try to initialize SOFA with runSofa.exe I get the following error:
[ERROR] [PluginManager] Plugin loading failed (D:/sofa/build/v19.12/bin/Release/SofaHAPI.dll): function initExternalModule() not found
I have tried the advices from the following link (https://h3dapi.org/forums/topic/resolved-sofa-hapi-load-plugin-fail/) and add the libraries to the variable PATH on Windows. However, it is a solution from 2014 and it is not working now. Does anyone know how to solve this issue?
Thank you everyone
12 July 2020 at 00:25 #16868mikelituBlockedHello,
Even if I still have the same error loading the plugin I can use the Novint Falcon into the example scene contained in the examples for the SofaHAPI plugin. However, after a few seconds SOFA displays an error message for runtime error and closes:
Microsoft Visual C++ Runtime Library. Runtime error! abnormal program termination
Anyone knows how to solve this issue? Or how to load the SofaHAPI plugin correctly without any error?
Thank everyone
20 July 2020 at 13:27 #16907mikelituBlockedHello everyone,
I have managed to put the haptic device working after some changes in the parameters of the solver. However, the Novint Falcon has a very limited workspace and when I try to implement a more complex scene I can not move the robot far from its original position. I have tried to change the parameters of the mechanical object where the HAPIDevice is defined, but I do not observe any big difference. In addition the Novin Falcon has only 3DoF and I do not know if I can change the Rigid3d template to Vec3d, I have tried this but I have some mapping issues and the device is not linked with the Mechanical Object for the tool. I have defined the tool as a SphereTopologyContainer will this be affecting the workspace of the robot. I need some help. Thank you for your attention.
Mikel
21 July 2020 at 17:01 #16919HugoKeymaster21 July 2020 at 17:20 #16921epernodBlockedHi,
sorry I never used the SofaHAPI plugin but to what I see it should be very similar to the Geomagic Plugin.
Which scene are you using, could you share the code and maybe screenshot of the result. There should be a Data referring to the origin of the tool at start.
I’m curious, is it a recent Novint Falcon? Is this device still on sail?
Erik
21 July 2020 at 18:07 #16925mikelituBlockedIt is indeed a new Novint Falcon, it is still on sale on their webpage. I have some data refering to the origin of the tool at the start, however when I try to change this value the robot starts with a weird behaviour. This is the code for the scene, it is very similar to the SofaHAPI example 2, but changing the spheres for the liver model from SOFA.
<?xml version="1.0" ?> <Node name="lroot" gravity="0 0 0" dt="0.02"> <RequiredPlugin name="SofaOpenglVisual"/> <RequiredPlugin name="SofaHAPI" /> <RequiredPlugin name="SofaMiscCollision" /> <RequiredPlugin name="SofaHaptics" /> <FreeMotionAnimationLoop /> <GenericConstraintSolver maxIterations="1000" tolerance="0.005"/> <DefaultPipeline depth="8" /> <BruteForceDetection name="N2" /> <LocalMinDistance name="Proximity" alarmDistance="0.4" contactDistance="0.2" /> <!-- <DefaultContactManager name="Response" response="FrictionContact"/>--> <RuleBasedContactManager name="Response" response="FrictionContact" rules="1 * FrictionContact?mu=0.01 " /> <DefaultVisualManagerLoop /> <Node name="NovintObject"> <Node name="RigidLayer"> <MechanicalObject name="ToolRealPosition" template="Rigid3d" position="4 0 12 0 0 0 1"/> <SofaHAPIHapticsDevice name="NovintDriver1" scale="50" drawDevice="0" permanent="1" printLog="true" handleEventTriggersUpdate="true" positionBase="0 5 0" orientationBase="0 0 0 1" positionTool="0 0 0" orientationTool="0 0 0 1"/> <Node name="Tool1"> <MechanicalObject template="Rigid3d" name="RealPosition"/> <SubsetMapping indices="0"/> </Node> </Node> </Node> <Node name="Tool1"> <EulerImplicitSolver rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver /> <MechanicalObject name="ms" template="Rigid3d" position="-7.13718 5.81916 23.8066 0 0 0 1"/> <UniformMass totalMass="0.1" /> <LCPForceFeedback activate="true" forceCoef="0.005" /> <Node name="Collision"> <!-- <Mesh filename="assets/meshes/crescentBlade_CM.obj" /> --> <MeshTopology position="0 0 0 0 0 10" lines="0 1" /> <!-- <SphereGridTopology radius="0.1"/> --> <MechanicalObject name="CM" /> <TriangleCollisionModel bothSide="false" group="1" color="0 0 1 1" /> <SphereCollisionModel group="1"/> <LineCollisionModel bothSide="false" group="1" /> <RigidMapping /> </Node> <!-- <Node name="Visual"> <MeshObjLoader name="InputMesh" filename="mesh/sphere_05.obj" scale="0.025" /> <MeshTopology src="@InputMesh" /> <OglModel name="VisualModel" color="blue"/> <RigidMapping /> </Node> --> <RestShapeSpringsForceField template="Rigid3d" stiffness="1000000" angularStiffness="200000000" external_rest_shape="@../NovintObject/RigidLayer/Tool1/RealPosition" /> <UncoupledConstraintCorrection compliance="0.001 0.00003 0 0 0.00003 0 0.00003" /> </Node> <MeshObjLoader name="LiverSurface" filename="mesh/liver-smooth.obj" /> <Node name="Liver" gravity="0 0 0"> <EulerImplicitSolver name="cg_odesolver" rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver name="linear solver" iterations="25" tolerance="1e-09" threshold="1e-09" /> <MeshGmshLoader name="meshLoader" filename="mesh/liver.msh" /> <TetrahedronSetTopologyContainer name="topo" src="@meshLoader" /> <MechanicalObject name="dofs" src="@meshLoader" scale="4" /> <TetrahedronSetGeometryAlgorithms template="Vec3d" name="GeomAlgo" /> <DiagonalMass name="computed using mass density" massDensity="1" /> <TetrahedralCorotationalFEMForceField template="Vec3d" name="FEM" method="large" poissonRatio="0.3" youngModulus="3000" computeGlobalMatrix="0" /> <FixedConstraint name="FixedConstraint" indices="3 39 64" /> <UncoupledConstraintCorrection compliance="0.005" /> <Node name="Visu" tags="Visual" gravity="0 0 0"> <OglModel name="VisualModel" src="@../../LiverSurface" scale="4" /> <BarycentricMapping name="visual mapping" input="@../dofs" output="@VisualModel" /> </Node> <Node name="Surf" gravity="0 0 0"> <MeshGmshLoader name= "loader" filename="mesh/liver.msh" /> <MeshTopology src="@loader" /> <MechanicalObject src="@loader" scale="4" /> <TriangleCollisionModel selfCollision="0" /> <LineCollisionModel selfCollision="0" /> <PointCollisionModel selfCollision="0" /> <BarycentricMapping /> </Node> </Node> </Node>
Best,
Mikel21 July 2020 at 19:28 #16926epernodBlockedCould you point the website please. I can’t find it. I’m interested to see the last versions
So I don’t know exactly what the geometry of this tool, but from what I see in the code, here are the Data to be considered:
Data<Vec3d> positionBase; ///< Position of the interface base in the scene world coordinates Data<Quat> orientationBase; ///< Orientation of the interface base in the scene world coordinates
Changing those Data in your scene will move the global position and orientation of the device in your SOFA scene compare to other objects simulated.
Data<Vec3d> positionTool; ///< Position of the tool in the device end effector frame Data<Quat> orientationTool; ///< Orientation of the tool in the device end effector frame
Are the position and orientation of the tip/grip of the device in the Device coordinate system. This should only be changed if the new falcon is different to the old one used in the example scene.
Hope it fixes your problem. Do not hesitate to share your results, I’m really interested by this topic.
Erik
21 July 2020 at 19:29 #16927mikelituBlockedHi @Hugo,
I am having some issues when compiling SOFA v20.06 with the Eigen3 directory. I have download their zip file and extract it into the C:/ folder. Do I need to make something else once I download the Eigen folder from their page? Not sure if I am defining the variables EIGEN3_INCLUDE_DIR to C:/eigen-3.2.10. Thanks for your help.
Best,
Mikel21 July 2020 at 19:36 #16928mikelituBlockedHi @epernod,
The Falcon Device are available on this link https://hapticshouse.com/collections/falcons/products/black-falcon-3d-touch-haptic-controller. I think they are still the same as the old ones.
I will have a look to those part of the xml scene. I think the scene was coded for an Omni device, but I can use my Falcon Device there. I will have a look of how to define the positions of the base and the tool. Thanks for your help and I will post here further updates.
Best,
Mikel28 July 2020 at 12:11 #16972mikelituBlockedHi,
I am trying to use the SlidingConstraint with the Mechanical Object corresponding to the Haptic device. Has someone managed to implement this successfully, the idea is to limit the movement of the device around a certain predefined direction. By now I have made a simple scene in which I am trying to implement this effect. When I animate the scene the device starts moving randomly in every direction and do not know why. I will paste the code here for you to have a look.
<Node name="lroot" gravity="0 0 0" dt="0.01"> <RequiredPlugin name="SofaOpenglVisual"/> <RequiredPlugin name="SofaHAPI" /> <RequiredPlugin name="SofaMiscCollision" /> <RequiredPlugin name="SofaHaptics" /> <FreeMotionAnimationLoop /> <GenericConstraintSolver maxIterations="1000" tolerance="0.005"/> <DefaultPipeline depth="8" /> <BruteForceDetection name="N2" /> <LocalMinDistance name="Proximity" alarmDistance="0.1" contactDistance="0.05" /> <!-- <DefaultContactManager name="Response" response="FrictionContact"/>--> <RuleBasedContactManager name="Response" response="FrictionContact" rules="1 * FrictionContact?mu=0.01 " /> <DefaultVisualManagerLoop /> <Node name="SlidingPoint"> <MechanicalObject name="points" template="Vec3d" position="1 1.25 -0.2 1 1.25 0.2" free_position="1 1.25 -0.2 1 1.25 0.2" /> </Node> <Node name="NovintObject"> <Node name="RigidLayer"> <MechanicalObject name="ToolRealPosition" template="Rigid3d" position="0 0 0 1 0 0 0"/> <SofaHAPIHapticsDevice name="NovintDriver1" scale="300" drawDevice="0" permanent="1" printLog="true" handleEventTriggersUpdate="true" positionBase="0 5 0" orientationBase="1 0 0 0" positionTool="0 0 0" orientationTool="1 0 0 0"/> <Node name="Tool1"> <MechanicalObject template="Rigid3d" name="RealPosition"/> <SubsetMapping indices="0"/> </Node> </Node> </Node> <Node name="Tool1"> <EulerImplicitSolver rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver /> <MechanicalObject name="ms" template="Rigid3d" position="0 0 0 1 0 0 0"/> <UniformMass totalMass="0.1" /> <LCPForceFeedback activate="true" forceCoef="0.005" /> <Node name="Collision"> <MeshObjLoader name="Surf" filename="mesh/sphere.obj" /> <MeshTopology src="@Surf" /> <MechanicalObject src="@Surf" scale="0.05"/> <TriangleCollisionModel bothSide="false" group="1" color="0 0 1 1" /> <LineCollisionModel bothSide="false" group="1" /> <RigidMapping /> </Node> <Node name="Visual"> <MeshObjLoader name="InputMesh" filename="mesh/sphere.obj" scale="0.05"/> <MeshTopology src="@InputMesh" /> <OglModel name="VisualModel" color="blue"/> <RigidMapping /> </Node> <!-- <RestShapeSpringsForceField template="Rigid3d" stiffness="1000000" angularStiffness="200000000" external_rest_shape="@../NovintObject/RigidLayer/Tool1/RealPosition" /> --> <UncoupledConstraintCorrection /> <Node name="Constraints"> <MechanicalObject name="points" template="Rigid3d" position="1 1.25 1 1 0 0 0 1 1.25 -1 1 0 0 0 0 0 0 1 0 0 0" /> <RigidMapping /> </Node> <SlidingConstraint name="constraint1" object1="@SlidingPoint/points" object2="@Tool1/Constraints/points" sliding_point="0" axis_1="0" axis_2="1" /> </Node> <Node name="Line"> <MechanicalObject name="points" template="Vec3d" position="6 1.25 1 6 1.25 -1" free_position="6 1.25 1 6 1.25 -1" /> </Node> </Node>
Best,
Mikel29 July 2020 at 13:25 #16977mikelituBlockedHi all,
I have solved all the problems regarding the topics discussed here, I have opened a new topic to discuss the Sliding Constraint problem due to the template mismatch between the points and the Haptic device mechanical object.
Best,
Mikel -
AuthorPosts
- You must be logged in to reply to this topic.