diff --git a/include/arbitration_graphs/internal/behavior_py.hpp b/include/arbitration_graphs/internal/behavior_py.hpp index b214bef..45a8743 100644 --- a/include/arbitration_graphs/internal/behavior_py.hpp +++ b/include/arbitration_graphs/internal/behavior_py.hpp @@ -53,11 +53,11 @@ class PyBehavior : public Behavior { }; template -void bindBehavior(py::module& module, const std::string& suffix = "") { +void bindBehavior(py::module& module, const std::string& bindingName = "Behavior") { using BehaviorT = Behavior; using PyBehaviorT = PyBehavior; - py::class_>(module, ("Behavior" + suffix).c_str()) + py::class_>(module, bindingName.c_str()) .def(py::init(), py::arg("name") = "Behavior") .def("get_command", &BehaviorT::getCommand, py::arg("time")) .def("check_invocation_condition", &BehaviorT::checkInvocationCondition, py::arg("time")) diff --git a/include/arbitration_graphs/python_bindings.hpp b/include/arbitration_graphs/python_bindings.hpp index 896cff4..415bedf 100644 --- a/include/arbitration_graphs/python_bindings.hpp +++ b/include/arbitration_graphs/python_bindings.hpp @@ -21,15 +21,15 @@ template , typename VerificationResultT = typename decltype(std::function{VerifierT::analyze})::result_type> void bindArbitrationGraphs(py::module& module, - const std::string& behaviorCommandSuffix = "", - const std::string& behaviorSubCommandSuffix = "") { + const std::string& behaviorBindingName = "Behavior", + const std::string& behaviorSubCommandBindingName = "BehaviorSubCommand") { bindExceptions(module); bindPlaceboVerifier(module); - bindBehavior(module, behaviorCommandSuffix); - // Only bind behavior for SubCommandT if it is different from CommandT + bindBehavior(module, behaviorBindingName); + // Bind the behavior for the SubCommandT only if it is different from the CommandT if constexpr (!std::is_same_v) { - bindBehavior(module, behaviorSubCommandSuffix); + bindBehavior(module, behaviorSubCommandBindingName); } bindArbitrator(module); diff --git a/test/python_bindings.cpp b/test/python_bindings.cpp index c035dc3..7ded62e 100644 --- a/test/python_bindings.cpp +++ b/test/python_bindings.cpp @@ -101,7 +101,7 @@ PYBIND11_MODULE(arbitration_graphs_py, mainModule) { } PYBIND11_MODULE(arbitration_graphs_py_with_subcommand, mainModule) { - python_api::bindArbitrationGraphs(mainModule, "Int"); + python_api::bindArbitrationGraphs(mainModule, "BehaviorInt", "Behavior"); py::module testingModule = mainModule.def_submodule("testing_types"); bindTestingTypes(testingModule);