diff --git a/core/python/bindings/src/core.cpp b/core/python/bindings/src/core.cpp index a926778ab..12d9679f9 100644 --- a/core/python/bindings/src/core.cpp +++ b/core/python/bindings/src/core.cpp @@ -95,6 +95,8 @@ void export_core(pybind11::module& m) { } }); + py::classh(m, "Introspection", "Introspection class"); + py::classh(m, "Solution", "Abstract base class for solutions of a stage") .def_property("cost", &SolutionBase::cost, &SolutionBase::setCost, "float: Cost associated with the solution") .def_property("comment", &SolutionBase::comment, &SolutionBase::setComment, @@ -109,12 +111,12 @@ void export_core(pybind11::module& m) { ":visualization_msgs:`Marker`: Markers to visualize important aspects of the trajectory (read-only)") .def( "toMsg", - [](const SolutionBase& self) { + [](const SolutionBase& self, moveit::task_constructor::Introspection* introspection) { moveit_task_constructor_msgs::Solution msg; - self.toMsg(msg); + self.toMsg(msg, introspection); return msg; }, - "Convert to the ROS message ``Solution``"); + "Convert to the ROS message ``Solution``", py::arg("introspection") = nullptr); py::classh(m, "SubTrajectory", "Solution trajectory connecting two InterfaceStates of a stage") @@ -462,6 +464,8 @@ void export_core(pybind11::module& m) { .def( "setCostTerm", [](Task& self, const LambdaCostTerm::SubTrajectoryShortSignature& f) { self.setCostTerm(f); }, "Specify a function to calculate trajectory costs") + .def("introspection", &Task::introspection, py::return_value_policy::reference_internal, + "Access introspection object") .def("reset", &Task::reset, "Reset task (and all its stages)") .def("init", py::overload_cast<>(&Task::init), "Initialize the task (and all its stages)") .def("plan", &Task::plan, "max_solutions"_a = 0, R"( diff --git a/core/python/bindings/src/core.h b/core/python/bindings/src/core.h index 9be7a4de6..84dd6349a 100644 --- a/core/python/bindings/src/core.h +++ b/core/python/bindings/src/core.h @@ -140,3 +140,4 @@ PYBIND11_SMART_HOLDER_TYPE_CASTERS(moveit::task_constructor::Fallbacks) PYBIND11_SMART_HOLDER_TYPE_CASTERS(moveit::task_constructor::Merger) PYBIND11_SMART_HOLDER_TYPE_CASTERS(moveit::task_constructor::WrapperBase) PYBIND11_SMART_HOLDER_TYPE_CASTERS(moveit::task_constructor::Task) +PYBIND11_SMART_HOLDER_TYPE_CASTERS(moveit::task_constructor::Introspection)