Skip to content

Commit 534d520

Browse files
authored
Add return value to Task::execute (#136)
1 parent c44d0ca commit 534d520

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

core/include/moveit/task_constructor/task.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646

4747
#include <moveit/macros/class_forward.h>
4848

49+
#include <moveit_msgs/MoveItErrorCodes.h>
50+
4951
namespace moveit {
5052
namespace core {
5153
MOVEIT_CLASS_FORWARD(RobotModel)
@@ -119,8 +121,8 @@ class Task : protected WrapperBase
119121
bool plan(size_t max_solutions = 0);
120122
/// interrupt current planning (or execution)
121123
void preempt();
122-
/// execute solution
123-
void execute(const SolutionBase& s);
124+
/// execute solution, return the result
125+
moveit_msgs::MoveItErrorCodes execute(const SolutionBase& s);
124126

125127
/// print current task state (number of found solutions and propagated states) to std::cout
126128
void printState(std::ostream& os = std::cout) const;

core/src/task.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,15 @@ void Task::preempt() {
303303
pimpl()->preempt_requested_ = true;
304304
}
305305

306-
void Task::execute(const SolutionBase& s) {
306+
moveit_msgs::MoveItErrorCodes Task::execute(const SolutionBase& s) {
307307
actionlib::SimpleActionClient<moveit_task_constructor_msgs::ExecuteTaskSolutionAction> ac("execute_task_solution");
308308
ac.waitForServer();
309309

310310
moveit_task_constructor_msgs::ExecuteTaskSolutionGoal goal;
311311
s.fillMessage(goal.solution, pimpl()->introspection_.get());
312312
ac.sendGoal(goal);
313313
ac.waitForResult();
314+
return ac.getResult()->error_code;
314315
}
315316

316317
void Task::publishAllSolutions(bool wait) {

0 commit comments

Comments
 (0)