rclnodejs 1.2.0 → 1.3.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/types/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  /// <reference path="./base.d.ts" />
2
2
 
3
3
  declare module 'rclnodejs' {
4
+ type Class = new (...args: any[]) => any;
5
+
4
6
  /**
5
7
  * Create a node.
6
8
  *
@@ -11,6 +13,9 @@ declare module 'rclnodejs' {
11
13
  * @param namespace - The namespace used in ROS, default is an empty string.
12
14
  * @param context - The context, default is Context.defaultContext().
13
15
  * @param options - The node options, default is NodeOptions.defaultOptions.
16
+ * @param args - The arguments to be passed to the node, default is an empty array.
17
+ * @param useGlobalArguments - If true, the node will use global arguments, default is true.
18
+ * If false, the node will not use global arguments.
14
19
  * @returns The new Node instance.
15
20
  * @deprecated since 0.18.0, Use new Node constructor.
16
21
  */
@@ -18,7 +23,9 @@ declare module 'rclnodejs' {
18
23
  nodeName: string,
19
24
  namespace?: string,
20
25
  context?: Context,
21
- options?: NodeOptions
26
+ options?: NodeOptions,
27
+ args?: string[],
28
+ useGlobalArguments?: boolean
22
29
  ): Node;
23
30
 
24
31
  /**
@@ -182,4 +189,22 @@ declare module 'rclnodejs' {
182
189
  * @returns An array of the names and types.
183
190
  */
184
191
  function getActionNamesAndTypes(node: Node): NamesAndTypesQueryResult;
192
+
193
+ /**
194
+ * Serialize a message to a Buffer.
195
+ *
196
+ * @param message - The message to be serialized.
197
+ * @param typeClass - The type class of the message.
198
+ * @returns A Buffer containing the serialized message.
199
+ */
200
+ function serializeMessage(message: object, typeClass: Class): Buffer;
201
+
202
+ /**
203
+ * Deserialize a message from a Buffer.
204
+ *
205
+ * @param buffer - The Buffer containing the serialized message.
206
+ * @param typeClass - The type class of the message.
207
+ * @returns An Object representing the deserialized message.
208
+ */
209
+ function deserializeMessage(buffer: Buffer, typeClass: Class): object;
185
210
  }
@@ -333,6 +333,13 @@ declare module 'rclnodejs' {
333
333
  * @returns {boolean} true if the state machine is initialized; otherwise false.
334
334
  */
335
335
  get isInitialized(): boolean;
336
+
337
+ /**
338
+ * Log the state machine data.
339
+ *
340
+ * @returns {undefined} void.
341
+ */
342
+ print(): void;
336
343
  }
337
344
  } // lifecycle namespace
338
345
  } // rclnodejs namespace
package/types/node.d.ts CHANGED
@@ -750,21 +750,45 @@ declare module 'rclnodejs' {
750
750
  getServiceNamesAndTypes(): Array<NamesAndTypesQueryResult>;
751
751
 
752
752
  /**
753
- * Get an array of publishers on a given topic.
753
+ * Return a list of publishers on a given topic.
754
754
  *
755
- * @param topic - The name of the topic.
756
- * @param noDemangle - if `true`, `topic_name` needs to be a valid middleware topic name,
757
- * otherwise it should be a valid ROS topic name.
755
+ * The returned parameter is a list of TopicEndpointInfo objects, where each will contain
756
+ * the node name, node namespace, topic type, topic endpoint's GID, and its QoS profile.
757
+ *
758
+ * When the `no_mangle` parameter is `true`, the provided `topic` should be a valid
759
+ * topic name for the middleware (useful when combining ROS with native middleware (e.g. DDS)
760
+ * apps). When the `no_mangle` parameter is `false`, the provided `topic` should
761
+ * follow ROS topic name conventions.
762
+ *
763
+ * `topic` may be a relative, private, or fully qualified topic name.
764
+ * A relative or private topic will be expanded using this node's namespace and name.
765
+ * The queried `topic` is not remapped.
766
+ *
767
+ * @param topic - The topic on which to find the publishers.
768
+ * @param [noDemangle=false] - If `true`, `topic` needs to be a valid middleware topic
769
+ * name, otherwise it should be a valid ROS topic name. Defaults to `false`.
758
770
  * @returns An array of publishers.
759
771
  */
760
772
  getPublishersInfoByTopic(topic: string, noDemangle: boolean): Array<object>;
761
773
 
762
774
  /**
763
- * Get an array of subscriptions on a given topic.
775
+ * Return a list of subscriptions on a given topic.
764
776
  *
765
- * @param topic - The name of the topic.
766
- * @param noDemangle - if `true`, `topic_name` needs to be a valid middleware topic name,
767
- * otherwise it should be a valid ROS topic name.
777
+ * The returned parameter is a list of TopicEndpointInfo objects, where each will contain
778
+ * the node name, node namespace, topic type, topic endpoint's GID, and its QoS profile.
779
+ *
780
+ * When the `no_mangle` parameter is `true`, the provided `topic` should be a valid
781
+ * topic name for the middleware (useful when combining ROS with native middleware (e.g. DDS)
782
+ * apps). When the `no_mangle` parameter is `false`, the provided `topic` should
783
+ * follow ROS topic name conventions.
784
+ *
785
+ * `topic` may be a relative, private, or fully qualified topic name.
786
+ * A relative or private topic will be expanded using this node's namespace and name.
787
+ * The queried `topic` is not remapped.
788
+ *
789
+ * @param topic - The topic on which to find the subscriptions..
790
+ * @param [noDemangle=false] - If `true`, `topic` needs to be a valid middleware topic
791
+ name, otherwise it should be a valid ROS topic name. Defaults to `false`.
768
792
  * @returns An array of subscriptions.
769
793
  */
770
794
  getSubscriptionsInfoByTopic(
@@ -838,5 +862,21 @@ declare module 'rclnodejs' {
838
862
  * @returns - The RMW implementation identifier.
839
863
  */
840
864
  getRMWImplementationIdentifier(): string;
865
+
866
+ /**
867
+ * Return a topic name expanded and remapped.
868
+ * @param topicName - Topic name to be expanded and remapped.
869
+ * @param onlyExpand - If `true`, remapping rules won't be applied, default is false.
870
+ * @returns A fully qualified topic name.
871
+ */
872
+ resolveTopicName(topicName: string, onlyExpand?: boolean): string;
873
+
874
+ /**
875
+ * Return a service name expanded and remapped.
876
+ * @param service - Service name to be expanded and remapped.
877
+ * @param onlyExpand - If `true`, remapping rules won't be applied, default is false.
878
+ * @returns A fully qualified service name.
879
+ */
880
+ resolveServiceName(service: string, onlyExpand?: boolean): string;
841
881
  }
842
882
  }