Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/advanced/sofa/gui/finger/Finger.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def createScene(rootNode):
pullPoint=[0.0, 12.5, 2.5])
cable.addObject('BarycentricMapping')

controller = FingerController(rootNode, cable.aCableActuator, finger.tetras)
controller = FingerController(cable.aCableActuator, finger.tetras)
finger.addObject(controller)

##########################################
Expand Down
12 changes: 4 additions & 8 deletions examples/advanced/sofa/gui/finger/FingerController.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
from pathlib import Path
import numpy as np
from pySimBlocks.blocks.systems.sofa import SofaPysimBlocksController

import Sofa

from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent




class FingerController(SofaPysimBlocksController):

def __init__(self, root, actuator, mo, tip_index=121, name="FingerController"):
super().__init__(root, name=name)
self.project_yaml = str((BASE_DIR / '../sofa_plant/project.yaml').resolve())
def __init__(self, actuator, mo, tip_index=121, name="FingerController"):
super().__init__(name=name)
self.project_yaml = str((BASE_DIR / '../sofa_exchange/project.yaml').resolve())

self.mo = mo
self.actuator = actuator
self.tip_index = tip_index
self.dt = root.dt.value
self.verbose = True

# Inputs & outputs dictionaries
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced/sofa/python/Finger.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def createScene(rootNode):
pullPoint=[0.0, 12.5, 2.5])
cable.addObject('BarycentricMapping')

controller = FingerController(rootNode, cable.aCableActuator, finger.tetras)
controller = FingerController(cable.aCableActuator, finger.tetras)
finger.addObject(controller)

##########################################
Expand Down
7 changes: 2 additions & 5 deletions examples/advanced/sofa/python/FingerController.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import numpy as np
from pySimBlocks.blocks.systems.sofa import SofaPysimBlocksController

import Sofa


class FingerController(SofaPysimBlocksController):

def __init__(self, root, actuator, mo, tip_index=121, name="FingerController"):
super().__init__(root, name=name)
def __init__(self, actuator, mo, tip_index=121, name="FingerController"):
super().__init__(name=name)

self.mo = mo
self.actuator = actuator
self.tip_index = tip_index
self.dt = root.dt.value

# Inputs & outputs dictionaries
self.inputs = { "cable": None }
Expand Down
Loading