declare module 'rclnodejs' { /** * Identifies a ROS message, service or action type. * * A type can be supplied in any of the following forms: * - a constructor returned by {@link require | rclnodejs.require(...)} — for a * message (e.g. `std_msgs/msg/String`), a service (with `Request`/`Response`) * or an action (with `Goal`/`Feedback`/`Result`). This form is fully typed: * the concrete message types are inferred for callbacks, requests, responses, * goals, feedback and results. * - a string, e.g. `'std_msgs/msg/String'`. Also fully typed. * - an object descriptor, e.g. `{package: 'std_msgs', type: 'msg', name: 'String'}`. * Supported at runtime but not statically resolvable, so it falls back to * `object`. Prefer the string or constructor form for full type safety. */ type TypeClass = | (new (...args: any[]) => any) // a message class constructor, e.g. the value returned by rclnodejs.require('std_msgs/msg/String') | { // a service class constructor, e.g. the value returned by rclnodejs.require('example_interfaces/srv/AddTwoInts') readonly Request: new (...args: any[]) => any; readonly Response: new (...args: any[]) => any; } | { // an action class constructor, e.g. the value returned by rclnodejs.require('example_interfaces/action/Fibonacci') readonly Goal: new (...args: any[]) => any; readonly Feedback: new (...args: any[]) => any; readonly Result: new (...args: any[]) => any; } | T // a string representing the message/service/action class, e.g. 'std_msgs/msg/String', | { // object representing a message class, e.g. {package: 'std_msgs', type: 'msg', name: 'String'}. // NOTE: this form is supported at runtime but provides no message type inference in // TypeScript (messages resolve to `object`). Prefer the string or constructor form for // full type safety. package: string; type: string; name: string; }; /** * Valid serialization modes for message conversion */ type SerializationMode = 'default' | 'plain' | 'json'; /** * A filter description similar to a SQL WHERE clause that limits * the data wanted by a Subscription. * * The `expression` grammar is defined in the DDS 1.4 specification, Annex B. * https://www.omg.org/spec/DDS/1.4/PDF */ interface SubscriptionContentFilter { /** * Specifies the criteria to select the data samples of * interest. It is similar to the WHERE part of an SQL clause. * Must be a valid query clause. */ readonly expression: string; /** * The values for the ‘parameters’ (i.e., "%n" tokens) in * the filter_expression string. There must be a 1-1 match * between values and expression parameters. The maximum * number of parameters is 100. */ readonly parameters?: Array; } /** * Configuration options when creating new Publishers, Subscribers, * Clients and Services. * * See {@link DEFAULT_OPTIONS} */ interface Options { /** * A messages will use TypedArray if necessary, default: true. */ enableTypedArray?: boolean; /** * Indicates messages are serialized, default: false. * * @remarks * See {@link Node#createSubscription | Node.createSubscription} */ isRaw?: boolean; /** * Controls message serialization format, default: 'default'. * * - 'default': Use native rclnodejs behavior (respects enableTypedArray setting) * - 'plain': Convert TypedArrays to regular arrays * - 'json': Fully JSON-safe (handles TypedArrays, BigInt, etc.) */ serializationMode?: SerializationMode; /** * ROS Middleware "quality of service" setting, default: QoS.profileDefault. */ qos?: T; /** * An optional filter descriptions similar to a SQL WHERE clause used by a Subscription to * inspect and limit messages that it accepts. */ contentFilter?: SubscriptionContentFilter; /** * If provided, declares read-only ROS parameters for the specified QoS policies. * These can be overridden at startup via `--ros-args -p` or `--params-file`. * If qos is a profile string, it will be resolved to a mutable QoS object. */ qosOverridingOptions?: QoSOverridingOptions; } /** * Default options when creating a Publisher, Subscription, Client or Service * * ```ts * { * enableTypedArray: true, * qos: QoS.profileDefault, * isRaw: false, * contentFilter: undefined, * serializationMode: 'default' * } * ``` */ const DEFAULT_OPTIONS: Options; interface TimerInfo { expectedCallTime: bigint; actualCallTime: bigint; } interface TimerOptions { autostart?: boolean; } /** * Callback for receiving periodic interrupts from a Timer. * Receives timer metadata when the underlying ROS distro exposes it. * * @remarks * See {@link Node.createTimer | Node.createTimer} * See {@link Timer} */ type TimerRequestCallback = (timerInfo?: TimerInfo) => void; /** * Callback indicating parameters are about to be declared or set. * The callback is provided a list of parameters and returns a SetParameterResult * to indicate approval or veto of the operation. * * @param parameters - The parameters to be declared or set * @returns A successful property value of true indicates approval of the operation; * otherwise indicates a veto of the operation. * * @remarks * See {@link Node.addOnSetParametersCallback | Node.addOnSetParametersCallback} * See {@link Node.removeOnSetParametersCallback | Node.removeOnSetParametersCallback} */ type SetParametersCallback = ( parameters: Parameter[] ) => rcl_interfaces.msg.SetParametersResult; /** * Callback invoked before parameter validation and setting. * Receives the parameter list, must return a (possibly modified) parameter list. * Returning an empty list rejects the set. */ type PreSetParametersCallback = (parameters: Parameter[]) => Parameter[]; /** * Callback invoked after parameters have been successfully set. * For side effects only (return value is ignored). */ type PostSetParametersCallback = (parameters: Parameter[]) => void; /** * Standard result of Node.getXXXNamesAndTypes() queries * * @example * ``` * [ * { name: '/rosout', types: [ 'rcl_interfaces/msg/Log' ] }, * { name: '/scan', types: [ 'sensor_msgs/msg/LaserScan' ] }, * { name: '/topic', types: [ 'std_msgs/msg/String' ] } * ] * ``` */ type NamesAndTypesQueryResult = { name: string; types: Array; }; /** * Result of Node.getNodeNames() query * * @example * ``` * [ * { name: 'gazebo', namespace: '/' }, * { name: 'robot_state_publisher', namespace: '/' }, * { name: 'cam2image', namespace: '/demo' } * ] * ``` */ type NodeNamesQueryResult = { name: string; namespace: string; }; /** * Result of Node.getNodeNames() query * * @example * ``` * [ * { name: 'gazebo', namespace: '/', enclave: '/'}, * { name: 'robot_state_publisher', namespace: '/', enclave: '/' }, * { name: 'cam2image', namespace: '/demo' , enclave: '/'} * ] * ``` */ type NodeNamesQueryResultWithEnclaves = { name: string; namespace: string; enclave: string; }; /** * Node is the primary entrypoint in a ROS system for communication. * It can be used to create ROS entities such as publishers, subscribers, * services, clients and timers. */ class Node { /** * Create a node instance. * * @param nodeName - The name used to register in ROS. * @param namespace - The namespace used in ROS, default is an empty string. * @param context - The context, default is Context.defaultContext(). * @param options - The node options, default is NodeOptions.defaultOptions. */ constructor( nodeName: string, namespace?: string, context?: Context, options?: NodeOptions ); /** * Create an Options instance initialized with default values. * @returns {Options} - The new initialized instance. * @example * ``` * { * enableTypedArray: true, * isRaw: false, * qos: QoS.profileDefault, * contentFilter: undefined, * } * ``` */ static getDefaultOptions(): Options; /** * Get the name of the node. * * @returns The node name. */ name(): string; /** * Get the namespace of the node. * * @returns The node namespace. */ namespace(): string; /** * Get the Context that manages this node. * * @returns The context. */ get context(): Context; /** * Get the nodes logger. * * @returns The logger for the node. */ getLogger(): Logging; /** * Get the clock used by the node. * * @returns The nodes clock. */ getClock(): Clock; /** * Get the current time using the node's clock. * * @returns The current time. */ now(): Time; /** * Get the nodeOptions provided through the constructor. * * @returns The nodeOptions. */ options(): NodeOptions; /** * Determine if this node is spinning. * * @returns true when spinning; otherwise returns false. */ get spinning(): boolean; /** * Trigger the event loop to continuously check for and route. * incoming events. * A synchronous callback exception stops the current ready batch and is * reported through Node.js uncaught exception handling. * @param node - The node to be spun up. * @param - Timeout to wait in milliseconds. Block forever if negative. Don't wait if 0. * @throws Error if the node is already spinning or native executor cleanup is still in progress. */ spin(timeout?: number): void; /** * Spin the node and trigger the event loop to check for one incoming event. Thereafter the node * will not received additional events until running additional calls to spin() or spinOnce(). * A synchronous callback exception stops the current ready batch and is thrown to the caller. * @param node - The node to be spun. * @param - Timeout to wait in milliseconds. Block forever if negative. Don't wait if 0. * @throws An error if the node is already spinning or native executor cleanup is still in progress. */ spinOnce(timeout?: number): void; /** * Terminate spinning - no further events will be received. * Interrupts the native background wait, including an infinite spin timeout. * Does not interrupt a JavaScript callback that is already executing. * Reentrant calls during cleanup do not repeat teardown; starting a new spin * must wait until cleanup has finished. * @throws Error if the worker or native cleanup fails. */ stop(): void; /** * Create a Timer. * * @param period - Elapsed time between interrupt events in nanoseconds. * @param callback - Called when the timer fires. Receives a `TimerInfo` argument when available. * @param optionsOrClock - Optional timer options or clock to use for the timer. * Supports `{ autostart?: boolean }` when an options object is provided. * @param clock - Optional clock to use for the timer when options are provided. * @returns New instance of Timer. */ createTimer( period: bigint, callback: TimerRequestCallback, optionsOrClock?: TimerOptions | Clock | null, clock?: Clock | null ): Timer; /** * Create a Rate. * * @param hz - The frequency of the rate timer; default is 1 hz. * @returns Promise resolving to new instance of Rate. */ createRate(hz: number): Promise; /** * Create a Publisher. * * @param typeClass - Type of message that will be published. * @param topic - Name of the topic the publisher will publish to. * @param options - Configuration options, see DEFAULT_OPTIONS * @param eventCallbacks - Optional The event callbacks for the publisher. * @returns New instance of Publisher. */ createPublisher>( typeClass: T, topic: string, options?: Options, eventCallbacks?: (event: object) => void ): Publisher; /** * Create a Subscription. * * @param typeClass - Type of ROS messages the subscription will subscribe to * @param topic - Name of the topic the subcription will subscribe to. * @param callback - Called when a new message is received. * The serialized message will be null-terminated. * @returns New instance of Subscription. */ createSubscription>( typeClass: T, topic: string, callback: SubscriptionCallback ): Subscription; /** * Create a Subscription. * * @param typeClass - Type of ROS messages the subscription will subscribe to * @param topic - Name of the topic the subcription will subscribe to. * @param options - Configuration options, see DEFAULT_OPTIONS * @param callback - Called when a new message is received. The serialized message will be null-terminated. * @param eventCallbacks - Optional The event callbacks for the subscription. * @returns New instance of Subscription. * @throws Error - May throw an RMW error if options.content-filter is malformed. * @see {@link https://www.omg.org/spec/DDS/1.4/PDF|Content-filter details at DDS 1.4 specification, Annex B} */ createSubscription>( typeClass: T, topic: string, options: Options, callback: SubscriptionCallback | SubscriptionWithRawMessageCallback, eventCallbacks?: (event: object) => void ): Subscription; /** * Create a Subscription that returns an RxJS Observable. * This allows using reactive programming patterns with ROS 2 messages. * * @param typeClass - Type of ROS messages the subscription will subscribe to. * @param topic - Name of the topic the subscription will subscribe to. * @param options - Configuration options, see DEFAULT_OPTIONS. * @param eventCallbacks - Optional event callbacks for the subscription. * @returns An ObservableSubscription with an RxJS Observable. */ createObservableSubscription>( typeClass: T, topic: string, options?: Options, eventCallbacks?: (event: object) => void ): ObservableSubscription>; /** * Create a Client for making server requests. * * @param typeClass - Service type. * @param serviceName - Service name. * @param options - The options argument used to parameterize the client. * @returns New instance of Client. */ createClient>( typeClass: T, serviceName: string, options?: Options ): Client; /** * Create a Service. * * @param typeClass - Service type * @param serviceName - Name of the service. * @param callback - Callback function for notification of incoming requests. * @returns An instance of Service. */ createService>( typeClass: T, serviceName: string, callback: ServiceRequestHandler ): ServiceType; /** * Create a Service. * * @param typeClass - Service type * @param serviceName - Name of the service. * @param options - Configuration options * @param callback - Notified for receiving incoming requests. * @returns An instance of Service. */ createService>( typeClass: T, serviceName: string, options: Options, callback: ServiceRequestHandler ): ServiceType; /** * Create a ParameterClient for accessing parameters on a remote node. * * @param remoteNodeName - The name of the remote node whose parameters to access. * @param options - Options for parameter client. * @returns An instance of ParameterClient. */ createParameterClient( remoteNodeName: string, options?: { timeout?: number } ): ParameterClient; /** * Create a ParameterWatcher for watching parameter changes on a remote node. * * @param remoteNodeName - The name of the remote node whose parameters to watch. * @param parameterNames - Array of parameter names to watch. * @param options - Options for parameter watcher. * @returns An instance of ParameterWatcher. */ createParameterWatcher( remoteNodeName: string, parameterNames: string[], options?: { timeout?: number } ): ParameterWatcher; /** * Create a guard condition. * * @param callback - The callback to be called when the guard condition is triggered. * @returns An instance of GuardCondition. */ createGuardCondition(callback: () => any): GuardCondition; /** * Destroy all entities allocated by this node, including * Timers, Publishers, Subscriptions, Clients, Services * and Timers. */ destroy(): void; /** * Destroy a Publisher. * * @param publisher - Publisher to be destroyed. */ destroyPublisher>( publisher: Publisher ): void; /** * Destroy a Subscription. * * @param subscription - Subscription to be destroyed. */ destroySubscription(subscription: Subscription): void; /** * Destroy a Client. * * @param client - Client to be destroyed. */ destroyClient>( client: Client ): void; /** * Destroy a Service. * * @param service - Service to be destroyed. */ destroyService(service: Service): void; /** * Destroy a ParameterClient. * * @param parameterClient - ParameterClient to be destroyed. */ destroyParameterClient(parameterClient: ParameterClient): void; /** * Destroy a ParameterWatcher. * * @param watcher - ParameterWatcher to be destroyed. */ destroyParameterWatcher(watcher: ParameterWatcher): void; /** * Create a ParameterEventHandler that monitors parameter changes on any node. * * Unlike ParameterWatcher which watches specific parameters on a single * remote node, ParameterEventHandler can register callbacks for parameters * on any node in the ROS 2 graph by subscribing to /parameter_events. * * @param options - Options for the handler. * @returns An instance of ParameterEventHandler. */ createParameterEventHandler( options?: ParameterEventHandlerOptions ): ParameterEventHandler; /** * Destroy a ParameterEventHandler. * * @param handler - ParameterEventHandler to be destroyed. */ destroyParameterEventHandler(handler: ParameterEventHandler): void; /** * Destroy a Timer. * A destroyed timer is skipped even if it was already ready for dispatch. * * @param timer - Timer to be destroyed. */ destroyTimer(timer: Timer): void; /** * Declare a parameter. * * Internally, register a parameter and it's descriptor. * If a parameter-override exists, it's value will replace that of the parameter * unless ignoreOverride is true. * If the descriptor is undefined, then a ParameterDescriptor will be inferred * from the parameter's state. * * If a parameter by the same name has already been declared then an Error is thrown. * A parameter must be undeclared before attempting to redeclare it. * * @param parameter - Parameter to declare. * @param descriptor - Optional descriptor for parameter. * @param ignoreOveride - When true disregard any parameter-override that may be present. * @returns The newly declared parameter. */ declareParameter( parameter: Parameter, descriptor?: ParameterDescriptor, ignoreOveride?: boolean ): Parameter; /** * Declare a list of parameters. * * Internally register parameters with their corresponding descriptor one by one * in the order they are provided. This is an atomic operation. If an error * occurs the process halts and no further parameters are declared. * Parameters that have already been processed are undeclared. * * While descriptors is an optional parameter, when provided there must be * a descriptor for each parameter; otherwise an Error is thrown. * If descriptors is not provided then a descriptor will be inferred * from each parameter's state. * * When a parameter-override is available, the parameter's value * will be replaced with that of the parameter-override unless ignoreOverrides * is true. * * If a parameter by the same name has already been declared then an Error is thrown. * A parameter must be undeclared before attempting to redeclare it. * * @param parameters - The parameters to declare. * @param descriptors - Optional descriptors, a 1-1 correspondence with parameters. * @param ignoreOverrides - When true, parameter-overrides are * not considered, i.e.,ignored. * @returns The declared parameters. */ declareParameters( parameters: Array, descriptors?: Array, ignoreOverrides?: boolean ): Array; /** * Undeclare a parameter. * * Readonly parameters can not be undeclared or updated. * @param name - Name of parameter to undeclare. */ undeclareParameter(name: string): void; /** * Determine a parameter has been declared. * * @param name - Name of the parameter * @returns True if parameter exists; false otherwise. */ hasParameter(name: string): boolean; /** * Get a declared parameter by name. * * If unable to locate a declared parameter then a * parameter with type == PARAMETER_NOT_SET is returned. * * @param name - The name of the parameter. * @returns The parameter. */ getParameter(name: string): Parameter; /** * Get a list of parameters. * * Find and return the declared parameters. * If no names are provided return all declared parameters. * * If unable to locate a declared parameter then a * parameter with type == PARAMETER_NOT_SET is returned in * it's place. * * @param names - The names of the declared parameters * to find or null indicating to return all declared parameters. * @returns The parameters. */ getParameters(name?: Array): Array; /** * Get the names of all declared parameters. * * @returns The declared parameter names or empty array if * no parameters have been declared. */ getParameterNames(): Array; /** * Get the list of parameter-overrides found on the commandline and * in the NodeOptions.parameter_overrides property. * * @returns An array of Parameters */ getParameterOverrides(): Array; /** * Determine if a parameter descriptor exists. * * @param name - The name of a descriptor to detect. * @returns True if a descriptor has been declared; otherwise false. */ hasParameterDescriptor(name: string): boolean; /** * Get a declared parameter descriptor by name. * * If unable to locate a declared parameter descriptor then a * descriptor with type == PARAMETER_NOT_SET is returned. * * @param name - The name of the parameter descriptor to find. * @returns The parameter descriptor. */ getParameterDescriptor(name: string): ParameterDescriptor; /** * Find a list of declared ParameterDescriptors. * * If no names are provided return all declared descriptors. * * If unable to locate a declared descriptor then a * descriptor with type == PARAMETER_NOT_SET is returned in * it's place. * * @param names - The names of the declared parameter * descriptors to find or null indicating to return all declared descriptors. * @returns The parameter descriptors. */ getParameterDescriptors(name?: string[]): ParameterDescriptor[]; /** * Replace a declared parameter. * * The parameter being replaced must be a declared parameter who's descriptor * is not readOnly; otherwise an Error is thrown. * * @param parameter - The new parameter. * @returns The result of the operation. */ setParameter(parameter: Parameter): rcl_interfaces.msg.SetParametersResult; /** * Replace a list of declared parameters. * * Declared parameters are replaced in the order they are provided and * a ParameterEvent is published for each individual parameter change. * * If an error occurs, the process is stopped and returned. Parameters * set before an error remain unchanged. * * @param parameters - The parameters to set. * @returns An array of SetParameterResult, one for each parameter that was set. */ setParameters( parameters: Array ): Array; /** * Repalce a list of declared parameters atomically. * * Declared parameters are replaced in the order they are provided. * A single ParameterEvent is published collectively for all changed * parameters. * * If an error occurs, the process stops immediately. All parameters updated to * the point of the error are reverted to their previous state. * * @param parameters - The parameters to set. * @returns Describes the result of setting 1 or more */ setParametersAtomically( parameters: Array ): rcl_interfaces.msg.SetParametersResult; /** * Add a callback to the front of the list of callbacks invoked for parameter declaration * and setting. No checks are made for duplicate callbacks. * * @param callback - The callback to add. */ addOnSetParametersCallback(callback: SetParametersCallback): void; /** * Remove a callback from the list of SetParameterCallbacks. * If the callback is not found the process is a nop. * * @param callback - The callback to be removed */ removeOnSetParametersCallback(call: SetParametersCallback): void; /** * Add a callback invoked before parameter validation. * The callback receives the parameter list and must return a (possibly modified) * parameter list. Returning an empty list rejects the set. * * @param callback - The callback to add. */ addPreSetParametersCallback(callback: PreSetParametersCallback): void; /** * Remove a pre-set parameters callback. * * @param callback - The callback to remove. */ removePreSetParametersCallback(callback: PreSetParametersCallback): void; /** * Add a callback invoked after parameters are successfully set. * Useful for triggering side effects (e.g., reconfiguring a component). * * @param callback - The callback to add. */ addPostSetParametersCallback(callback: PostSetParametersCallback): void; /** * Remove a post-set parameters callback. * * @param callback - The callback to remove. */ removePostSetParametersCallback(callback: PostSetParametersCallback): void; /** * Get a remote node's published topics. * * @param remoteNodeName - Name of a remote node. * @param namespace - Name of the remote namespace. * @param noDemangle - If true, topic names and types returned will not be demangled, default: false. * @returns An array of the names and types. * [ * { name: '/rosout', types: [ 'rcl_interfaces/msg/Log' ] }, * { name: '/scan', types: [ 'sensor_msgs/msg/LaserScan' ] } * ] */ getPublisherNamesAndTypesByNode( remoteNodeName: string, namespace?: string, noDemangle?: boolean ): Array; /** * Get a remote node's subscribed topics. * * @param nodeName - Name of the remote node. * @param namespace - Name of the remote namespace. * @param noDemangle - If true topic, names and types returned will not be demangled, default: false. * @returns An array of the names and types. * [ * { name: '/topic', types: [ 'std_msgs/msg/String' ] } * ]s */ getSubscriptionNamesAndTypesByNode( remoteNodeName: string, namespace?: string, noDemangle?: boolean ): Array; /** * Get a remote node's service topics. * * @param remoteNodeName - Name of the remote node. * @param namespace - Name of the remote namespace. * @returns An array of the names and types. * [ * { name: '/rosout', types: [ 'rcl_interfaces/msg/Log' ] }, * ... * ] */ getServiceNamesAndTypesByNode( remoteNodeName: string, namespace?: string ): Array; /** * Get a remote node's client topics. * * @param remoteNodeName - Name of the remote node. * @param namespace - Name of the remote namespace. * @returns An array of the names and types. * [ * { name: '/rosout', types: [ 'rcl_interfaces/msg/Log' ] }, * ... * ] */ getClientNamesAndTypesByNode( remoteNodeName: string, namespace?: string ): Array; /** * Get this node's topics and corresponding types. * * @param noDemangle - If true. topic names and types returned will not be demangled, default: false. * @returns An array of the names and types. * [ * { name: '/rosout', types: [ 'rcl_interfaces/msg/Log' ] }, * { name: '/scan', types: [ 'sensor_msgs/msg/LaserScan' ] }, * { name: '/topic', types: [ 'std_msgs/msg/String' ] } * ] */ getTopicNamesAndTypes( noDemangle?: boolean ): Array; /** * Get this node's service names and corresponding types. * * @returns An array of the names and types. * [ * { name: '/start_motor', types: [ 'rplidar_ros/srv/Control' ] }, * { name: '/stop_motor', types: [ 'rplidar_ros/srv/Control' ] } * ] */ getServiceNamesAndTypes(): Array; /** * Return the number of action clients on an action. * * @param actionName - The action on which to count the action clients. * @returns The number of action clients, or `null` when the ROS distro is * older than Lyrical and does not provide action graph counts. */ countActionClients(actionName: string): number | null; /** * Return the number of action servers on an action. * * @param actionName - The action on which to count the action servers. * @returns The number of action servers, or `null` when the ROS distro is * older than Lyrical and does not provide action graph counts. */ countActionServers(actionName: string): number | null; /** * Return endpoint information for each action client on an action. * * Each entry aggregates the endpoint information of all the underlying * entities of one action client, i.e. the clients of the goal, cancel and * result services and the subscriptions on the feedback and status topics. * * @param actionName - The action on which to find the action clients. * @returns An array of ActionEndpointInfo, or `null` when the ROS distro is * older than Rolling and does not provide action endpoint information. */ getActionClientsInfoByAction( actionName: string ): ActionEndpointInfo[] | null; /** * Return endpoint information for each action server on an action. * * Each entry aggregates the endpoint information of all the underlying * entities of one action server, i.e. the servers of the goal, cancel and * result services and the publishers on the feedback and status topics. * * @param actionName - The action on which to find the action servers. * @returns An array of ActionEndpointInfo, or `null` when the ROS distro is * older than Rolling and does not provide action endpoint information. */ getActionServersInfoByAction( actionName: string ): ActionEndpointInfo[] | null; /** * Return a list of publishers on a given topic. * * The returned parameter is a list of TopicEndpointInfo objects, where each will contain * the node name, node namespace, topic type, topic endpoint's GID, and its QoS profile. * * When the `no_mangle` parameter is `true`, the provided `topic` should be a valid * topic name for the middleware (useful when combining ROS with native middleware (e.g. DDS) * apps). When the `no_mangle` parameter is `false`, the provided `topic` should * follow ROS topic name conventions. * * `topic` may be a relative, private, or fully qualified topic name. * A relative or private topic will be expanded using this node's namespace and name. * The queried `topic` is not remapped. * * @param topic - The topic on which to find the publishers. * @param [noDemangle=false] - If `true`, `topic` needs to be a valid middleware topic * name, otherwise it should be a valid ROS topic name. Defaults to `false`. * @returns An array of publishers. */ getPublishersInfoByTopic(topic: string, noDemangle: boolean): Array; /** * Return a list of subscriptions on a given topic. * * The returned parameter is a list of TopicEndpointInfo objects, where each will contain * the node name, node namespace, topic type, topic endpoint's GID, and its QoS profile. * * When the `no_mangle` parameter is `true`, the provided `topic` should be a valid * topic name for the middleware (useful when combining ROS with native middleware (e.g. DDS) * apps). When the `no_mangle` parameter is `false`, the provided `topic` should * follow ROS topic name conventions. * * `topic` may be a relative, private, or fully qualified topic name. * A relative or private topic will be expanded using this node's namespace and name. * The queried `topic` is not remapped. * * @param topic - The topic on which to find the subscriptions.. * @param [noDemangle=false] - If `true`, `topic` needs to be a valid middleware topic name, otherwise it should be a valid ROS topic name. Defaults to `false`. * @returns An array of subscriptions. */ getSubscriptionsInfoByTopic( topic: string, noDemangle: boolean ): Array; /** * Return a list of clients on a given service. * * The returned parameter is a list of ServiceEndpointInfo objects, where each will contain * the node name, node namespace, service type, service endpoint's GID, and its QoS profile. * * When the `no_mangle` parameter is `true`, the provided `service` should be a valid * service name for the middleware (useful when combining ROS with native middleware (e.g. DDS) * apps). When the `no_mangle` parameter is `false`, the provided `service` should * follow ROS service name conventions. * * `service` may be a relative, private, or fully qualified service name. * A relative or private service will be expanded using this node's namespace and name. * The queried `service` is not remapped. * * @param service - The service on which to find the clients. * @param [noDemangle=false] - If `true`, `service` needs to be a valid middleware service * name, otherwise it should be a valid ROS service name. Defaults to `false`. * @returns An array of clients. */ getClientsInfoByService( service: string, noDemangle: boolean ): Array; /** * Return a list of servers on a given service. * * The returned parameter is a list of ServiceEndpointInfo objects, where each will contain * the node name, node namespace, service type, service endpoint's GID, and its QoS profile. * * When the `no_mangle` parameter is `true`, the provided `service` should be a valid * service name for the middleware (useful when combining ROS with native middleware (e.g. DDS) * apps). When the `no_mangle` parameter is `false`, the provided `service` should * follow ROS service name conventions. * * `service` may be a relative, private, or fully qualified service name. * A relative or private service will be expanded using this node's namespace and name. * The queried `service` is not remapped. * * @param service - The service on which to find the servers. * @param [noDemangle=false] - If `true`, `service` needs to be a valid middleware service * name, otherwise it should be a valid ROS service name. Defaults to `false`. * @returns An array of servers. */ getServersInfoByService( service: string, noDemangle: boolean ): Array; /** * Get the list of nodes discovered by the provided node. * * @returns An array of the node names. */ getNodeNames(): string[]; /** * Get the list of nodes and their namespaces discovered by the provided node. * * @returns An array of the node names and namespaces. * [ * { name: 'gazebo', namespace: '/' }, * { name: 'robot_state_publisher', namespace: '/' }, * { name: 'cam2image', namespace: '/demo' } * ] */ getNodeNamesAndNamespaces(): Array; /** * Get the list of nodes and their namespaces with enclaves discovered by the provided node. * * @returns An array of the names, namespaces and enclaves. */ getNodeNamesAndNamespacesWithEnclaves(): Array; /** * Return the number of publishers on a given topic. * @param topic - The name of the topic. * @returns Number of publishers on the given topic. */ countPublishers(topic: string): number; /** * Return the number of subscribers on a given topic. * @param topic - The name of the topic. * @returns Number of subscribers on the given topic. */ countSubscribers(topic: string): number; /** * Get the number of clients on a given service name. * @param serviceName - The service name. * @returns Number of clients. */ countClients(serviceName: string): number; /** * Get the number of services on a given service name. * @param serviceName - The service name. * @returns Number of services. */ countServices(serviceName: string): number; /** * Get the fully qualified name of the node. * * @returns String containing the fully qualified name of the node. */ getFullyQualifiedName(): string; /** * Get the RMW implementation identifier * @returns - The RMW implementation identifier. */ getRMWImplementationIdentifier(): string; /** * Return a topic name expanded and remapped. * @param topicName - Topic name to be expanded and remapped. * @param onlyExpand - If `true`, remapping rules won't be applied, default is false. * @returns A fully qualified topic name. */ resolveTopicName(topicName: string, onlyExpand?: boolean): string; /** * Return a service name expanded and remapped. * @param service - Service name to be expanded and remapped. * @param onlyExpand - If `true`, remapping rules won't be applied, default is false. * @returns A fully qualified service name. */ resolveServiceName(service: string, onlyExpand?: boolean): string; } }