Skip to content

Commit

Permalink
Fix up more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-bass committed Nov 14, 2023
1 parent 5a62c9d commit 702908f
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/core/Action.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@ function Action(options) {
Action.prototype.__proto__ = EventEmitter2.prototype;

/**
* Calls the service. Returns the service response in the
* callback. Does nothing if this service is currently advertised.
* Sends an action goal. Returns the feedback in the feedback callback while the action is running
* and the result in the result callback when the action is completed.
* Does nothing if this action is currently advertised.
*
* @param request - the ROSLIB.ServiceRequest to send
* @param resultCallback - function with params:
* @param goal - the ROSLIB.ActionGoal to send
* @param resultCallback - the callback function when the action is completed with params:
* * result - the result from the action
* @param feedbackCallback - the callback function when the action publishes feedback (optional). Params:
* * feedback - the feedback from the action
* @param failedCallback - the callback function when the action failed (optional). Params:
* * error - the error message reported by ROS
*/
Action.prototype.sendGoal = function(request, resultCallback, feedbackCallback, failedCallback) {
Action.prototype.sendGoal = function(goal, resultCallback, feedbackCallback, failedCallback) {
if (this.isAdvertised) {
return;
}
Expand All @@ -67,14 +68,19 @@ Action.prototype.sendGoal = function(request, resultCallback, feedbackCallback,
id : actionGoalId,
action : this.name,
action_type: this.actionType,
args : request,
args : goal,
feedback : true,
};
this.ros.callOnConnection(call);

return actionGoalId;
};

/**
* Cancels an action goal.
*
* @param id - the ID of the action goal to cancel.
*/
Action.prototype.cancelGoal = function(id) {
var call = {
op: 'cancel_action_goal',
Expand Down Expand Up @@ -108,6 +114,9 @@ Action.prototype.advertise = function(callback) {
this.isAdvertised = true;
};

/**
* Unadvertise a previously advertised action.
*/
Action.prototype.unadvertise = function() {
if (!this.isAdvertised) {
return;
Expand Down

0 comments on commit 702908f

Please sign in to comment.