From 65fb3ed85f22400d84a1d2899dfcb807c1dbb37e Mon Sep 17 00:00:00 2001 From: Rein Appeldoorn Date: Mon, 4 May 2020 12:44:03 +0200 Subject: [PATCH] feat(SimpleActionServer): add setAborted method --- src/actionlib/SimpleActionServer.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/actionlib/SimpleActionServer.js b/src/actionlib/SimpleActionServer.js index c1ea179f4..6ce70a870 100644 --- a/src/actionlib/SimpleActionServer.js +++ b/src/actionlib/SimpleActionServer.js @@ -171,6 +171,27 @@ SimpleActionServer.prototype.setSucceeded = function(result2) { } }; +/** +* Set action state to aborted and return to client +*/ + +SimpleActionServer.prototype.setAborted = function(result2) { + var resultMessage = new Message({ + status : {goal_id : this.currentGoal.goal_id, status : 4}, + result : result2 + }); + this.resultPublisher.publish(resultMessage); + + this.statusMessage.status_list = []; + if(this.nextGoal) { + this.currentGoal = this.nextGoal; + this.nextGoal = null; + this.emit('goal', this.currentGoal.goal); + } else { + this.currentGoal = null; + } +}; + /** * Function to send feedback */