Rigidfication of an object with SofaCUDA #216
-
|
Hi, I'm trying to get CUDA to work with a simulation that I'm working on. It works fine without CUDA but I'm curious as to whether changing to CUDA would improve the simulation performance or not. It involves a soft finray finger which is imported as a def fingerNode(parent, name="Finger", scale: list = [1, 1, 1],
translation: list = [0, 0, 0], rotation: list = [0, 0, 0], stiffness: float = 1200,
damping: float = 0, totalMass:float = 3.14e-3):
finger = parent.addChild(name)
finger.addObject('EulerImplicitSolver', name='odeSolver')
finger.addObject('CGLinearSolver', iterations="25", tolerance=1e-9, threshold=1e-9)
finger.loader = finger.addObject('MeshGmshLoader', name='loader', filename='Data/t20.msh',
rotation=rotation, translation=translation, scale3d=scale)
finger.addObject('MechanicalObject', name='dofs', template='CudaVec3f', src="@loader")
finger.container = finger.addObject('TetrahedronSetTopologyContainer', src=finger.loader.getLinkPath(), name='container')
finger.addObject('UniformMass', totalMass=totalMass, name='mass', topology='@container')
finger.addObject('MeshSpringForceField', name='Springs', template='CudaVec3f',tetrasStiffness=stiffness, tetrasDamping=damping, topology='@container')
return fingerThis function is called by an ActuatedFinger node, the same class that is used in the SoftFingerDesign example, and replaces the The # Rigidify the finger nodes in the ROI. Create a Rigidified object and set up a spring force
# field to constrain the nodes to stay in the rest shape
rigidifiedStruct = Rigidify(self, self.elasticMaterial, groupIndices=indices, frames=frame,
name="RigidifiedStructure")
servoArm = arm.ServoMotor.Articulation.ServoWheel.ServoArm
servoArm.addChild(rigidifiedStruct.RigidParts)
servoArm.RigidParts.addObject('RigidRigidMapping', index=0, input=servoArm.dofs.getLinkPath())The problem arises when the Is it because Rigidify cannot be used with SofaCUDA at the moment, or am I making a mistake elsewhere? Happy to send more code should it be necessary. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Hi, you are perfectly right. The function |
Beta Was this translation helpful? Give feedback.
Hi,
you are perfectly right. The function
Rigidifyhas not been designed to support other templates thanVec3. I can make the change to introduce this support in STLIB. In the meantime, could you just try to replaceVec3byCudaVec3fin the content of theRigidifyfunction? You need to replacetemplate="Vec3"bytemplate="CudaVec3f"andtemplate="Vec3,Vec3"bytemplate="CudaVec3f,CudaVec3f". Let me know if it works.