rclnodejs 0.21.0 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,7 +45,7 @@ npm i rclnodejs@x.y.z
45
45
 
46
46
  | RCLNODEJS Version | Compatible ROS 2 Release |
47
47
  | :-------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
48
- | [0.21.0 (current)](https://www.npmjs.com/package/rclnodejs/v/0.21.0) ([API](http://robotwebtools.org/rclnodejs/docs/0.21.0/index.html)) | [Galactic Geochelone](https://github.com/ros2/ros2/releases/tag/release-galactic-20210716) / [Foxy Fitzroy](https://github.com/ros2/ros2/releases/tag/release-foxy-20201211) / [Eloquent Elusor](https://github.com/ros2/ros2/releases/tag/release-eloquent-20200124) |
48
+ | [0.21.1 (current)](https://www.npmjs.com/package/rclnodejs/v/0.21.1) ([API](http://robotwebtools.org/rclnodejs/docs/0.21.0/index.html)) | [Galactic Geochelone](https://github.com/ros2/ros2/releases/tag/release-galactic-20210716) / [Foxy Fitzroy](https://github.com/ros2/ros2/releases/tag/release-foxy-20201211) / [Eloquent Elusor](https://github.com/ros2/ros2/releases/tag/release-eloquent-20200124) |
49
49
  | [0.10.3](https://github.com/RobotWebTools/rclnodejs/releases/tag/0.10.3) | [Dashing Diademata - Patch 4](https://github.com/ros2/ros2/releases/tag/release-dashing-20191018) |
50
50
 
51
51
  ## Documentation
package/lib/node.js CHANGED
@@ -102,7 +102,7 @@ class Node extends rclnodejs.ShadowNode {
102
102
  this._parameterEventPublisher = null;
103
103
  this._setParametersCallbacks = [];
104
104
  this._logger = new Logging(rclnodejs.getNodeLoggerName(this.handle));
105
- this.spinning = false;
105
+ this._spinning = false;
106
106
 
107
107
  this._parameterEventPublisher = this.createPublisher(
108
108
  PARAMETER_EVENT_MSG_TYPE,
@@ -375,6 +375,14 @@ class Node extends rclnodejs.ShadowNode {
375
375
  });
376
376
  }
377
377
 
378
+ /**
379
+ * Determine if this node is spinning.
380
+ * @returns {boolean} - true when spinning; otherwise returns false.
381
+ */
382
+ get spinning() {
383
+ return this._spinning;
384
+ }
385
+
378
386
  /**
379
387
  * Trigger the event loop to continuously check for and route.
380
388
  * incoming events.
@@ -388,7 +396,7 @@ class Node extends rclnodejs.ShadowNode {
388
396
  throw new Error('The node is already spinning.');
389
397
  }
390
398
  this.start(this.context.handle, timeout);
391
- this.spinning = true;
399
+ this._spinning = true;
392
400
  }
393
401
 
394
402
  /**
@@ -401,21 +409,21 @@ class Node extends rclnodejs.ShadowNode {
401
409
 
402
410
  /**
403
411
  * Terminate spinning - no further events will be received.
404
- * @returns {undfined}
412
+ * @returns {undefined}
405
413
  */
406
414
  stop() {
407
415
  super.stop();
408
- this.spinning = false;
416
+ this._spinning = false;
409
417
  }
410
418
 
411
419
  /**
412
420
  * Terminate spinning - no further events will be received.
413
- * @returns {undfined}
421
+ * @returns {undefined}
414
422
  * @deprecated since 0.18.0, Use stop().
415
423
  */
416
424
  stopSpinning() {
417
425
  super.stop();
418
- this.spinning = false;
426
+ this._spinning = false;
419
427
  }
420
428
 
421
429
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rclnodejs",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "description": "ROS2.0 JavaScript client with Node.js",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -45,7 +45,7 @@ npm i rclnodejs@x.y.z
45
45
 
46
46
  | RCLNODEJS Version | Compatible ROS 2 Release |
47
47
  | :-------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
48
- | [0.21.0 (current)](https://www.npmjs.com/package/rclnodejs/v/0.21.0) ([API](http://robotwebtools.org/rclnodejs/docs/0.21.0/index.html)) | [Galactic Geochelone](https://github.com/ros2/ros2/releases/tag/release-galactic-20210716) / [Foxy Fitzroy](https://github.com/ros2/ros2/releases/tag/release-foxy-20201211) / [Eloquent Elusor](https://github.com/ros2/ros2/releases/tag/release-eloquent-20200124) |
48
+ | [0.21.1 (current)](https://www.npmjs.com/package/rclnodejs/v/0.21.1) ([API](http://robotwebtools.org/rclnodejs/docs/0.21.0/index.html)) | [Galactic Geochelone](https://github.com/ros2/ros2/releases/tag/release-galactic-20210716) / [Foxy Fitzroy](https://github.com/ros2/ros2/releases/tag/release-foxy-20201211) / [Eloquent Elusor](https://github.com/ros2/ros2/releases/tag/release-eloquent-20200124) |
49
49
  | [0.10.3](https://github.com/RobotWebTools/rclnodejs/releases/tag/0.10.3) | [Dashing Diademata - Patch 4](https://github.com/ros2/ros2/releases/tag/release-dashing-20191018) |
50
50
 
51
51
  ## Documentation
@@ -1330,6 +1330,7 @@ NAN_METHOD(CreateArrayBufferFromAddress) {
1330
1330
  memcpy(backing->Data(), addr, length);
1331
1331
  auto array_buffer =
1332
1332
  v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), std::move(backing));
1333
+ free(addr);
1333
1334
  #endif
1334
1335
 
1335
1336
  info.GetReturnValue().Set(array_buffer);
@@ -77,12 +77,14 @@ declare module 'rclnodejs' {
77
77
 
78
78
  type ExecuteCallback<T extends TypeClass<ActionTypeClassName>> = (
79
79
  goalHandle: ServerGoalHandle<T>
80
- ) => ActionResult<T>;
81
- type GoalCallback = () => GoalResponse;
80
+ ) => Promise<ActionResult<T>> | ActionResult<T>;
81
+ type GoalCallback<T extends TypeClass<ActionTypeClassName>> = (
82
+ goalHandle: ServerGoalHandle<T>
83
+ ) => GoalResponse;
82
84
  type HandleAcceptedCallback<T extends TypeClass<ActionTypeClassName>> = (
83
85
  goalHandle: ServerGoalHandle<T>
84
86
  ) => void;
85
- type CancelCallback = () => CancelResponse;
87
+ type CancelCallback = () => Promise<CancelResponse> | CancelResponse;
86
88
 
87
89
  interface ActionServerOptions extends Options<ActionQoS> {
88
90
  /**
@@ -112,7 +114,7 @@ declare module 'rclnodejs' {
112
114
  typeClass: T,
113
115
  actionName: string,
114
116
  executeCallback: ExecuteCallback<T>,
115
- goalCallback?: GoalCallback,
117
+ goalCallback?: GoalCallback<T>,
116
118
  handleAcceptedCallback?: HandleAcceptedCallback<T>,
117
119
  cancelCallback?: CancelCallback,
118
120
  options?: ActionServerOptions
@@ -144,7 +146,7 @@ declare module 'rclnodejs' {
144
146
  *
145
147
  * @param goalCallback - Callback function, if not provided, then unregisters any previously registered callback.
146
148
  */
147
- registerGoalCallback(goalCallback?: GoalCallback): void;
149
+ registerGoalCallback(goalCallback?: GoalCallback<T>): void;
148
150
 
149
151
  /**
150
152
  * Register a callback for handling cancel requests.
package/types/node.d.ts CHANGED
@@ -182,6 +182,13 @@ declare module 'rclnodejs' {
182
182
  */
183
183
  options(): NodeOptions;
184
184
 
185
+ /**
186
+ * Determine if this node is spinning.
187
+ *
188
+ * @returns true when spinning; otherwise returns false.
189
+ */
190
+ get spinning(): boolean;
191
+
185
192
  /**
186
193
  * Trigger the event loop to continuously check for and route.
187
194
  * incoming events.