@@ -45,7 +45,7 @@ class Action extends EventEmitter2 {
45
45
* and the result in the result callback when the action is completed.
46
46
* Does nothing if this action is currently advertised.
47
47
*
48
- * @param {TGoal } goal - The ROSLIB.ActionGoal to send.
48
+ * @param {TGoal } goal - The action goal to send.
49
49
* @param {sendGoalResultCallback } resultCallback - The callback function when the action is completed.
50
50
* @param {sendGoalFeedbackCallback } [feedbackCallback] - The callback function when the action pulishes feedback.
51
51
* @param {sendGoalFailedCallback } [failedCallback] - The callback function when the action failed.
@@ -149,14 +149,12 @@ class Action extends EventEmitter2 {
149
149
* action callback with the auto-generated ID as a user-accessible input.
150
150
* Should not be called manually.
151
151
*
152
- * @param {Object } rosbridgeRequest - The ROSLIB.ActionGoal to send.
152
+ * @param {Object } rosbridgeRequest - The action goal to send.
153
153
* @param {string } rosbridgeRequest.id - The ID of the action goal.
154
+ * @param {TGoal } rosbridgeRequest.args - The arguments of the action goal.
154
155
*/
155
156
_executeAction ( rosbridgeRequest ) {
156
- var id ;
157
- if ( rosbridgeRequest . id ) {
158
- id = rosbridgeRequest . id ;
159
- }
157
+ var id = rosbridgeRequest . id ;
160
158
161
159
// If a cancellation callback exists, call it when a cancellation event is emitted.
162
160
if ( typeof id === 'string' ) {
@@ -167,9 +165,11 @@ class Action extends EventEmitter2 {
167
165
} ) ;
168
166
}
169
167
170
- // Call the goal execution function provided.
171
- // @ts -expect-error -- possibly null
172
- this . _actionCallback ( rosbridgeRequest . args , id ) ;
168
+ // Call the action goal execution function provided.
169
+ if ( typeof this . _actionCallback === 'function' )
170
+ {
171
+ this . _actionCallback ( rosbridgeRequest . args , id ) ;
172
+ }
173
173
}
174
174
175
175
/**
0 commit comments