rclnodejs 1.1.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.
Files changed (44) hide show
  1. package/README.md +4 -4
  2. package/binding.gyp +5 -0
  3. package/index.js +26 -3
  4. package/lib/context.js +4 -2
  5. package/lib/event_handler.js +474 -0
  6. package/lib/lifecycle.js +9 -0
  7. package/lib/lifecycle_publisher.js +2 -2
  8. package/lib/node.js +163 -28
  9. package/lib/publisher.js +31 -4
  10. package/lib/serialization.js +60 -0
  11. package/lib/subscription.js +48 -4
  12. package/lib/type_description_service.js +27 -1
  13. package/package.json +1 -1
  14. package/rosidl_gen/templates/message.dot +1 -1
  15. package/scripts/npmjs-readme.md +4 -4
  16. package/src/addon.cpp +4 -0
  17. package/src/executor.cpp +3 -4
  18. package/src/handle_manager.cpp +13 -2
  19. package/src/handle_manager.h +4 -1
  20. package/src/macros.h +17 -1
  21. package/src/rcl_action_client_bindings.cpp +3 -2
  22. package/src/rcl_action_goal_bindings.cpp +3 -2
  23. package/src/rcl_action_server_bindings.cpp +7 -5
  24. package/src/rcl_client_bindings.cpp +4 -3
  25. package/src/rcl_context_bindings.cpp +29 -19
  26. package/src/rcl_event_handle_bindings.cpp +294 -0
  27. package/src/rcl_event_handle_bindings.h +26 -0
  28. package/src/rcl_guard_condition_bindings.cpp +3 -2
  29. package/src/rcl_lifecycle_bindings.cpp +18 -4
  30. package/src/rcl_node_bindings.cpp +111 -3
  31. package/src/rcl_publisher_bindings.cpp +4 -3
  32. package/src/rcl_serialization_bindings.cpp +116 -0
  33. package/src/rcl_serialization_bindings.h +26 -0
  34. package/src/rcl_service_bindings.cpp +4 -3
  35. package/src/rcl_subscription_bindings.cpp +3 -2
  36. package/src/rcl_time_point_bindings.cpp +3 -2
  37. package/src/rcl_timer_bindings.cpp +8 -6
  38. package/src/rcl_utilities.cpp +31 -0
  39. package/src/rcl_utilities.h +7 -0
  40. package/tsconfig.json +2 -2
  41. package/types/context.d.ts +3 -2
  42. package/types/index.d.ts +26 -1
  43. package/types/lifecycle.d.ts +7 -0
  44. package/types/node.d.ts +60 -10
package/types/node.d.ts CHANGED
@@ -303,12 +303,14 @@ declare module 'rclnodejs' {
303
303
  * @param typeClass - Type of message that will be published.
304
304
  * @param topic - Name of the topic the publisher will publish to.
305
305
  * @param options - Configuration options, see DEFAULT_OPTIONS
306
+ * @param eventCallbacks - Optional The event callbacks for the publisher.
306
307
  * @returns New instance of Publisher.
307
308
  */
308
309
  createPublisher<T extends TypeClass<MessageTypeClassName>>(
309
310
  typeClass: T,
310
311
  topic: string,
311
- options?: Options
312
+ options?: Options,
313
+ eventCallbacks?: (event: object) => void
312
314
  ): Publisher<T>;
313
315
 
314
316
  /**
@@ -333,6 +335,7 @@ declare module 'rclnodejs' {
333
335
  * @param topic - Name of the topic the subcription will subscribe to.
334
336
  * @param options - Configuration options, see DEFAULT_OPTIONS
335
337
  * @param callback - Called when a new message is received. The serialized message will be null-terminated.
338
+ * @param eventCallbacks - Optional The event callbacks for the subscription.
336
339
  * @returns New instance of Subscription.
337
340
  * @throws Error - May throw an RMW error if options.content-filter is malformed.
338
341
  * @see {@link https://www.omg.org/spec/DDS/1.4/PDF|Content-filter details at DDS 1.4 specification, Annex B}
@@ -341,7 +344,8 @@ declare module 'rclnodejs' {
341
344
  typeClass: T,
342
345
  topic: string,
343
346
  options: Options,
344
- callback: SubscriptionCallback<T> | SubscriptionWithRawMessageCallback
347
+ callback: SubscriptionCallback<T> | SubscriptionWithRawMessageCallback,
348
+ eventCallbacks?: (event: object) => void
345
349
  ): Subscription;
346
350
 
347
351
  /**
@@ -746,21 +750,45 @@ declare module 'rclnodejs' {
746
750
  getServiceNamesAndTypes(): Array<NamesAndTypesQueryResult>;
747
751
 
748
752
  /**
749
- * Get an array of publishers on a given topic.
753
+ * Return a list of publishers on a given topic.
750
754
  *
751
- * @param topic - The name of the topic.
752
- * @param noDemangle - if `true`, `topic_name` needs to be a valid middleware topic name,
753
- * 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`.
754
770
  * @returns An array of publishers.
755
771
  */
756
772
  getPublishersInfoByTopic(topic: string, noDemangle: boolean): Array<object>;
757
773
 
758
774
  /**
759
- * Get an array of subscriptions on a given topic.
775
+ * Return a list of subscriptions on a given topic.
760
776
  *
761
- * @param topic - The name of the topic.
762
- * @param noDemangle - if `true`, `topic_name` needs to be a valid middleware topic name,
763
- * 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`.
764
792
  * @returns An array of subscriptions.
765
793
  */
766
794
  getSubscriptionsInfoByTopic(
@@ -828,5 +856,27 @@ declare module 'rclnodejs' {
828
856
  * @returns String containing the fully qualified name of the node.
829
857
  */
830
858
  getFullyQualifiedName(): string;
859
+
860
+ /**
861
+ * Get the RMW implementation identifier
862
+ * @returns - The RMW implementation identifier.
863
+ */
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;
831
881
  }
832
882
  }