From e7dec6bf6af1f1906cd3b2b0a563a26aab359b7d Mon Sep 17 00:00:00 2001 From: Dave Kroezen Date: Sat, 14 Oct 2023 18:29:01 +0200 Subject: [PATCH] Extend ProfileDictionary in Python --- .../tesseract_command_language/__init__.py | 0 .../profile_dictionary.py | 45 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 tesseract_python/src/tesseract_robotics/tesseract_command_language/__init__.py create mode 100644 tesseract_python/src/tesseract_robotics/tesseract_command_language/profile_dictionary.py diff --git a/tesseract_python/src/tesseract_robotics/tesseract_command_language/__init__.py b/tesseract_python/src/tesseract_robotics/tesseract_command_language/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tesseract_python/src/tesseract_robotics/tesseract_command_language/profile_dictionary.py b/tesseract_python/src/tesseract_robotics/tesseract_command_language/profile_dictionary.py new file mode 100644 index 000000000..2409507f9 --- /dev/null +++ b/tesseract_python/src/tesseract_robotics/tesseract_command_language/profile_dictionary.py @@ -0,0 +1,45 @@ +from tesseract_robotics import tesseract_command_language +from tesseract_robotics.tesseract_motion_planners_trajopt import ( + ProfileDictionary_addProfile_TrajOptCompositeProfile, + ProfileDictionary_addProfile_TrajOptPlanProfile, + ProfileDictionary_addProfile_TrajOptSolverProfile, + ProfileDictionary_getProfile_TrajOptCompositeProfile, + ProfileDictionary_getProfile_TrajOptPlanProfile, + ProfileDictionary_getProfile_TrajOptSolverProfile, + ProfileDictionary_hasProfile_TrajOptCompositeProfile, + ProfileDictionary_hasProfile_TrajOptPlanProfile, + ProfileDictionary_hasProfile_TrajOptSolverProfile, + TrajOptCompositeProfile, + TrajOptPlanProfile, + TrajOptSolverProfile, +) + + +class ProfileDictionary(tesseract_command_language.ProfileDictionary): + def __init__(self): + super().__init__() + + def add_profile(self, ns: str, profile_name: str, profile): + if issubclass(profile.__class__, TrajOptCompositeProfile): + ProfileDictionary_addProfile_TrajOptCompositeProfile( + profile_dictionary=self, ns=ns, profile_name=profile_name, profile=profile + ) + + elif issubclass(profile.__class__, TrajOptPlanProfile): + ProfileDictionary_addProfile_TrajOptPlanProfile( + profile_dictionary=self, ns=ns, profile_name=profile_name, profile=profile + ) + + elif issubclass(profile.__class__, TrajOptSolverProfile): + ProfileDictionary_addProfile_TrajOptSolverProfile( + profile_dictionary=self, ns=ns, profile_name=profile_name, profile=profile + ) + + else: + raise NotImplementedError() + + def get_profile(self, ns: str, profile_name: str): + raise NotImplementedError() + + def has_profile(self, ns: str, profile_name: str): + raise NotImplementedError()