Skip to content

Commit

Permalink
(moveit_py) Extend Trajectory Execution Manager
Browse files Browse the repository at this point in the history
Added part of the functions from moveit#2442
  • Loading branch information
JensVanhooydonck committed Dec 2, 2023
1 parent bddab3f commit b497278
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
4 changes: 4 additions & 0 deletions moveit_py/moveit/planning.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ class TrajectoryExecutionManager:
def is_managing_controllers(self, *args, **kwargs) -> Any: ...
def process_event(self, *args, **kwargs) -> Any: ...
def push(self, *args, **kwargs) -> Any: ...
def execute(self, *args, **kwargs) -> Any: ...
def execute_and_wait(self, *args, **kwargs) -> Any: ...
def wait_for_execution(self, *args, **kwargs) -> Any: ...
def get_last_execution_status(self, *args, **kwargs) -> Any: ...
def set_allowed_execution_duration_scaling(self, *args, **kwargs) -> Any: ...
def set_allowed_goal_duration_margin(self, *args, **kwargs) -> Any: ...
def set_allowed_start_tolerance(self, *args, **kwargs) -> Any: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,32 @@ void initTrajectoryExecutionManager(py::module& m)
// ToDo(MatthijsBurgh)
// See https://github.com/ros-planning/moveit2/issues/2442
// get_trajectories
// execute
// execute_and_wait
// wait_for_execution
// get_current_expected_trajectory_index
// get_last_execution_status

.def("execute",
py::overload_cast<const trajectory_execution_manager::TrajectoryExecutionManager::ExecutionCompleteCallback&,
bool>(&trajectory_execution_manager::TrajectoryExecutionManager::execute),
py::arg("callback"), py::arg("auto_clear") = true,
R"(
Execute a trajectory.
)")
.def("execute_and_wait", &trajectory_execution_manager::TrajectoryExecutionManager::executeAndWait,
py::call_guard<py::gil_scoped_release>(), py::arg("auto_clear") = true,
R"(
Execute a trajectory and wait for it to finish.
)")
.def("wait_for_execution", &trajectory_execution_manager::TrajectoryExecutionManager::waitForExecution,
py::call_guard<py::gil_scoped_release>(),
R"(
Wait for the current trajectory to finish execution.
)")
.def("get_last_execution_status",
&trajectory_execution_manager::TrajectoryExecutionManager::getLastExecutionStatus,
py::return_value_policy::move,
R"(
Get the status of the last execution.
)")
.def("stop_execution", &trajectory_execution_manager::TrajectoryExecutionManager::stopExecution,
py::arg("auto_clear") = true,
py::arg("auto_clear") = true, py::call_guard<py::gil_scoped_release>(),
R"(
Stop whatever executions are active, if any.
)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#pragma once

#include <pybind11/pybind11.h>
#include <pybind11/functional.h>
#include <moveit_py/moveit_py_utils/copy_ros_msg.h>
#include <moveit_py/moveit_py_utils/ros_msg_typecasters.h>
#include <rclcpp/rclcpp.hpp>
Expand Down

0 comments on commit b497278

Please sign in to comment.