rclnodejs 0.19.0 → 0.21.0
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/.gitattributes +117 -0
- package/.vscode/c_cpp_properties.json +15 -0
- package/README.md +5 -6
- package/index.js +6 -3
- package/lib/action/client.js +9 -5
- package/lib/action/client_goal_handle.js +67 -1
- package/lib/action/deferred.js +17 -2
- package/lib/lifecycle.js +24 -5
- package/lib/node.js +18 -10
- package/package.json +12 -10
- package/rosidl_gen/deallocator.js +6 -1
- package/rosidl_gen/primitive_types.js +2 -2
- package/rosidl_gen/templates/message.dot +6 -4
- package/scripts/build.sh +1 -1
- package/scripts/cpplint.js +1 -1
- package/scripts/npmjs-readme.md +5 -6
- package/scripts/ros_distro.js +3 -1
- package/src/executor.hpp +0 -2
- package/src/rcl_bindings.cpp +22 -11
- package/src/rcl_lifecycle_bindings.cpp +30 -9
- package/types/action_client.d.ts +38 -1
- package/types/index.d.ts +5 -1
- package/types/interfaces.d.ts +0 -99
- package/types/lifecycle.d.ts +17 -0
package/.gitattributes
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Based on https://github.com/alexkaratarakis/gitattributes/blob/master/Web.gitattributes
|
|
2
|
+
|
|
3
|
+
# Auto detect
|
|
4
|
+
## Handle line endings automatically for files detected as
|
|
5
|
+
## text and leave all files detected as binary untouched.
|
|
6
|
+
## This will handle all files NOT defined below.
|
|
7
|
+
* text=auto
|
|
8
|
+
|
|
9
|
+
# Source code
|
|
10
|
+
*.bash text eol=lf
|
|
11
|
+
*.bat text eol=crlf
|
|
12
|
+
*.c text eol=lf
|
|
13
|
+
*.cmd text eol=crlf
|
|
14
|
+
*.cpp text eol=lf
|
|
15
|
+
*.css text diff=css
|
|
16
|
+
*.hpp text eol=lf
|
|
17
|
+
*.htm text diff=html
|
|
18
|
+
*.html text diff=html
|
|
19
|
+
*.inc text
|
|
20
|
+
*.ini text
|
|
21
|
+
*.js text eol=lf
|
|
22
|
+
*.json text eol=lf
|
|
23
|
+
*.jsx text eol=lf
|
|
24
|
+
*.less text
|
|
25
|
+
*.ls text
|
|
26
|
+
*.map text -diff
|
|
27
|
+
*.ps1 text eol=crlf
|
|
28
|
+
*.py text diff=python
|
|
29
|
+
*.sh text eol=lf
|
|
30
|
+
*.ts text eol=lf
|
|
31
|
+
*.tsx text eol=lf
|
|
32
|
+
*.xml text eol=lf
|
|
33
|
+
*.xhtml text diff=html
|
|
34
|
+
|
|
35
|
+
# Templates
|
|
36
|
+
*.em text eol=lf
|
|
37
|
+
|
|
38
|
+
# Docker
|
|
39
|
+
Dockerfile text
|
|
40
|
+
|
|
41
|
+
# Documentation
|
|
42
|
+
*.ipynb text
|
|
43
|
+
*.markdown text diff=markdown
|
|
44
|
+
*.md text diff=markdown
|
|
45
|
+
*.mdwn text diff=markdown
|
|
46
|
+
*.mdown text diff=markdown
|
|
47
|
+
*.mkd text diff=markdown
|
|
48
|
+
*.mkdn text diff=markdown
|
|
49
|
+
*.mdtxt text
|
|
50
|
+
*.mdtext text
|
|
51
|
+
*.txt text
|
|
52
|
+
AUTHORS text
|
|
53
|
+
CHANGELOG text
|
|
54
|
+
CHANGES text
|
|
55
|
+
CONTRIBUTING text
|
|
56
|
+
COPYING text
|
|
57
|
+
copyright text
|
|
58
|
+
*COPYRIGHT* text
|
|
59
|
+
license text
|
|
60
|
+
LICENSE text
|
|
61
|
+
readme text
|
|
62
|
+
*README* text
|
|
63
|
+
TODO text
|
|
64
|
+
|
|
65
|
+
# Configs
|
|
66
|
+
*.cnf text
|
|
67
|
+
*.conf text
|
|
68
|
+
*.config text
|
|
69
|
+
.editorconfig text
|
|
70
|
+
.env text
|
|
71
|
+
.gitattributes text
|
|
72
|
+
.gitconfig text
|
|
73
|
+
.htaccess text
|
|
74
|
+
*.lock text -diff
|
|
75
|
+
*.gyp text
|
|
76
|
+
package.json text eol=lf
|
|
77
|
+
package-lock.json text -diff
|
|
78
|
+
pnpm-lock.yaml text eol=lf -diff
|
|
79
|
+
yarn.lock text -diff
|
|
80
|
+
*.toml text
|
|
81
|
+
*.yaml text eol=lf
|
|
82
|
+
*.yml text eol=lf
|
|
83
|
+
Makefile text
|
|
84
|
+
makefile text
|
|
85
|
+
|
|
86
|
+
# Graphics
|
|
87
|
+
*.bmp binary
|
|
88
|
+
*.gif binary
|
|
89
|
+
*.ico binary
|
|
90
|
+
*.jng binary
|
|
91
|
+
*.jp2 binary
|
|
92
|
+
*.jpg binary
|
|
93
|
+
*.jpeg binary
|
|
94
|
+
*.jpx binary
|
|
95
|
+
*.jxr binary
|
|
96
|
+
*.pdf binary
|
|
97
|
+
*.png binary
|
|
98
|
+
# SVG treated as an asset (binary) by default.
|
|
99
|
+
*.svg text
|
|
100
|
+
# If you want to treat it as binary,
|
|
101
|
+
# use the following line instead.
|
|
102
|
+
# *.svg binary
|
|
103
|
+
*.svgz binary
|
|
104
|
+
*.tif binary
|
|
105
|
+
*.tiff binary
|
|
106
|
+
*.wbmp binary
|
|
107
|
+
*.webp binary
|
|
108
|
+
|
|
109
|
+
# Executables
|
|
110
|
+
*.exe binary
|
|
111
|
+
*.pyc binary
|
|
112
|
+
|
|
113
|
+
# RC files (like .babelrc or .eslintrc)
|
|
114
|
+
*.*rc text
|
|
115
|
+
|
|
116
|
+
# Ignore files (like .npmignore or .gitignore)
|
|
117
|
+
*.*ignore text
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ rclnodejs.init().then(() => {
|
|
|
18
18
|
|
|
19
19
|
**Node.js**
|
|
20
20
|
|
|
21
|
-
- [Node.js](https://nodejs.org/en/) version between
|
|
21
|
+
- [Node.js](https://nodejs.org/en/) version between 10.23 - 16.x.
|
|
22
22
|
|
|
23
23
|
**ROS 2 SDK**
|
|
24
24
|
|
|
@@ -43,11 +43,10 @@ npm i rclnodejs@x.y.z
|
|
|
43
43
|
|
|
44
44
|
#### RCLNODEJS - ROS 2 Version Compatibility
|
|
45
45
|
|
|
46
|
-
| RCLNODEJS Version |
|
|
47
|
-
| :-------------------------------------------------------------------------------------------------------------------------------------: |
|
|
48
|
-
| [0.
|
|
49
|
-
|
|
|
50
|
-
| [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) |
|
|
46
|
+
| RCLNODEJS Version | Compatible ROS 2 Release |
|
|
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) |
|
|
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) |
|
|
51
50
|
|
|
52
51
|
## Documentation
|
|
53
52
|
|
package/index.js
CHANGED
|
@@ -187,12 +187,13 @@ let rcl = {
|
|
|
187
187
|
},
|
|
188
188
|
|
|
189
189
|
/**
|
|
190
|
-
* Create a managed Node that implements a well-defined life-cycle state
|
|
190
|
+
* Create a LifecycleNode, a managed Node that implements a well-defined life-cycle state
|
|
191
191
|
* model using the {@link https://github.com/ros2/rcl/tree/master/rcl_lifecycle|ros2 client library (rcl) lifecyle api}.
|
|
192
192
|
* @param {string} nodeName - The name used to register in ROS.
|
|
193
193
|
* @param {string} [namespace=''] - The namespace used in ROS.
|
|
194
194
|
* @param {Context} [context=Context.defaultContext()] - The context to create the node in.
|
|
195
195
|
* @param {NodeOptions} [options=NodeOptions.defaultOptions] - The options to configure the new node behavior.
|
|
196
|
+
* @param {boolean} [enableCommunicationsInterface=true] - enable lifecycle service interfaces, e.g., GetState.
|
|
196
197
|
* @return {LifecycleNode} A new instance of the specified node.
|
|
197
198
|
* @throws {Error} If the given context is not registered.
|
|
198
199
|
* @deprecated since 0.18.0, Use new LifecycleNode constructor.
|
|
@@ -201,13 +202,15 @@ let rcl = {
|
|
|
201
202
|
nodeName,
|
|
202
203
|
namespace = '',
|
|
203
204
|
context = Context.defaultContext(),
|
|
204
|
-
options = NodeOptions.defaultOptions
|
|
205
|
+
options = NodeOptions.defaultOptions,
|
|
206
|
+
enableCommunicationsInterface = true
|
|
205
207
|
) {
|
|
206
208
|
return new this.lifecycle.LifecycleNode(
|
|
207
209
|
nodeName,
|
|
208
210
|
namespace,
|
|
209
211
|
context,
|
|
210
|
-
options
|
|
212
|
+
options,
|
|
213
|
+
enableCommunicationsInterface
|
|
211
214
|
);
|
|
212
215
|
},
|
|
213
216
|
|
package/lib/action/client.js
CHANGED
|
@@ -153,7 +153,7 @@ class ActionClient extends Entity {
|
|
|
153
153
|
let uuid = ActionUuid.fromBytes(message.goal_id.uuid).toString();
|
|
154
154
|
if (this._feedbackCallbacks.has(uuid)) {
|
|
155
155
|
this._feedbackCallbacks.get(uuid)(
|
|
156
|
-
message.toPlainObject(this.typedArrayEnabled)
|
|
156
|
+
message.toPlainObject(this.typedArrayEnabled).feedback
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
@@ -166,10 +166,10 @@ class ActionClient extends Entity {
|
|
|
166
166
|
).toString();
|
|
167
167
|
let status = statusMessage.status;
|
|
168
168
|
|
|
169
|
-
if (
|
|
169
|
+
if (this._goalHandles.has(uuid)) {
|
|
170
170
|
let goalHandle = this._goalHandles.get(uuid);
|
|
171
171
|
if (goalHandle) {
|
|
172
|
-
goalHandle.
|
|
172
|
+
goalHandle.status = status;
|
|
173
173
|
|
|
174
174
|
// Remove done handles from the list
|
|
175
175
|
// eslint-disable-next-line max-depth
|
|
@@ -332,12 +332,16 @@ class ActionClient extends Entity {
|
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
let deferred = new Deferred();
|
|
335
|
-
|
|
336
|
-
|
|
335
|
+
deferred.beforeSetResultCallback((result) => {
|
|
336
|
+
goalHandle.status = result.status;
|
|
337
|
+
return result.result;
|
|
338
|
+
});
|
|
337
339
|
deferred.setDoneCallback(() =>
|
|
338
340
|
this._removePendingResultRequest(sequenceNumber)
|
|
339
341
|
);
|
|
340
342
|
|
|
343
|
+
this._pendingResultRequests.set(sequenceNumber, deferred);
|
|
344
|
+
|
|
341
345
|
return deferred.promise;
|
|
342
346
|
}
|
|
343
347
|
|
|
@@ -26,7 +26,9 @@ class ClientGoalHandle {
|
|
|
26
26
|
this._actionClient = actionClient;
|
|
27
27
|
this._goalId = goalId;
|
|
28
28
|
this._goalResponse = goalResponse;
|
|
29
|
-
this._status =
|
|
29
|
+
this._status = this.accepted
|
|
30
|
+
? ActionInterfaces.GoalStatus.STATUS_ACCEPTED
|
|
31
|
+
: ActionInterfaces.GoalStatus.STATUS_UNKNOWN;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
/**
|
|
@@ -45,11 +47,60 @@ class ClientGoalHandle {
|
|
|
45
47
|
|
|
46
48
|
/**
|
|
47
49
|
* Gets if the goal response was accepted.
|
|
50
|
+
* @deprecated use isAccepted()
|
|
48
51
|
*/
|
|
49
52
|
get accepted() {
|
|
53
|
+
return this.isAccepted();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Determine if goal is currently executing
|
|
58
|
+
* @returns {bool} - True if goal is executing; otherwise return false.
|
|
59
|
+
*/
|
|
60
|
+
isAccepted() {
|
|
50
61
|
return this._goalResponse.accepted;
|
|
51
62
|
}
|
|
52
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Determine if goal is currently executing
|
|
66
|
+
* @returns {bool} - True if goal is executing; otherwise return false.
|
|
67
|
+
*/
|
|
68
|
+
isExecuting() {
|
|
69
|
+
return this.status === ActionInterfaces.GoalStatus.STATUS_EXECUTING;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Determine if goal is in the process of canceling.
|
|
74
|
+
* @returns {bool} - True if goal is canceling; otherwise return false.
|
|
75
|
+
*/
|
|
76
|
+
isCanceling() {
|
|
77
|
+
return this.status === ActionInterfaces.GoalStatus.STATUS_CANCELING;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Determine if goal completed successfullly.
|
|
82
|
+
* @returns {bool} - True if goal completed successfully; otherwise return false.
|
|
83
|
+
*/
|
|
84
|
+
isSucceeded() {
|
|
85
|
+
return this.status === ActionInterfaces.GoalStatus.STATUS_SUCCEEDED;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Determine if goal has been canceled.
|
|
90
|
+
* @returns {bool} - True if goal has been aborted; otherwise return false.
|
|
91
|
+
*/
|
|
92
|
+
isCanceled() {
|
|
93
|
+
return this.status === ActionInterfaces.GoalStatus.STATUS_CANCELED;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Determine if goal has been aborted.
|
|
98
|
+
* @returns {bool} - True if goal was aborted; otherwise return false.
|
|
99
|
+
*/
|
|
100
|
+
isAborted() {
|
|
101
|
+
return this.status === ActionInterfaces.GoalStatus.STATUS_ABORTED;
|
|
102
|
+
}
|
|
103
|
+
|
|
53
104
|
/**
|
|
54
105
|
* Gets the goal status.
|
|
55
106
|
*/
|
|
@@ -57,6 +108,21 @@ class ClientGoalHandle {
|
|
|
57
108
|
return this._status;
|
|
58
109
|
}
|
|
59
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Update status to the latest state of goal computation.
|
|
113
|
+
* When status is in a final state it can not be revered to an
|
|
114
|
+
* earlier state, e.g., can not change from SUCCEEDED to ACCEPTED.
|
|
115
|
+
* @param {number} newStatus - The new status of this goal.
|
|
116
|
+
*/
|
|
117
|
+
set status(newStatus) {
|
|
118
|
+
if (
|
|
119
|
+
this._status < ActionInterfaces.GoalStatus.STATUS_SUCCEEDED &&
|
|
120
|
+
newStatus > this._status
|
|
121
|
+
) {
|
|
122
|
+
this._status = newStatus;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
60
126
|
/**
|
|
61
127
|
* Send a cancel request for the goal.
|
|
62
128
|
* @returns {Promise} - The cancel response.
|
package/lib/action/deferred.js
CHANGED
|
@@ -35,6 +35,19 @@ class Deferred {
|
|
|
35
35
|
return this._promise;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Sets a function to be called before result updated
|
|
40
|
+
* @param {function} callback - Function to be called.
|
|
41
|
+
* @returns {undefined}
|
|
42
|
+
*/
|
|
43
|
+
beforeSetResultCallback(callback) {
|
|
44
|
+
if (typeof callback !== 'function') {
|
|
45
|
+
throw new TypeError('Invalid parameter');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
this._beforeSetResultCallback = callback;
|
|
49
|
+
}
|
|
50
|
+
|
|
38
51
|
/**
|
|
39
52
|
* Resolves the deferred promise.
|
|
40
53
|
* @param {*} result - The value to resolve the promise with.
|
|
@@ -42,8 +55,10 @@ class Deferred {
|
|
|
42
55
|
*/
|
|
43
56
|
setResult(result) {
|
|
44
57
|
if (this._resolve) {
|
|
45
|
-
this._result =
|
|
46
|
-
|
|
58
|
+
this._result = this._beforeSetResultCallback
|
|
59
|
+
? this._beforeSetResultCallback(result)
|
|
60
|
+
: result;
|
|
61
|
+
this._resolve(this._result);
|
|
47
62
|
this._resolve = null;
|
|
48
63
|
}
|
|
49
64
|
}
|
package/lib/lifecycle.js
CHANGED
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
const rclnodejs = require('bindings')('rclnodejs');
|
|
18
18
|
const LifecyclePublisher = require('./lifecycle_publisher.js');
|
|
19
19
|
const loader = require('./interface_loader.js');
|
|
20
|
-
const
|
|
20
|
+
const Context = require('./context.js');
|
|
21
21
|
const Node = require('./node.js');
|
|
22
|
+
const NodeOptions = require('./node_options.js');
|
|
23
|
+
const Service = require('./service.js');
|
|
22
24
|
|
|
23
25
|
const SHUTDOWN_TRANSITION_LABEL =
|
|
24
26
|
rclnodejs.getLifecycleShutdownTransitionLabel();
|
|
@@ -263,25 +265,42 @@ class CallbackReturnValue {
|
|
|
263
265
|
*/
|
|
264
266
|
|
|
265
267
|
class LifecycleNode extends Node {
|
|
268
|
+
/**
|
|
269
|
+
* Create a managed Node that implements a well-defined life-cycle state
|
|
270
|
+
* model using the {@link https://github.com/ros2/rcl/tree/master/rcl_lifecycle|ros2 client library (rcl) lifecyle api}.
|
|
271
|
+
* @param {string} nodeName - The name used to register in ROS.
|
|
272
|
+
* @param {string} [namespace=''] - The namespace used in ROS.
|
|
273
|
+
* @param {Context} [context=Context.defaultContext()] - The context to create the node in.
|
|
274
|
+
* @param {NodeOptions} [options=NodeOptions.defaultOptions] - The options to configure the new node behavior.
|
|
275
|
+
* @param {boolean} [enableCommunicationsInterface=true] - Enable lifecycle service interfaces, e.g., GetState.
|
|
276
|
+
* @throws {Error} If the given context is not registered.
|
|
277
|
+
*/
|
|
266
278
|
constructor(
|
|
267
279
|
nodeName,
|
|
268
280
|
namespace = '',
|
|
269
281
|
context = Context.defaultContext(),
|
|
270
|
-
options = NodeOptions.defaultOptions
|
|
282
|
+
options = NodeOptions.defaultOptions,
|
|
283
|
+
enableCommunicationInterface = true
|
|
271
284
|
) {
|
|
272
285
|
super(nodeName, namespace, context, options);
|
|
273
|
-
this.init();
|
|
286
|
+
this.init(enableCommunicationInterface);
|
|
274
287
|
}
|
|
275
288
|
|
|
276
|
-
init() {
|
|
289
|
+
init(enableCommunicationInterface) {
|
|
277
290
|
// initialize native handle to rcl_lifecycle_state_machine
|
|
278
291
|
this._stateMachineHandle = rclnodejs.createLifecycleStateMachine(
|
|
279
|
-
this.handle
|
|
292
|
+
this.handle,
|
|
293
|
+
enableCommunicationInterface
|
|
280
294
|
);
|
|
281
295
|
|
|
282
296
|
// initialize Map<transitionId,TransitionCallback>
|
|
283
297
|
this._callbackMap = new Map();
|
|
284
298
|
|
|
299
|
+
if (!enableCommunicationInterface) {
|
|
300
|
+
// do not create lifecycle services
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
|
|
285
304
|
// Setup and register the 4 native rcl lifecycle services thar are
|
|
286
305
|
// part of _stateMachineHandle.
|
|
287
306
|
let srvHandleObj = rclnodejs.getLifecycleSrvNameAndHandle(
|
package/lib/node.js
CHANGED
|
@@ -45,10 +45,18 @@ const PARAMETER_EVENT_TOPIC = 'parameter_events';
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* @class - Class representing a Node in ROS
|
|
48
|
-
* @hideconstructor
|
|
49
48
|
*/
|
|
50
49
|
|
|
51
50
|
class Node extends rclnodejs.ShadowNode {
|
|
51
|
+
/**
|
|
52
|
+
* Create a ROS2Node.
|
|
53
|
+
* model using the {@link https://github.com/ros2/rcl/tree/master/rcl_lifecycle|ros2 client library (rcl) lifecyle api}.
|
|
54
|
+
* @param {string} nodeName - The name used to register in ROS.
|
|
55
|
+
* @param {string} [namespace=''] - The namespace used in ROS.
|
|
56
|
+
* @param {Context} [context=Context.defaultContext()] - The context to create the node in.
|
|
57
|
+
* @param {NodeOptions} [options=NodeOptions.defaultOptions] - The options to configure the new node behavior.
|
|
58
|
+
* @throws {Error} If the given context is not registered.
|
|
59
|
+
*/
|
|
52
60
|
constructor(
|
|
53
61
|
nodeName,
|
|
54
62
|
namespace = '',
|
|
@@ -910,7 +918,7 @@ class Node extends rclnodejs.ShadowNode {
|
|
|
910
918
|
* @param {string} nodeName - The name of the node.
|
|
911
919
|
* @param {string} namespace - The name of the namespace.
|
|
912
920
|
* @param {boolean} noDemangle - If true topic names and types returned will not be demangled, default: false.
|
|
913
|
-
* @return {
|
|
921
|
+
* @return {Array<{name: string, types: Array<string>}>} - An array of the names and types.
|
|
914
922
|
*/
|
|
915
923
|
getPublisherNamesAndTypesByNode(nodeName, namespace, noDemangle = false) {
|
|
916
924
|
return rclnodejs.getPublisherNamesAndTypesByNode(
|
|
@@ -926,7 +934,7 @@ class Node extends rclnodejs.ShadowNode {
|
|
|
926
934
|
* @param {string} nodeName - The name of the node.
|
|
927
935
|
* @param {string} namespace - The name of the namespace.
|
|
928
936
|
* @param {boolean} noDemangle - If true topic names and types returned will not be demangled, default: false.
|
|
929
|
-
* @return {
|
|
937
|
+
* @return {Array<{name: string, types: Array<string>}>} - An array of the names and types.
|
|
930
938
|
*/
|
|
931
939
|
getSubscriptionNamesAndTypesByNode(nodeName, namespace, noDemangle = false) {
|
|
932
940
|
return rclnodejs.getSubscriptionNamesAndTypesByNode(
|
|
@@ -941,7 +949,7 @@ class Node extends rclnodejs.ShadowNode {
|
|
|
941
949
|
* Get the list of service topics discovered by the provided node for the remote node name.
|
|
942
950
|
* @param {string} nodeName - The name of the node.
|
|
943
951
|
* @param {string} namespace - The name of the namespace.
|
|
944
|
-
* @return {
|
|
952
|
+
* @return {Array<{name: string, types: Array<string>}>} - An array of the names and types.
|
|
945
953
|
*/
|
|
946
954
|
getServiceNamesAndTypesByNode(nodeName, namespace) {
|
|
947
955
|
return rclnodejs.getServiceNamesAndTypesByNode(
|
|
@@ -954,7 +962,7 @@ class Node extends rclnodejs.ShadowNode {
|
|
|
954
962
|
/**
|
|
955
963
|
* Get the list of topics discovered by the provided node.
|
|
956
964
|
* @param {boolean} noDemangle - If true topic names and types returned will not be demangled, default: false.
|
|
957
|
-
* @return {
|
|
965
|
+
* @return {Array<{name: string, types: Array<string>}>} - An array of the names and types.
|
|
958
966
|
*/
|
|
959
967
|
getTopicNamesAndTypes(noDemangle = false) {
|
|
960
968
|
return rclnodejs.getTopicNamesAndTypes(this.handle, noDemangle);
|
|
@@ -962,7 +970,7 @@ class Node extends rclnodejs.ShadowNode {
|
|
|
962
970
|
|
|
963
971
|
/**
|
|
964
972
|
* Get the list of services discovered by the provided node.
|
|
965
|
-
* @return {
|
|
973
|
+
* @return {Array<{name: string, types: Array<string>}>} - An array of the names and types.
|
|
966
974
|
*/
|
|
967
975
|
getServiceNamesAndTypes() {
|
|
968
976
|
return rclnodejs.getServiceNamesAndTypes(this.handle);
|
|
@@ -970,7 +978,7 @@ class Node extends rclnodejs.ShadowNode {
|
|
|
970
978
|
|
|
971
979
|
/**
|
|
972
980
|
* Get the list of nodes discovered by the provided node.
|
|
973
|
-
* @return {
|
|
981
|
+
* @return {Array<string>} - An array of the names.
|
|
974
982
|
*/
|
|
975
983
|
getNodeNames() {
|
|
976
984
|
return this.getNodeNamesAndNamespaces().map((item) => item.name);
|
|
@@ -978,7 +986,7 @@ class Node extends rclnodejs.ShadowNode {
|
|
|
978
986
|
|
|
979
987
|
/**
|
|
980
988
|
* Get the list of nodes and their namespaces discovered by the provided node.
|
|
981
|
-
* @return {
|
|
989
|
+
* @return {Array<{name: string, namespace: string}>} An array of the names and namespaces.
|
|
982
990
|
*/
|
|
983
991
|
getNodeNamesAndNamespaces() {
|
|
984
992
|
return rclnodejs.getNodeNames(this.handle);
|
|
@@ -1020,7 +1028,7 @@ class Node extends rclnodejs.ShadowNode {
|
|
|
1020
1028
|
* Get the list of parameter-overrides found on the commandline and
|
|
1021
1029
|
* in the NodeOptions.parameter_overrides property.
|
|
1022
1030
|
*
|
|
1023
|
-
* @return {
|
|
1031
|
+
* @return {Array<Parameter>} - An array of Parameters.
|
|
1024
1032
|
*/
|
|
1025
1033
|
getParameterOverrides() {
|
|
1026
1034
|
return Array.from(this._parameterOverrides.values());
|
|
@@ -1234,7 +1242,7 @@ class Node extends rclnodejs.ShadowNode {
|
|
|
1234
1242
|
/**
|
|
1235
1243
|
* Get the names of all declared parameters.
|
|
1236
1244
|
*
|
|
1237
|
-
* @return {string
|
|
1245
|
+
* @return {Array<string>} - The declared parameter names or empty array if
|
|
1238
1246
|
* no parameters have been declared.
|
|
1239
1247
|
*/
|
|
1240
1248
|
getParameterNames() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rclnodejs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "ROS2.0 JavaScript client with Node.js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -43,35 +43,37 @@
|
|
|
43
43
|
"clang-format": "^1.4.0",
|
|
44
44
|
"commander": "^6.0.0",
|
|
45
45
|
"deep-equal": "^1.1.1",
|
|
46
|
-
"dtslint": "^4.
|
|
46
|
+
"dtslint": "^4.2.1",
|
|
47
47
|
"eslint": "^7.5.0",
|
|
48
48
|
"eslint-config-prettier": "^6.11.0",
|
|
49
49
|
"eslint-plugin-prettier": "^3.1.4",
|
|
50
50
|
"husky": "^4.2.5",
|
|
51
|
+
"jsdoc": "^3.6.7",
|
|
51
52
|
"lint-staged": "^10.2.11",
|
|
52
53
|
"mocha": "^8.0.1",
|
|
53
54
|
"prettier": "^2.0.5",
|
|
55
|
+
"rimraf": "^3.0.2",
|
|
54
56
|
"sinon": "^9.0.2",
|
|
55
57
|
"tree-kill": "^1.2.2",
|
|
56
58
|
"typescript": "^4.0.3"
|
|
57
59
|
},
|
|
58
60
|
"dependencies": {
|
|
61
|
+
"@rclnodejs/ref-array-di": "^1.2.2",
|
|
62
|
+
"@rclnodejs/ref-napi": "^4.0.0",
|
|
63
|
+
"@rclnodejs/ref-struct-di": "^1.1.1",
|
|
64
|
+
"array.prototype.flat": "^1.2.4",
|
|
59
65
|
"bindings": "^1.5.0",
|
|
60
66
|
"compare-versions": "^3.6.0",
|
|
61
67
|
"debug": "^4.1.1",
|
|
62
68
|
"dot": "^1.1.3",
|
|
63
|
-
"fs-extra": "^
|
|
69
|
+
"fs-extra": "^10.0.0",
|
|
70
|
+
"int64-napi": "^1.0.2",
|
|
64
71
|
"is-close": "^1.3.3",
|
|
65
72
|
"mkdirp": "^1.0.4",
|
|
66
73
|
"mz": "^2.7.0",
|
|
67
74
|
"nan": "^2.14.2",
|
|
68
|
-
"ref-napi": "^3.0.0",
|
|
69
|
-
"ref-array-di": "^1.2.2",
|
|
70
|
-
"ref-struct-di": "^1.1.1",
|
|
71
|
-
"walk": "^2.3.14",
|
|
72
75
|
"uuid": "^8.2.0",
|
|
73
|
-
"
|
|
74
|
-
"array.prototype.flat": "^1.2.4"
|
|
76
|
+
"walk": "^2.3.14"
|
|
75
77
|
},
|
|
76
78
|
"husky": {
|
|
77
79
|
"hooks": {
|
|
@@ -87,6 +89,6 @@
|
|
|
87
89
|
]
|
|
88
90
|
},
|
|
89
91
|
"engines": {
|
|
90
|
-
"node": ">= 10.23.1 <
|
|
92
|
+
"node": ">= 10.23.1 <18.0.0"
|
|
91
93
|
}
|
|
92
94
|
}
|
|
@@ -24,7 +24,12 @@ let deallocator = {
|
|
|
24
24
|
);
|
|
25
25
|
},
|
|
26
26
|
freeStructMember(refObj, type, name) {
|
|
27
|
-
|
|
27
|
+
if (refObj.ref().length !== 0) {
|
|
28
|
+
rclnodejs.freeMemeoryAtOffset(
|
|
29
|
+
refObj.ref().hexAddress(),
|
|
30
|
+
type.fields[name].offset
|
|
31
|
+
);
|
|
32
|
+
}
|
|
28
33
|
},
|
|
29
34
|
};
|
|
30
35
|
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
'use strict';
|
|
16
16
|
|
|
17
|
-
const ref = require('ref-napi');
|
|
18
|
-
const StructType = require('ref-struct-di')(ref);
|
|
17
|
+
const ref = require('@rclnodejs/ref-napi');
|
|
18
|
+
const StructType = require('@rclnodejs/ref-struct-di')(ref);
|
|
19
19
|
const rclnodejs = require('bindings')('rclnodejs');
|
|
20
20
|
|
|
21
21
|
/* eslint-disable camelcase */
|
|
@@ -219,9 +219,9 @@ function extractMemberNames(fields) {
|
|
|
219
219
|
{{? usePlainTypedArray}}
|
|
220
220
|
const rclnodejs = require('bindings')('rclnodejs');
|
|
221
221
|
{{?}}
|
|
222
|
-
const ref = require('ref-napi');
|
|
223
|
-
const StructType = require('ref-struct-di')(ref);
|
|
224
|
-
const ArrayType = require('ref-array-di')(ref);
|
|
222
|
+
const ref = require('@rclnodejs/ref-napi');
|
|
223
|
+
const StructType = require('@rclnodejs/ref-struct-di')(ref);
|
|
224
|
+
const ArrayType = require('@rclnodejs/ref-array-di')(ref);
|
|
225
225
|
const primitiveTypes = require('../../rosidl_gen/primitive_types.js');
|
|
226
226
|
const deallocator = require('../../rosidl_gen/deallocator.js');
|
|
227
227
|
const translator = require('../../rosidl_gen/message_translator.js');
|
|
@@ -750,7 +750,9 @@ class {{=arrayWrapper}} {
|
|
|
750
750
|
{{? usePlainTypedArray}}
|
|
751
751
|
const byteLen = refObject.size * ref.types.{{=currentTypedArrayElementType}}.size;
|
|
752
752
|
// An ArrayBuffer object that doesn't hold the ownership of the address
|
|
753
|
-
const arrayBuffer =
|
|
753
|
+
const arrayBuffer = refObject.data.length !== 0 ?
|
|
754
|
+
rclnodejs.createArrayBufferFromAddress(refObject.data.hexAddress(), byteLen) :
|
|
755
|
+
Buffer.alloc(0);
|
|
754
756
|
this._wrappers = new {{=currentTypedArray}}(arrayBuffer);
|
|
755
757
|
{{?? true}}
|
|
756
758
|
let refObjectArray = this._refObject.data;
|
package/scripts/build.sh
CHANGED
package/scripts/cpplint.js
CHANGED
|
@@ -20,7 +20,7 @@ const cmd = 'wget -nc ';
|
|
|
20
20
|
const cpplintUrl =
|
|
21
21
|
'https://raw.githubusercontent.com/google/styleguide' +
|
|
22
22
|
'/gh-pages/cpplint/cpplint.py';
|
|
23
|
-
const root = `${__dirname}/../src
|
|
23
|
+
const root = `${__dirname}/../src`;
|
|
24
24
|
const args = `--extensions=cpp,h,hpp,cc ${root}/*`;
|
|
25
25
|
|
|
26
26
|
console.log('Downloading the cpplint...');
|
package/scripts/npmjs-readme.md
CHANGED
|
@@ -18,7 +18,7 @@ rclnodejs.init().then(() => {
|
|
|
18
18
|
|
|
19
19
|
**Node.js**
|
|
20
20
|
|
|
21
|
-
- [Node.js](https://nodejs.org/en/) version between
|
|
21
|
+
- [Node.js](https://nodejs.org/en/) version between 10.23 - 16.x.
|
|
22
22
|
|
|
23
23
|
**ROS 2 SDK**
|
|
24
24
|
|
|
@@ -43,11 +43,10 @@ npm i rclnodejs@x.y.z
|
|
|
43
43
|
|
|
44
44
|
#### RCLNODEJS - ROS 2 Version Compatibility
|
|
45
45
|
|
|
46
|
-
| RCLNODEJS Version |
|
|
47
|
-
| :-------------------------------------------------------------------------------------------------------------------------------------: |
|
|
48
|
-
| [0.
|
|
49
|
-
|
|
|
50
|
-
| [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) |
|
|
46
|
+
| RCLNODEJS Version | Compatible ROS 2 Release |
|
|
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) |
|
|
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) |
|
|
51
50
|
|
|
52
51
|
## Documentation
|
|
53
52
|
|
package/scripts/ros_distro.js
CHANGED
|
@@ -5,9 +5,11 @@ switch (process.env.ROS_DISTRO) {
|
|
|
5
5
|
console.log('1911');
|
|
6
6
|
process.exit(0);
|
|
7
7
|
case 'foxy':
|
|
8
|
+
console.log('2006');
|
|
9
|
+
process.exit(0);
|
|
8
10
|
case 'galactic':
|
|
9
11
|
case 'rolling':
|
|
10
|
-
console.log('
|
|
12
|
+
console.log('2105');
|
|
11
13
|
process.exit(0);
|
|
12
14
|
case undefined:
|
|
13
15
|
console.error(
|
package/src/executor.hpp
CHANGED
package/src/rcl_bindings.cpp
CHANGED
|
@@ -39,6 +39,9 @@
|
|
|
39
39
|
#include <memory>
|
|
40
40
|
#include <string>
|
|
41
41
|
#include <vector>
|
|
42
|
+
#if NODE_MAJOR_VERSION > 12
|
|
43
|
+
#include <utility>
|
|
44
|
+
#endif
|
|
42
45
|
|
|
43
46
|
#include "handle_manager.hpp"
|
|
44
47
|
#include "macros.hpp"
|
|
@@ -1292,18 +1295,14 @@ inline char* GetBufAddr(v8::Local<v8::Value> buf) {
|
|
|
1292
1295
|
}
|
|
1293
1296
|
|
|
1294
1297
|
NAN_METHOD(FreeMemeoryAtOffset) {
|
|
1295
|
-
v8::Local<v8::
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1298
|
+
v8::Local<v8::Context> currentContent = Nan::GetCurrentContext();
|
|
1299
|
+
std::string addr_str(
|
|
1300
|
+
*Nan::Utf8String(info[0]->ToString(currentContent).ToLocalChecked()));
|
|
1301
|
+
int64_t result = std::stoull(addr_str, 0, 16);
|
|
1302
|
+
char* addr = reinterpret_cast<char*>(result);
|
|
1300
1303
|
int64_t offset =
|
|
1301
1304
|
info[1]->IsNumber() ? Nan::To<int64_t>(info[1]).FromJust() : 0;
|
|
1302
|
-
auto ptr =
|
|
1303
|
-
|
|
1304
|
-
if (ptr == nullptr) {
|
|
1305
|
-
return Nan::ThrowError("Cannot read from NULL pointer");
|
|
1306
|
-
}
|
|
1305
|
+
auto ptr = addr + offset;
|
|
1307
1306
|
|
|
1308
1307
|
char* val = *reinterpret_cast<char**>(ptr);
|
|
1309
1308
|
free(val);
|
|
@@ -1311,15 +1310,27 @@ NAN_METHOD(FreeMemeoryAtOffset) {
|
|
|
1311
1310
|
}
|
|
1312
1311
|
|
|
1313
1312
|
NAN_METHOD(CreateArrayBufferFromAddress) {
|
|
1314
|
-
|
|
1313
|
+
v8::Local<v8::Context> currentContent = Nan::GetCurrentContext();
|
|
1314
|
+
std::string addr_str(
|
|
1315
|
+
*Nan::Utf8String(info[0]->ToString(currentContent).ToLocalChecked()));
|
|
1316
|
+
int64_t result = std::stoull(addr_str, 0, 16);
|
|
1317
|
+
char* addr = reinterpret_cast<char*>(result);
|
|
1315
1318
|
int32_t length = Nan::To<int32_t>(info[1]).FromJust();
|
|
1316
1319
|
|
|
1317
1320
|
// We will create an ArrayBuffer with mode of
|
|
1318
1321
|
// ArrayBufferCreationMode::kInternalized and copy data starting from |addr|,
|
|
1319
1322
|
// thus the memory block will be collected by the garbage collector.
|
|
1323
|
+
#if NODE_MAJOR_VERSION <= 12
|
|
1320
1324
|
v8::Local<v8::ArrayBuffer> array_buffer =
|
|
1321
1325
|
v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), addr, length,
|
|
1322
1326
|
v8::ArrayBufferCreationMode::kInternalized);
|
|
1327
|
+
#else
|
|
1328
|
+
std::unique_ptr<v8::BackingStore> backing =
|
|
1329
|
+
v8::ArrayBuffer::NewBackingStore(v8::Isolate::GetCurrent(), length);
|
|
1330
|
+
memcpy(backing->Data(), addr, length);
|
|
1331
|
+
auto array_buffer =
|
|
1332
|
+
v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), std::move(backing));
|
|
1333
|
+
#endif
|
|
1323
1334
|
|
|
1324
1335
|
info.GetReturnValue().Set(array_buffer);
|
|
1325
1336
|
}
|
|
@@ -62,35 +62,56 @@ NAN_METHOD(CreateLifecycleStateMachine) {
|
|
|
62
62
|
|
|
63
63
|
const rosidl_message_type_support_t* pn =
|
|
64
64
|
GetMessageTypeSupport("lifecycle_msgs", "msg", "TransitionEvent");
|
|
65
|
-
const rosidl_service_type_support_t* cs =
|
|
66
|
-
GetServiceTypeSupport("lifecycle_msgs", "ChangeState");
|
|
67
|
-
const rosidl_service_type_support_t* gs =
|
|
68
|
-
GetServiceTypeSupport("lifecycle_msgs", "GetState");
|
|
69
65
|
const rosidl_service_type_support_t* gas =
|
|
70
66
|
GetServiceTypeSupport("lifecycle_msgs", "GetAvailableStates");
|
|
71
67
|
const rosidl_service_type_support_t* gat =
|
|
72
68
|
GetServiceTypeSupport("lifecycle_msgs", "GetAvailableTransitions");
|
|
73
69
|
const rosidl_service_type_support_t* gtg =
|
|
74
70
|
GetServiceTypeSupport("lifecycle_msgs", "GetAvailableTransitions");
|
|
71
|
+
const rosidl_service_type_support_t* cs =
|
|
72
|
+
GetServiceTypeSupport("lifecycle_msgs", "ChangeState");
|
|
73
|
+
const rosidl_service_type_support_t* gs =
|
|
74
|
+
GetServiceTypeSupport("lifecycle_msgs", "GetState");
|
|
75
75
|
|
|
76
|
+
#if ROS_VERSION >= 2105
|
|
76
77
|
rcl_lifecycle_state_machine_options_t options =
|
|
77
78
|
rcl_lifecycle_get_default_state_machine_options();
|
|
79
|
+
options.enable_com_interface = Nan::To<bool>(info[1]).FromJust();
|
|
80
|
+
|
|
81
|
+
THROW_ERROR_IF_NOT_EQUAL(
|
|
82
|
+
RCL_RET_OK,
|
|
83
|
+
rcl_lifecycle_state_machine_init(state_machine, node, pn, cs, gs, gas,
|
|
84
|
+
gat, gtg, &options),
|
|
85
|
+
rcl_get_error_string().str);
|
|
86
|
+
|
|
87
|
+
auto js_obj =
|
|
88
|
+
RclHandle::NewInstance(state_machine, node_handle, [node](void* ptr) {
|
|
89
|
+
rcl_lifecycle_state_machine_t* state_machine =
|
|
90
|
+
reinterpret_cast<rcl_lifecycle_state_machine_t*>(ptr);
|
|
91
|
+
rcl_ret_t ret = rcl_lifecycle_state_machine_fini(state_machine, node);
|
|
92
|
+
free(ptr);
|
|
93
|
+
THROW_ERROR_IF_NOT_EQUAL(RCL_RET_OK, ret, rcl_get_error_string().str);
|
|
94
|
+
});
|
|
95
|
+
#else
|
|
96
|
+
const rcl_node_options_t* node_options =
|
|
97
|
+
reinterpret_cast<const rcl_node_options_t*>(rcl_node_get_options(node));
|
|
78
98
|
|
|
79
99
|
THROW_ERROR_IF_NOT_EQUAL(RCL_RET_OK,
|
|
80
100
|
rcl_lifecycle_state_machine_init(
|
|
81
|
-
state_machine, node,
|
|
82
|
-
|
|
83
|
-
&options),
|
|
101
|
+
state_machine, node, pn, cs, gs, gas, gat, gtg,
|
|
102
|
+
true, &node_options->allocator),
|
|
84
103
|
rcl_get_error_string().str);
|
|
85
104
|
|
|
86
105
|
auto js_obj = RclHandle::NewInstance(
|
|
87
|
-
state_machine, node_handle, [node](void* ptr) {
|
|
106
|
+
state_machine, node_handle, [node, node_options](void* ptr) {
|
|
88
107
|
rcl_lifecycle_state_machine_t* state_machine =
|
|
89
108
|
reinterpret_cast<rcl_lifecycle_state_machine_t*>(ptr);
|
|
90
|
-
rcl_ret_t ret = rcl_lifecycle_state_machine_fini(
|
|
109
|
+
rcl_ret_t ret = rcl_lifecycle_state_machine_fini(
|
|
110
|
+
state_machine, node, &node_options->allocator);
|
|
91
111
|
free(ptr);
|
|
92
112
|
THROW_ERROR_IF_NOT_EQUAL(RCL_RET_OK, ret, rcl_get_error_string().str);
|
|
93
113
|
});
|
|
114
|
+
#endif
|
|
94
115
|
|
|
95
116
|
info.GetReturnValue().Set(js_obj);
|
|
96
117
|
}
|
package/types/action_client.d.ts
CHANGED
|
@@ -26,13 +26,50 @@ declare module 'rclnodejs' {
|
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Gets if the goal response was accepted.
|
|
29
|
+
* @deprecated Use isAccepted()
|
|
29
30
|
*/
|
|
30
31
|
get accepted(): boolean;
|
|
31
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Determine if goal is currently executing
|
|
35
|
+
* @returns {bool} - True if goal is executing; otherwise return false.
|
|
36
|
+
*/
|
|
37
|
+
isAccepted(): boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Determine if goal is currently executing
|
|
41
|
+
* @returns {bool} - True if goal is executing; otherwise return false.
|
|
42
|
+
*/
|
|
43
|
+
isExecuting(): boolean;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Determine if goal is in the process of canceling.
|
|
47
|
+
* @returns True if goal is canceling; otherwise return false.
|
|
48
|
+
*/
|
|
49
|
+
isCanceling(): boolean;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Determine if goal completed successfullly.
|
|
53
|
+
* @returns True if goal completed successfully; otherwise return false.
|
|
54
|
+
*/
|
|
55
|
+
isSucceeded(): boolean;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Determine if goal has been canceled.
|
|
59
|
+
* @returns True if goal has been aborted; otherwise return false.
|
|
60
|
+
*/
|
|
61
|
+
isCanceled(): boolean;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Determine if goal has been aborted.
|
|
65
|
+
* @returns True if goal was aborted; otherwise return false.
|
|
66
|
+
*/
|
|
67
|
+
isAborted(): boolean;
|
|
68
|
+
|
|
32
69
|
/**
|
|
33
70
|
* Gets the goal status.
|
|
34
71
|
*/
|
|
35
|
-
get status():
|
|
72
|
+
get status(): number;
|
|
36
73
|
|
|
37
74
|
/**
|
|
38
75
|
* Send a cancel request for the goal.
|
package/types/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ declare module 'rclnodejs' {
|
|
|
13
13
|
* @param context - The context, default is Context.defaultContext().
|
|
14
14
|
* @param options - The node options, default is NodeOptions.defaultOptions.
|
|
15
15
|
* @returns The new Node instance.
|
|
16
|
+
* @deprecated since 0.18.0, Use new Node constructor.
|
|
16
17
|
*/
|
|
17
18
|
function createNode(
|
|
18
19
|
nodeName: string,
|
|
@@ -28,13 +29,16 @@ declare module 'rclnodejs' {
|
|
|
28
29
|
* @param namespace - The namespace used in ROS, default is an empty string.
|
|
29
30
|
* @param context - The context, default is Context.defaultContext().
|
|
30
31
|
* @param options - The options to configure the new node behavior.
|
|
32
|
+
* @params enableCommunicationInterface: boolean - Enable lifecycle service interfaces, e.g., GetState.
|
|
31
33
|
* @returns The instance of LifecycleNode.
|
|
34
|
+
* @deprecated since 0.18.0, Use new LifecycleNode constructor.
|
|
32
35
|
*/
|
|
33
36
|
function createLifecycleNode(
|
|
34
37
|
nodeName: string,
|
|
35
38
|
namespace?: string,
|
|
36
39
|
context?: Context,
|
|
37
|
-
options?: NodeOptions
|
|
40
|
+
options?: NodeOptions,
|
|
41
|
+
enableCommunicationInterface?: boolean
|
|
38
42
|
): lifecycle.LifecycleNode;
|
|
39
43
|
|
|
40
44
|
/**
|
package/types/interfaces.d.ts
CHANGED
|
@@ -849,17 +849,6 @@ declare module 'rclnodejs' {
|
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
851
|
|
|
852
|
-
namespace libstatistics_collector {
|
|
853
|
-
namespace msg {
|
|
854
|
-
export interface DummyMessage {
|
|
855
|
-
header: std_msgs.msg.Header;
|
|
856
|
-
}
|
|
857
|
-
export interface DummyMessageConstructor {
|
|
858
|
-
new(other?: DummyMessage): DummyMessage;
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
|
|
863
852
|
namespace lifecycle_msgs {
|
|
864
853
|
namespace msg {
|
|
865
854
|
export interface State {
|
|
@@ -1171,75 +1160,6 @@ declare module 'rclnodejs' {
|
|
|
1171
1160
|
}
|
|
1172
1161
|
}
|
|
1173
1162
|
|
|
1174
|
-
namespace move_base_msgs {
|
|
1175
|
-
namespace action {
|
|
1176
|
-
export interface MoveBaseConstructor {
|
|
1177
|
-
readonly Goal: MoveBase_GoalConstructor;
|
|
1178
|
-
readonly Result: MoveBase_ResultConstructor;
|
|
1179
|
-
readonly Feedback: MoveBase_FeedbackConstructor;
|
|
1180
|
-
}
|
|
1181
|
-
export interface MoveBase_Feedback {
|
|
1182
|
-
base_position: geometry_msgs.msg.PoseStamped;
|
|
1183
|
-
}
|
|
1184
|
-
export interface MoveBase_FeedbackConstructor {
|
|
1185
|
-
new(other?: MoveBase_Feedback): MoveBase_Feedback;
|
|
1186
|
-
}
|
|
1187
|
-
export interface MoveBase_FeedbackMessage {
|
|
1188
|
-
goal_id: unique_identifier_msgs.msg.UUID;
|
|
1189
|
-
feedback: move_base_msgs.action.MoveBase_Feedback;
|
|
1190
|
-
}
|
|
1191
|
-
export interface MoveBase_FeedbackMessageConstructor {
|
|
1192
|
-
new(other?: MoveBase_FeedbackMessage): MoveBase_FeedbackMessage;
|
|
1193
|
-
}
|
|
1194
|
-
export interface MoveBase_GetResultConstructor extends ROSService {
|
|
1195
|
-
readonly Request: MoveBase_GetResult_RequestConstructor;
|
|
1196
|
-
readonly Response: MoveBase_GetResult_ResponseConstructor;
|
|
1197
|
-
}
|
|
1198
|
-
export interface MoveBase_GetResult_Request {
|
|
1199
|
-
goal_id: unique_identifier_msgs.msg.UUID;
|
|
1200
|
-
}
|
|
1201
|
-
export interface MoveBase_GetResult_RequestConstructor {
|
|
1202
|
-
new(other?: MoveBase_GetResult_Request): MoveBase_GetResult_Request;
|
|
1203
|
-
}
|
|
1204
|
-
export interface MoveBase_GetResult_Response {
|
|
1205
|
-
status: number;
|
|
1206
|
-
result: move_base_msgs.action.MoveBase_Result;
|
|
1207
|
-
}
|
|
1208
|
-
export interface MoveBase_GetResult_ResponseConstructor {
|
|
1209
|
-
new(other?: MoveBase_GetResult_Response): MoveBase_GetResult_Response;
|
|
1210
|
-
}
|
|
1211
|
-
export interface MoveBase_Goal {
|
|
1212
|
-
target_pose: geometry_msgs.msg.PoseStamped;
|
|
1213
|
-
}
|
|
1214
|
-
export interface MoveBase_GoalConstructor {
|
|
1215
|
-
new(other?: MoveBase_Goal): MoveBase_Goal;
|
|
1216
|
-
}
|
|
1217
|
-
export interface MoveBase_Result {
|
|
1218
|
-
}
|
|
1219
|
-
export interface MoveBase_ResultConstructor {
|
|
1220
|
-
new(other?: MoveBase_Result): MoveBase_Result;
|
|
1221
|
-
}
|
|
1222
|
-
export interface MoveBase_SendGoalConstructor extends ROSService {
|
|
1223
|
-
readonly Request: MoveBase_SendGoal_RequestConstructor;
|
|
1224
|
-
readonly Response: MoveBase_SendGoal_ResponseConstructor;
|
|
1225
|
-
}
|
|
1226
|
-
export interface MoveBase_SendGoal_Request {
|
|
1227
|
-
goal_id: unique_identifier_msgs.msg.UUID;
|
|
1228
|
-
goal: move_base_msgs.action.MoveBase_Goal;
|
|
1229
|
-
}
|
|
1230
|
-
export interface MoveBase_SendGoal_RequestConstructor {
|
|
1231
|
-
new(other?: MoveBase_SendGoal_Request): MoveBase_SendGoal_Request;
|
|
1232
|
-
}
|
|
1233
|
-
export interface MoveBase_SendGoal_Response {
|
|
1234
|
-
accepted: boolean;
|
|
1235
|
-
stamp: builtin_interfaces.msg.Time;
|
|
1236
|
-
}
|
|
1237
|
-
export interface MoveBase_SendGoal_ResponseConstructor {
|
|
1238
|
-
new(other?: MoveBase_SendGoal_Response): MoveBase_SendGoal_Response;
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
1163
|
namespace nav_msgs {
|
|
1244
1164
|
namespace msg {
|
|
1245
1165
|
export interface GridCells {
|
|
@@ -3800,7 +3720,6 @@ declare module 'rclnodejs' {
|
|
|
3800
3720
|
'geometry_msgs/msg/Vector3Stamped': geometry_msgs.msg.Vector3Stamped,
|
|
3801
3721
|
'geometry_msgs/msg/Wrench': geometry_msgs.msg.Wrench,
|
|
3802
3722
|
'geometry_msgs/msg/WrenchStamped': geometry_msgs.msg.WrenchStamped,
|
|
3803
|
-
'libstatistics_collector/msg/DummyMessage': libstatistics_collector.msg.DummyMessage,
|
|
3804
3723
|
'lifecycle_msgs/msg/State': lifecycle_msgs.msg.State,
|
|
3805
3724
|
'lifecycle_msgs/msg/Transition': lifecycle_msgs.msg.Transition,
|
|
3806
3725
|
'lifecycle_msgs/msg/TransitionDescription': lifecycle_msgs.msg.TransitionDescription,
|
|
@@ -3831,14 +3750,6 @@ declare module 'rclnodejs' {
|
|
|
3831
3750
|
'map_msgs/srv/SaveMap_Response': map_msgs.srv.SaveMap_Response,
|
|
3832
3751
|
'map_msgs/srv/SetMapProjections_Request': map_msgs.srv.SetMapProjections_Request,
|
|
3833
3752
|
'map_msgs/srv/SetMapProjections_Response': map_msgs.srv.SetMapProjections_Response,
|
|
3834
|
-
'move_base_msgs/action/MoveBase_Feedback': move_base_msgs.action.MoveBase_Feedback,
|
|
3835
|
-
'move_base_msgs/action/MoveBase_FeedbackMessage': move_base_msgs.action.MoveBase_FeedbackMessage,
|
|
3836
|
-
'move_base_msgs/action/MoveBase_GetResult_Request': move_base_msgs.action.MoveBase_GetResult_Request,
|
|
3837
|
-
'move_base_msgs/action/MoveBase_GetResult_Response': move_base_msgs.action.MoveBase_GetResult_Response,
|
|
3838
|
-
'move_base_msgs/action/MoveBase_Goal': move_base_msgs.action.MoveBase_Goal,
|
|
3839
|
-
'move_base_msgs/action/MoveBase_Result': move_base_msgs.action.MoveBase_Result,
|
|
3840
|
-
'move_base_msgs/action/MoveBase_SendGoal_Request': move_base_msgs.action.MoveBase_SendGoal_Request,
|
|
3841
|
-
'move_base_msgs/action/MoveBase_SendGoal_Response': move_base_msgs.action.MoveBase_SendGoal_Response,
|
|
3842
3753
|
'nav_msgs/msg/GridCells': nav_msgs.msg.GridCells,
|
|
3843
3754
|
'nav_msgs/msg/MapMetaData': nav_msgs.msg.MapMetaData,
|
|
3844
3755
|
'nav_msgs/msg/OccupancyGrid': nav_msgs.msg.OccupancyGrid,
|
|
@@ -4186,7 +4097,6 @@ declare module 'rclnodejs' {
|
|
|
4186
4097
|
'geometry_msgs/msg/Vector3Stamped': geometry_msgs.msg.Vector3StampedConstructor,
|
|
4187
4098
|
'geometry_msgs/msg/Wrench': geometry_msgs.msg.WrenchConstructor,
|
|
4188
4099
|
'geometry_msgs/msg/WrenchStamped': geometry_msgs.msg.WrenchStampedConstructor,
|
|
4189
|
-
'libstatistics_collector/msg/DummyMessage': libstatistics_collector.msg.DummyMessageConstructor,
|
|
4190
4100
|
'lifecycle_msgs/msg/State': lifecycle_msgs.msg.StateConstructor,
|
|
4191
4101
|
'lifecycle_msgs/msg/Transition': lifecycle_msgs.msg.TransitionConstructor,
|
|
4192
4102
|
'lifecycle_msgs/msg/TransitionDescription': lifecycle_msgs.msg.TransitionDescriptionConstructor,
|
|
@@ -4217,14 +4127,6 @@ declare module 'rclnodejs' {
|
|
|
4217
4127
|
'map_msgs/srv/SaveMap_Response': map_msgs.srv.SaveMap_ResponseConstructor,
|
|
4218
4128
|
'map_msgs/srv/SetMapProjections_Request': map_msgs.srv.SetMapProjections_RequestConstructor,
|
|
4219
4129
|
'map_msgs/srv/SetMapProjections_Response': map_msgs.srv.SetMapProjections_ResponseConstructor,
|
|
4220
|
-
'move_base_msgs/action/MoveBase_Feedback': move_base_msgs.action.MoveBase_FeedbackConstructor,
|
|
4221
|
-
'move_base_msgs/action/MoveBase_FeedbackMessage': move_base_msgs.action.MoveBase_FeedbackMessageConstructor,
|
|
4222
|
-
'move_base_msgs/action/MoveBase_GetResult_Request': move_base_msgs.action.MoveBase_GetResult_RequestConstructor,
|
|
4223
|
-
'move_base_msgs/action/MoveBase_GetResult_Response': move_base_msgs.action.MoveBase_GetResult_ResponseConstructor,
|
|
4224
|
-
'move_base_msgs/action/MoveBase_Goal': move_base_msgs.action.MoveBase_GoalConstructor,
|
|
4225
|
-
'move_base_msgs/action/MoveBase_Result': move_base_msgs.action.MoveBase_ResultConstructor,
|
|
4226
|
-
'move_base_msgs/action/MoveBase_SendGoal_Request': move_base_msgs.action.MoveBase_SendGoal_RequestConstructor,
|
|
4227
|
-
'move_base_msgs/action/MoveBase_SendGoal_Response': move_base_msgs.action.MoveBase_SendGoal_ResponseConstructor,
|
|
4228
4130
|
'nav_msgs/msg/GridCells': nav_msgs.msg.GridCellsConstructor,
|
|
4229
4131
|
'nav_msgs/msg/MapMetaData': nav_msgs.msg.MapMetaDataConstructor,
|
|
4230
4132
|
'nav_msgs/msg/OccupancyGrid': nav_msgs.msg.OccupancyGridConstructor,
|
|
@@ -4527,7 +4429,6 @@ declare module 'rclnodejs' {
|
|
|
4527
4429
|
type ActionsMap = {
|
|
4528
4430
|
'action_tutorials_interfaces/action/Fibonacci': action_tutorials_interfaces.action.FibonacciConstructor,
|
|
4529
4431
|
'example_interfaces/action/Fibonacci': example_interfaces.action.FibonacciConstructor,
|
|
4530
|
-
'move_base_msgs/action/MoveBase': move_base_msgs.action.MoveBaseConstructor,
|
|
4531
4432
|
'rclnodejs_test_msgs/action/Fibonacci': rclnodejs_test_msgs.action.FibonacciConstructor,
|
|
4532
4433
|
'ros2cli_test_interfaces/action/ShortVariedMultiNested': ros2cli_test_interfaces.action.ShortVariedMultiNestedConstructor,
|
|
4533
4434
|
'test_msgs/action/Fibonacci': test_msgs.action.FibonacciConstructor,
|
package/types/lifecycle.d.ts
CHANGED
|
@@ -190,6 +190,23 @@ declare module 'rclnodejs' {
|
|
|
190
190
|
* registerOnError(cb)
|
|
191
191
|
*/
|
|
192
192
|
class LifecycleNode extends Node {
|
|
193
|
+
/**
|
|
194
|
+
* Create a node instance.
|
|
195
|
+
*
|
|
196
|
+
* @param nodeName - The name used to register in ROS.
|
|
197
|
+
* @param namespace - The namespace used in ROS, default is an empty string.
|
|
198
|
+
* @param context - The context, default is Context.defaultContext().
|
|
199
|
+
* @param options - The node options, default is NodeOptions.defaultOptions.
|
|
200
|
+
* @param enableCommunicationInterface - Enable lifecycle service interfaces, e.g., GetState.
|
|
201
|
+
*/
|
|
202
|
+
constructor(
|
|
203
|
+
nodeName: string,
|
|
204
|
+
namespace?: string,
|
|
205
|
+
context?: Context,
|
|
206
|
+
options?: NodeOptions,
|
|
207
|
+
enableCommunicationInterface?: boolean
|
|
208
|
+
);
|
|
209
|
+
|
|
193
210
|
/**
|
|
194
211
|
* Access the current lifecycle state.
|
|
195
212
|
* @returns The current state.
|