Class: Node

Node()

- Class representing a Node in ROS
Source:

Methods

countPublishers(topic) → {number}

Return the number of publishers on a given topic.
Parameters:
Name Type Description
topic string The name of the topic.
Source:
Returns:
- Number of publishers on the given topic.
Type
number

countSubscribers(topic) → {number}

Return the number of subscribers on a given topic.
Parameters:
Name Type Description
topic string The name of the topic.
Source:
Returns:
- Number of subscribers on the given topic.
Type
number

createClient(typeClass, serviceName, options) → {Client}

Create a Client.
Parameters:
Name Type Description
typeClass function | string | object The ROS message class, OR a string representing the message class, e.g. 'std_msgs/msg/String', OR an object representing the message class, e.g. {package: 'std_msgs', type: 'msg', name: 'String'}
serviceName string The service name to request.
options object The options argument used to parameterize the client.
Properties
Name Type Description
enableTypedArray boolean The response will use TypedArray if necessary, default: true.
qos QoS ROS Middleware "quality of service" settings for the client, default: QoS.profileDefault.
Source:
Returns:
- An instance of Client.
Type
Client

createGuardCondition(callback) → {GuardCondition}

Create a guard condition.
Parameters:
Name Type Description
callback function The callback to be called when the guard condition is triggered.
Source:
Returns:
- An instance of GuardCondition.
Type
GuardCondition

createPublisher(typeClass, topic, options) → {Publisher}

Create a Publisher.
Parameters:
Name Type Description
typeClass function | string | object The ROS message class, OR a string representing the message class, e.g. 'std_msgs/msg/String', OR an object representing the message class, e.g. {package: 'std_msgs', type: 'msg', name: 'String'}
topic string The name of the topic.
options object The options argument used to parameterize the publisher.
Properties
Name Type Description
enableTypedArray boolean The topic will use TypedArray if necessary, default: true.
qos QoS ROS Middleware "quality of service" settings for the publisher, default: QoS.profileDefault.
Source:
Returns:
- An instance of Publisher.
Type
Publisher

createService(typeClass, serviceName, options, callback) → {Service}

Create a Service.
Parameters:
Name Type Description
typeClass function | string | object The ROS message class, OR a string representing the message class, e.g. 'std_msgs/msg/String', OR an object representing the message class, e.g. {package: 'std_msgs', type: 'msg', name: 'String'}
serviceName string The service name to offer.
options object The options argument used to parameterize the service.
Properties
Name Type Description
enableTypedArray boolean The request will use TypedArray if necessary, default: true.
qos QoS ROS Middleware "quality of service" settings for the service, default: QoS.profileDefault.
callback RequestCallback The callback to be called when receiving request.
Source:
See:
Returns:
- An instance of Service.
Type
Service

createSubscription(typeClass, topic, options, callback) → {Subscription}

Create a Subscription.
Parameters:
Name Type Description
typeClass function | string | object The ROS message class, OR a string representing the message class, e.g. 'std_msgs/msg/String', OR an object representing the message class, e.g. {package: 'std_msgs', type: 'msg', name: 'String'}
topic string The name of the topic.
options object The options argument used to parameterize the subscription.
Properties
Name Type Description
enableTypedArray boolean The topic will use TypedArray if necessary, default: true.
qos QoS ROS Middleware "quality of service" settings for the subscription, default: QoS.profileDefault.
callback SubscriptionCallback The callback to be call when receiving the topic subscribed.
Source:
See:
Returns:
- An instance of Subscription.
Type
Subscription

createTimer(period, callback, context) → {Timer}

Create a Timer.
Parameters:
Name Type Description
period number The number representing period in millisecond.
callback function The callback to be called when timeout.
context Context The context, default is Context.defaultContext().
Source:
Returns:
- An instance of Timer.
Type
Timer

destroy() → {undefined}

Destroy all resource allocated by this node, including Timers/Publishers/Subscriptions /Clients/Services
Source:
Returns:
Type
undefined

destroyClient(client) → {undefined}

Destroy a Client.
Parameters:
Name Type Description
client Client The Client to be destroyed.
Source:
Returns:
Type
undefined

destroyGuardCondition(guard) → {undefined}

Destroy a guard condition.
Parameters:
Name Type Description
guard GuardCondition The guard condition to be destroyed.
Source:
Returns:
Type
undefined

destroyPublisher(publisher) → {undefined}

Destroy a Publisher.
Parameters:
Name Type Description
publisher Publisher The Publisher to be destroyed.
Source:
Returns:
Type
undefined

destroyService(service) → {undefined}

Destroy a Service.
Parameters:
Name Type Description
service Service The Service to be destroyed.
Source:
Returns:
Type
undefined

destroySubscription(subscription) → {undefined}

Destroy a Subscription.
Parameters:
Name Type Description
subscription Subscription The Subscription to be destroyed.
Source:
Returns:
Type
undefined

destroyTimer(timer) → {undefined}

Destroy a Timer.
Parameters:
Name Type Description
timer Timer The Timer to be destroyed.
Source:
Returns:
Type
undefined

getNodeNames() → {array}

Get the list of nodes discovered by the provided node.
Source:
Returns:
- An array of the names.
Type
array

getNodeNamesAndNamespaces() → {array}

Get the list of nodes and their namespaces discovered by the provided node.
Source:
Returns:
- An array of the names and namespaces.
Type
array

getPublisherNamesAndTypesByNode(nodeName, namespace, noDemangle) → {array}

Get the list of published topics discovered by the provided node for the remote node name.
Parameters:
Name Type Default Description
nodeName string The name of the node.
namespace string The name of the namespace.
noDemangle boolean false If true topic names and types returned will not be demangled, default: false.
Source:
Returns:
- An array of the names and types.
Type
array

getServiceNamesAndTypes() → {array}

Get the list of services discovered by the provided node.
Source:
Returns:
- An array of the names and types.
Type
array

getServiceNamesAndTypesByNode(nodeName, namespace) → {array}

Get the list of service topics discovered by the provided node for the remote node name.
Parameters:
Name Type Description
nodeName string The name of the node.
namespace string The name of the namespace.
Source:
Returns:
- An array of the names and types.
Type
array

getSubscriptionNamesAndTypesByNode(nodeName, namespace, noDemangle) → {array}

Get the list of published topics discovered by the provided node for the remote node name.
Parameters:
Name Type Default Description
nodeName string The name of the node.
namespace string The name of the namespace.
noDemangle boolean false If true topic names and types returned will not be demangled, default: false.
Source:
Returns:
- An array of the names and types.
Type
array

getTopicNamesAndTypes(noDemangle) → {array}

Get the list of topics discovered by the provided node.
Parameters:
Name Type Default Description
noDemangle boolean false If true topic names and types returned will not be demangled, default: false.
Source:
Returns:
- An array of the names and types.
Type
array