Trunk tutorials:How to get translational motion in a cable-driven finite element model? #281
Replies: 2 comments 5 replies
-
Hello @TurboS2002, Sorry for the late answer. To help you code the keyboard control, you can have a look at the Tripod tutorial. There's this controller that may help you. If you also have troubles with the trunk's translation motion, I can think of two approaches:
def fixExtremity(self):
self.node.addObject('BoxROI', name='boxROI', box=[[-20, -20, 0], [20, 20, 20]], drawBoxes=False)
self.node.addObject('PartialFixedProjectiveConstraint', fixedDirections=[1, 1, 1], indices='@boxROI.indices') And then translate the rest positions from your controller. For example: with TRUNK_NODE.getMechanicalState().rest_position.writeable() as rest_position:
for position in rest_position:
position[TRANSLATION_DIRECTION] += step
|
Beta Was this translation helpful? Give feedback.
-
@EulalieCoevoet Hi Eulalie, can I also ask if we only change fixedDirections=[1, 1, 1] to fixedDirections=[0, 1, 1] in self.node.addObject('PartialFixedConstraint', fixedDirections=[1, 1, 1], indices='@boxROI.indices') to achieve the translation in the base? Thanks |
Beta Was this translation helpful? Give feedback.
-
I'm creating a finite element simulation in sofa similar to Trunk tutorials and I was wondering how to create controllers for the keyboard to control its translational motion?
Beta Was this translation helpful? Give feedback.
All reactions