rclnodejs 0.28.1 → 0.29.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/README.md CHANGED
@@ -45,7 +45,7 @@ npm i rclnodejs@x.y.z
45
45
 
46
46
  | RCLNODEJS Version | Compatible ROS 2 LTS |
47
47
  | :------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------: |
48
- | latest version (currently [v0.28.1](https://github.com/RobotWebTools/rclnodejs/tree/0.28.1)) | [Humble](https://github.com/RobotWebTools/rclnodejs/tree/humble-hawksbill)<br>[Jazzy](https://github.com/RobotWebTools/rclnodejs/tree/jazzy) |
48
+ | latest version (currently [v0.29.0](https://github.com/RobotWebTools/rclnodejs/tree/0.29.0)) | [Humble](https://github.com/RobotWebTools/rclnodejs/tree/humble-hawksbill)<br>[Jazzy](https://github.com/RobotWebTools/rclnodejs/tree/jazzy) |
49
49
 
50
50
  ## Documentation
51
51
 
package/lib/node.js CHANGED
@@ -1273,6 +1273,26 @@ class Node extends rclnodejs.ShadowNode {
1273
1273
  return params;
1274
1274
  }
1275
1275
 
1276
+ /**
1277
+ * Get the types of given parameters.
1278
+ *
1279
+ * Return the types of given parameters.
1280
+ *
1281
+ * @param {string[]} [names] - The names of the declared parameters.
1282
+ * @return {Uint8Array} - The types.
1283
+ */
1284
+ getParameterTypes(names = []) {
1285
+ let types = [];
1286
+
1287
+ for (const name of names) {
1288
+ const descriptor = this._parameterDescriptors.get(name);
1289
+ if (descriptor) {
1290
+ types.push(descriptor.type);
1291
+ }
1292
+ }
1293
+ return types;
1294
+ }
1295
+
1276
1296
  /**
1277
1297
  * Get the names of all declared parameters.
1278
1298
  *
@@ -110,6 +110,16 @@ class ParameterService {
110
110
  }
111
111
  );
112
112
 
113
+ // Create GetParameterTypes service.
114
+ const getParameterTypesServiceName = nodeName + '/get_parameter_types';
115
+ this._node.createService(
116
+ 'rcl_interfaces/srv/GetParameterTypes',
117
+ getParameterTypesServiceName,
118
+ (request, response) => {
119
+ this._handleGetParameterTypes(request, response);
120
+ }
121
+ );
122
+
113
123
  // create SetParametersAtomically service
114
124
  const setParametersAtomicallyServiceName =
115
125
  nodeName + '/set_parameters_atomically';
@@ -266,6 +276,23 @@ class ParameterService {
266
276
  response.send(msg);
267
277
  }
268
278
 
279
+ /**
280
+ * Get a list of parameter types.
281
+ *
282
+ * request.names identifies the parameter types to get.
283
+ *
284
+ * @param {GetParameterTypes_Request} request - The client request.
285
+ * @param {GetParameterTypes_Response} response - The service response with
286
+ * Uint8Array.
287
+ * @return {undefined} -
288
+ */
289
+ _handleGetParameterTypes(request, response) {
290
+ const types = this._node.getParameterTypes(request.names);
291
+ const msg = response.template;
292
+ msg.types = types;
293
+ response.send(msg);
294
+ }
295
+
269
296
  /**
270
297
  * Update a list of parameters atomically.
271
298
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rclnodejs",
3
- "version": "0.28.1",
3
+ "version": "0.29.0",
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 LTS |
47
47
  | :------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------: |
48
- | latest version (currently [v0.28.1](https://github.com/RobotWebTools/rclnodejs/tree/0.28.1)) | [Humble](https://github.com/RobotWebTools/rclnodejs/tree/humble-hawksbill)<br>[Jazzy](https://github.com/RobotWebTools/rclnodejs/tree/jazzy) |
48
+ | latest version (currently [v0.29.0](https://github.com/RobotWebTools/rclnodejs/tree/0.29.0)) | [Humble](https://github.com/RobotWebTools/rclnodejs/tree/humble-hawksbill)<br>[Jazzy](https://github.com/RobotWebTools/rclnodejs/tree/jazzy) |
49
49
 
50
50
  ## Documentation
51
51
 
package/types/index.d.ts CHANGED
@@ -144,6 +144,13 @@ declare module 'rclnodejs' {
144
144
  type: T
145
145
  ): MessageType<T>;
146
146
 
147
+ /**
148
+ * Removes the default signal handler installed by rclnodejs. After calling this, rclnodejs
149
+ * will no longer clean itself up when a SIGINT is received, it is the application's
150
+ * responsibility to properly shut down all nodes and contexts.
151
+ */
152
+ function removeSignalHandlers(): void;
153
+
147
154
  /**
148
155
  * Get a list of action names and types for action clients associated with a node.
149
156
  * @param node - The node used for discovery.
package/types/node.d.ts CHANGED
@@ -324,7 +324,7 @@ declare module 'rclnodejs' {
324
324
  typeClass: T,
325
325
  topic: string,
326
326
  options: Options,
327
- callback: SubscriptionCallback<T>
327
+ callback: SubscriptionCallback<T> | SubscriptionWithRawMessageCallback
328
328
  ): Subscription;
329
329
 
330
330
  /**
@@ -13,7 +13,23 @@ declare module 'rclnodejs' {
13
13
  */
14
14
  type SubscriptionCallback<T extends TypeClass<MessageTypeClassName>> =
15
15
  // * @param message - The published message
16
- (message: MessageType<T> | Buffer) => void;
16
+ (message: MessageType<T>) => void;
17
+
18
+ /**
19
+ * A callback for receiving published raw messages.
20
+ *
21
+ * @param message - The published message.
22
+ *
23
+ * @remarks
24
+ * See {@link Node#createSubscription | Node.createSubscription}
25
+ * See {@link SubscriptionContentFilter}
26
+ * See {@link Node#createPublisher | Node.createPublisher}
27
+ * See {@link Publisher}
28
+ * See {@link Subscription}
29
+ */
30
+ type SubscriptionWithRawMessageCallback =
31
+ // * @param message - The published raw message
32
+ (message: Buffer) => void;
17
33
 
18
34
  /**
19
35
  * A ROS Subscription for published messages on a topic.