Skip to content

Commit

Permalink
action name as node name
Browse files Browse the repository at this point in the history
  • Loading branch information
mgonzs13 committed Jun 5, 2024
1 parent ff05160 commit 54266c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@
class Merlin2Action(Node, PddlActionDto, ABC):
""" Merlin2 Action Class """

def __init__(self, a_name: str, durative: bool = True) -> None:
def __init__(self, action_name: str, durative: bool = True) -> None:

Node.__init__(self, a_name, namespace="merlin2")
PddlActionDto.__init__(self,
a_name,
durative=durative)
Node.__init__(self, action_name, namespace="merlin2")
PddlActionDto.__init__(
self,
self.get_name(),
durative=durative
)

# loading parameters
parameter_loader = ParameterLoader(self)
Expand All @@ -54,13 +56,15 @@ def __init__(self, a_name: str, durative: bool = True) -> None:
self.set_conditions(pddl_condition_dto_list)

if not self.save_action():
raise Exception("Wrong PDDL action: " + a_name)
raise Exception(f"Wrong PDDL action: {self.get_name()}")

# action
self.__action_server = self.create_action_server(DispatchAction,
a_name,
self.__execute_server,
cancel_callback=self.__cancel_callback)
self.__action_server = self.create_action_server(
DispatchAction,
self.get_name(),
self.__execute_server,
cancel_callback=self.__cancel_callback
)

def set_parameters(self, parameters: Union[PddlActionDto | Parameter]) -> None:
""" set parameters for PddlActionDto and Node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, action_name: str) -> None:
Merlin2Action.__init__(self, action_name)
StateMachine.__init__(self, [SUCCEED, ABORT, CANCEL])

YasminViewerPub(action_name.upper(), self, node=self)
YasminViewerPub(self.get_name().upper(), self, node=self)

def __hash__(self):
return Merlin2Action.__hash__(self)
Expand Down

0 comments on commit 54266c2

Please sign in to comment.