Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Commit

Permalink
Fix issue #9
Browse files Browse the repository at this point in the history
  • Loading branch information
cmower committed Apr 11, 2022
1 parent a41e657 commit c0befbf
Showing 1 changed file with 40 additions and 10 deletions.
50 changes: 40 additions & 10 deletions ik_ros/src/ik_ros/ik_solver_interfaces.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
from .trac_ik.setup_node import TracIKSetupNode
from .exotica.setup_node import EXOTicaSetupNode
from .pybullet.setup_node import PybulletSetupNode

from .trac_ik.interface import TracIKInterface
from .exotica.interface import EXOTicaInterface
# NOTE: pybullet does not have an interface (see README.md in ik_ros/src/ik_ros/pybullet)
###########
## TracIK
trac_ik_available = True
try:
from .trac_ik.setup_node import TracIKSetupNode
from .trac_ik.interface import TracIKInterface
except ModuleNotFoundError:
TracIKSetupNode = None
TracIKInterface = None
trac_ik_available = False

###########
## EXOTica
exotica_available = True
try:
from .exotica.setup_node import EXOTicaSetupNode
from .exotica.interface import EXOTicaInterface
except ModuleNotFoundError:
EXOTicaSetupNode = None
EXOTicaInterface = None
exotica_available = False

###########
## Pybullet
## NOTE: pybullet does not have an interface (see README.md in ik_ros/src/ik_ros/pybullet)
pybullet_available = True
try:
from .pybullet.setup_node import PybulletSetupNode
except ModuleNotFoundError:
PybulletSetupNode = None
pybullet_available = True

"""
Expand All @@ -18,12 +43,17 @@

class SolverInterface:

def __init__(self, setup_node, interface):
def __init__(self, setup_node, interface, is_available):
self.setup_node = setup_node
self.interface = interface
self.is_available = is_available

solver_interfaces = {
'trac_ik': SolverInterface(TracIKSetupNode, TracIKInterface),
'exotica': SolverInterface(EXOTicaSetupNode, EXOTicaInterface),
'pybullet': SolverInterface(PybulletSetupNode, None),
'trac_ik': SolverInterface(TracIKSetupNode, TracIKInterface, trac_ik_available),
'exotica': SolverInterface(EXOTicaSetupNode, EXOTicaInterface, exotica_available),
'pybullet': SolverInterface(PybulletSetupNode, None, pybullet_available),
}

for name, interface in solver_interfaces.items():
if not interface.is_available:
print(f">>>>>>>{name} interface is not available<<<<<<<<")

0 comments on commit c0befbf

Please sign in to comment.