20 May 2020 at 22 h 09 min #16330
Hello SOFA community,
I encountered a problem when I was trying to use
BilateralInteractionConstraintto attach one soft actuator to another. The error shown in the command line is below:
[ERROR] [PythonScript] RuntimeError: Unable to create 'BilateralInteractionConstraint' of type 'BilateralInteractionConstraint' in node 'root'. Object type BilateralInteractionConstraint<Vec3d> was not created The object is in the factory but cannot be created. Requested template: Vec3d(Vec3d) Available templates: Rigid3d, Vec3d, File "Ex3Ex3.pyscn", line 165, in createScene rootNode.createObject('BilateralInteractionConstraint', template = "Vec3d", object1 = "@pneu1/Constraint/points", object2 = "@pneu2/Constraint/points", first_point = "1", second_point = "0")
In addition, the collision model doesn’t seem to work in my scene. I wonder if this is caused by the failure of using BilateralInteractionConstraint.
This is the link to my codes and CAD file:
The actuator is controlled by pressing “ctrl”+”-” and “ctrl”+”=” on the keyboard. After running the scene, the error should be easy to notice. I have spent a whole day on this issue… So any advice would be greatly appreciated!
Owen24 May 2020 at 10 h 37 min #16348
it took me some time to found because it’s very simple!
Check the case of your node “constraint” one is a “c” another is a “C”
Hugo24 May 2020 at 12 h 51 min #16352BineshParticipant
- Developer,Modeler And Eye Surgical Simulation Researcher At Simedix.co
I checked your python codes and i think there is a problem in your code,
for creation of bilateral Interaction Constraint, you have to create a mechanical state same as bilateral template
i cannot see any mechanical state in your “rootNode”,
i think you must create a mechanical state in Vec3 Template
Behnam Binesh25 May 2020 at 14 h 31 min #16363
Thank you for your reply!
I have corrected the case of “Constraint” as Hugo suggested, and then I don’t have this error anymore. I am sorry that my code is a bit messy… Even though I don’t fully understand how the templates work, I think the mechanical state was created in the children of rootNote. Like in Line 126
pneu2.createObject('MechanicalObject', name='tetras', template='Vec3d', showObject='0', showObjectScale='1')etc.
I guess for now I will move on since the error disappears. If I encounter similar problems again, I will examine my code and find where Vec3d is missing.
Owen25 May 2020 at 14 h 43 min #16364
By the way it starts being a nice complicated scene, good to see that!
Good luck in the next steps and forum remains at your disposal!
Hugo25 May 2020 at 15 h 11 min #16365
I feel kinda stupid to waste your time on fixing this tiny error… However, I have one more question to ask about
BilateralInteractionConstraintif you don’t mind. I found this page explaining the Args: https://sofacomponents.readthedocs.io/en/latest/_autosummary/_autosummary/sofacomponents.ConstraintSet.BilateralInteractionConstraint.html
But I still don’t understand what first_point and second_point represent. For example, in my case, I want to combine two objects so I created two points on the body of each object. What would my first_point and second_point be?
Owen25 May 2020 at 17 h 59 min #16372
- You must be logged in to reply to this topic.