21 October 2020 at 12 h 28 min #17433
I’m trying to simulate a pneumatic robot with SofaPython (actually using the Soft Robots plugin binaries). In my scene one bellow of the robot(looks like an ellipsoid) inflates using a Python Controller and SurfacePressureConstraint. The inflation is limited by two floors, one above and one below the bellow forcing it to deform when colliding. So far this works reasonably well.
Now I want to translate one of the floors vertically to either compress or expand the bellow and later get the contact area at every time step in order to calculate the contact force. I have tried different methods (move rest_position, free_position, changing translation of mechanical object, LinearMovementConstraint) that I found in the forum to translate the floor but nothing seems to work – at least visually. I checked the properties of my mechanical object via the GUI and the values I tried to change did in fact get updated the way they were supposed to but my scene still looks the same.
How do I get the floor the move? I’m guessing there’s only a minor thing I am missing currently, so any help would be great!
Thanks in advance.21 October 2020 at 12 h 52 min #17434
I had a similar problem and the SoftRobots tutorial on the tripod was incredibly helpful.
Have a look at the setupanimation function here:
If you can use the splib, great! If not, you may want to copy out the relevant snippets of code from there. 😉
Paul30 October 2020 at 15 h 06 min #17494HugoKeymaster
11 November 2020 at 17 h 32 min #17633
- SOFA Consortium
thank you for your replies and sorry for answering so late but I was working on something different in the meantime.
@scheikl: Thanks for the provided example. So far I haven’t been able to get it working that way but I am sure it will come in handy at a later point and has given me a good idea of how to avoid inflating/deflating manually in the future which I did not think about before.
Also I’m struggling to understand how to properly use the different models (especially collision, as my scene gets pretty slow once the bellow hits the floors). The next step would be to have larger floors and two bellows next to each other (as in ‘bellow_rotatory_floors.py’ in the provided folder). Then one of the bellows is inflated causing the floor to rotate around its x-axis and pushing down on the other bellow and so on – both of the bellows should be attached to the floors at their top/bottom center. I found Bilateral Movement Constraint and the corresponding example scene but I don’t understand how to use it properly in my scene. Also I am not sure which component to use regarding the movement of the floor which should be limited to rotation around one axis.
1. How do I get my scene to run smoother during collision?
2. How to best implement the different models and mappings?
3. How to properly attach bellows to floors?
4. How to allow/constraint movements of the floor in case of collision?
Thank you so much for your help! If you have any question regarding my code or this long post please do not hesitate to ask 🙂30 November 2020 at 19 h 11 min #17811
I am still struggling with this. Can you help me with any of my questions or poke someone who can please?
Jonny30 November 2020 at 22 h 27 min #17815
I just had a look at the files.
My intuition would be to create a
Rigid3dtemplate (so you only have to set one position value to move the floor, and not every position for each node. And then use a
MechanicalObjectand your collision and visual models.
###Creating the floor floor = rootNode.addChild(name) floor.addObject( "MechanicalObject", name="mechObject", template="Rigid3", translation="0 0 -30", rotation="90 0 0", ) ###VisualModel floorVisu = floor.addChild("VisualModel") floorVisu.addObject( "MeshObjLoader", name="loader", filename="mesh/floor.obj", scale=1 ) floorVisu.addObject("OglModel", name="model", src="@loader", color=[0.8, 0.8, 0.8]) floorVisu.addObject("RigidMapping") ###CollisionModel floorCollis = floor.addChild("collision") floorCollis.addObject( "MeshObjLoader", name="loader", filename="mesh/floor.obj", triangulate="true", scale=1, ) floorCollis.addObject("MeshTopology", src="@loader") floorCollis.addObject("MechanicalObject") floorCollis.addObject("TriangleCollisionModel",) floorCollis.addObject("LineCollisionModel") floorCollis.addObject("PointCollisionModel") floorCollis.addObject("RigidMapping")
That might speed things up a little. At least for moving the floor.5 December 2020 at 17 h 16 min #17956
thanks for your fast response again. Indeed, using Rigid3d template simplified the use of
LinearMovementConstraintquite a bit.
Next thing I am stuck with is the connection between bellow and floor (more important in the other scene with two bellows). From what I have seen
BilateralInteractionConstraintwould be the best options.
From my understanding I would need both the floor and bellow to have the same DOFs (Vec3d in my case). Now when I use AttachConstraint the connection looks pretty realistic and I can easily change the connected “area”/nodes. However the floor is deforming rather than moving once I inflate the bellow whereas I would want the floor to be rigid. Is there a way to fix this?
Furthermore, I want to restrict the movement to just rotation around the x axis – so no translation either.
FixedRotationConstraintseems to work for rotation, and I have tried
FixedPlaneConstraintwithout any success. I guess I could use
PartialFixedConstraintwith Rigid3d as well and then just constraint that one node though the attachment would then not work anymore.
Thanks again for any help!
Jonny5 December 2020 at 19 h 54 min #17957
I’m glad that helped! 🙂
For the deforming floor, you could try setting appropriate flags in the collision model to tell sofa that these models are supposed to move, but not deform.
floorCollis.addObject("MeshTopology", src="@loader") floorCollis.addObject("MechanicalObject") floorCollis.addObject("TriangleCollisionModel", simulated="false", moving="true") floorCollis.addObject("LineCollisionModel", simulated="false", moving="true") floorCollis.addObject("PointCollisionModel", simulated="false", moving="true") floorCollis.addObject("RigidMapping")
Sadly I do not have any (successful) experience with any of the
But introducing a ForceField was pretty sufficient for my use cases. As @hugo said in the post, it does not ensure, that the points will be at the exact same location. But that really depends on the use-case, right?
Maybe try using BoxStiffSpringForceField. This one will take the indices of both objects from their respective boxes and create springs between them.8 December 2020 at 18 h 09 min #17977
I’m currently trying all the different options/components that could be useful in the two scenes in order to figure out which work best. I will post an update as soon as I meet another problem or get everything to work 🙂 Once again thanks for you help so far!
Cheers9 December 2020 at 12 h 51 min #17982
- You must be logged in to reply to this topic.