Home › Forum › SOFA › Programming with SOFA › local pivot points for .obj files
- This topic has 5 replies, 2 voices, and was last updated 4 years, 4 months ago by golnazraja.
-
AuthorPosts
-
31 May 2020 at 18:01 #16464golnazrajaBlocked
Hi everyone,
I’m new to Sofa and I want to connect our own haptic to Sofa. I’ve done this on unity but the accuracy was not enough for us, anyway… I built a maya file for our robot with proper pivot point for each joint, so I can get the movement of each joint and apply the transform according to the pivot point, But when I load my .obj files to Sofa there is no pivot point in the local positions that I made in maya. How can I have my local pivot points and do rotation and translation according to them?This is a part of my code:
<Node name="joint2"> <TransformEngine template="Rigid3d" name="engine" input_position="0 0 0 0 0 0 1" /> <CGLinearSolver name="CG Solver" iterations="25" tolerance="1e-5" threshold="1e-5"/> <EulerImplicitSolver name="EulerImplicit" rayleighStiffness="0.1" rayleighMass="0.1" /> <MeshObjLoader template="Rigid3d" name="ObjLoader" filename="for sofa/joint2.obj" /> <MechanicalObject template="Rigid3d" src="@ObjLoader" name="myRigidParticleForRotation2" position="@engine.output_position" showObject="true" showObjectScale="0.1" /> <OglModel template="Rigid3d" name="VisualModel" src="@ObjLoader" /> <UniformMass template="Rigid3d" totalMass="1"/> <MeshSpringForceField template="Rigid3d" name="forcefield" linesStiffness="10" /> <RigidMapping input="@." output="@." /> </Node>
and the python file:
import Sofa import sys class rotate(Sofa.PythonScriptController): # optionnally, script can create a graph... def initGraph(self,node): nodeParticle = node.getChild('joint2') self.engine = nodeParticle.getObject('engine') return 0 def onBeginAnimationStep(self,dt): # adding at each time step a rotation angle in x (Euler angle) of 5 degree rotation = self.engine.findData('rotation').value rotation[0][1] = rotation[0][1] + 5 print rotation[0][1] self.engine.findData('rotation').value = rotation return 0
11 June 2020 at 11:47 #16585HugoKeymasterHi @golnaz
I apologize for the very late reply, also due to the fact this topic is not really part of my skills.
For such articulation description, there is in SOFA the ArticulatedSystemMapping. It is a way to describe articulations:
* you can see an example scene here
* and the documentation is hereYou could thus create a pivot between rigid parts of your robot.
I hope this helps.Best wishes,
Hugo
14 June 2020 at 18:31 #16621golnazrajaBlockedHi @Hugo,
Thanks for your response.
I think I need more guidance about this subject. I have tried to use ArticulatedSystemMapping but I don’t know how to rotate each joint around its pivot point that is an articulationCenter. I tried transformEngine but it didn’t work.
Can you help me with this issue?15 June 2020 at 12:59 #16634HugoKeymasterHi @golnaz
You would like to actuate your pivot? is that correct?
In the example of ArticulatedSystemMapping think what you are looking for is actually to access and change the value of the MechanicalObject “rest”. This is where the rest position of the actuator is defined.Can you let us know if this fits?
Hugo
23 June 2020 at 22:52 #16703HugoKeymasterHi @golnaz
Do not hesitate to share some mesh and description of the expected robotic setup.
Best,Hugo
7 July 2020 at 19:08 #16813golnazrajaBlockedHi @Hugo
I decided to use forward kinematic and mathematic calculations instead of actuating the hole robot and I am working on it.
Thanks for your response.
-
AuthorPosts
- You must be logged in to reply to this topic.