Skip to content

Commit 41a35ef

Browse files
jstnhuangchris-smith
authored andcommitted
Added goal to GoalHandle (#92)
* Added goal field to GoalHandle. * Made goal field private and added getter.
1 parent c2752be commit 41a35ef

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

src/actions/ActionServer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class ActionServer extends EventEmitter {
103103
return false;
104104
}
105105

106-
handle = new GoalHandle(msg.goal_id, this);
106+
handle = new GoalHandle(msg.goal_id, this, GoalStatuses.PENDING, msg.goal);
107107
this._goalHandleList.push(handle);
108108
this._goalHandleCache[handle.id] = handle;
109109

src/actions/GoalHandle.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ let GoalStatus = null;
2525
let GoalStatuses = null;
2626

2727
class GoalHandle {
28-
constructor(goalId, actionServer, status) {
28+
/**
29+
* goalId: An actionlib_msgs/GoalID.
30+
* actionServer: The ActionServer processing this goal
31+
* status: A number from actionlib_msgs/GoalStatus, like GoalStatuses.PENDING.
32+
* goal: The goal message, e.g., a FibonacciGoal. May be left undefined if
33+
* this goal is used to represent a cancellation.
34+
*/
35+
constructor(goalId, actionServer, status, goal) {
2936
if (goalId.id === '') {
3037
goalId = actionServer.generateGoalId();
3138
}
@@ -48,6 +55,8 @@ class GoalHandle {
4855
goal_id: goalId
4956
});
5057

58+
this._goal = goal;
59+
5160
this._destructionTime = timeUtils.epoch();
5261
}
5362

@@ -73,6 +82,10 @@ class GoalHandle {
7382
return this._status;
7483
}
7584

85+
getGoal() {
86+
return this._goal;
87+
}
88+
7689
publishFeedback(feedback) {
7790
this._as.publishFeedback(this._status, feedback);
7891
}

0 commit comments

Comments
 (0)