class

Node()

- Class representing a Node in ROS
Source:

Methods

function

_setParametersAtomically(parameters, declareParameterMode) → {SetParameterResult}

Internal method for updating parameters atomically.
Parameters:
Name Type Default Description
parameters Array.<Paramerter> The parameters to update.
declareParameterMode boolean false When true parameters are being declared; otherwise they are being changed.
Source:
Returns:
- A single collective result.
Type SetParameterResult
function

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
function

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
function

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
function

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.
function

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
function

createRate(hz) → {Rate}

Create a Rate.
Parameters:
Name Type Default Description
hz number 1 The frequency of the rate timer; default is 1 hz.
Source:
Returns:
- New instance
Type Rate
function

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
function

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.
function

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

Create a Timer.
Parameters:
Name Type Default 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().
clock Clock null The clock which the timer gets time from.
Source:
Returns:
- An instance of Timer.
Type Timer
function

declareParameter(parameter, descriptoropt, ignoreOverideopt) → {Parameter}

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.
Parameters:
Name Type Attributes Default Description
parameter Parameter Parameter to declare.
descriptor ParameterDescriptor <optional>
Optional descriptor for parameter.
ignoreOveride boolean <optional>
false When true disregard any parameter-override that may be present.
Source:
Returns:
- The newly declared parameter.
Type Parameter
function

declareParameters(parameters, descriptorsopt, ignoreOverrides) → {Array.<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.
Parameters:
Name Type Attributes Default Description
parameters Array.<Parameter> The parameters to declare.
descriptors Array.<ParameterDescriptor> <optional>
Optional descriptors, a 1-1 correspondence with parameters.
ignoreOverrides boolean false When true, parameter-overrides are not considered, i.e.,ignored.
Source:
Returns:
- The declared parameters.
Type Array.<Parameter>
function

destroy() → {undefined}

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

destroyClient(client) → {undefined}

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

destroyGuardCondition(guard) → {undefined}

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

destroyPublisher(publisher) → {undefined}

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

destroyService(service) → {undefined}

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

destroySubscription(subscription) → {undefined}

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

destroyTimer(timer) → {undefined}

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

getClock() → {Clock}

Get the clock used by the node.
Source:
Returns:
- The nodes clock.
Type Clock
function

getLogger() → {Logger}

Get the nodes logger.
Source:
Returns:
- The logger for the node.
Type Logger
function

getNodeNames() → {array}

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

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
function

getParameter(name) → {Parameter}

Get a declared parameter by name. If unable to locate a declared parameter then a parameter with type == PARAMETER_NOT_SET is returned.
Parameters:
Name Type Description
name string The name of the parameter.
Source:
Returns:
- The parameter.
Type Parameter
function

getParameterDescriptor(name) → {ParameterDescriptor}

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.
Parameters:
Name Type Description
name string The name of the parameter descriptor to find.
Source:
Returns:
- The parameter descriptor.
function

getParameterDescriptors(namesopt) → {Array.<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.
Parameters:
Name Type Attributes Description
names Array.<string> <optional>
The names of the declared parameter descriptors to find or null indicating to return all declared descriptors.
Source:
Returns:
- The parameter descriptors.
Type Array.<ParameterDescriptor>
function

getParameterNames() → {Array.<string>}

Get the names of all declared parameters.
Source:
Returns:
- The declared parameter names or empty array if no parameters have been declared.
Type Array.<string>
function

getParameterOverrides() → {array}

Get the list of parameter-overrides found on the commandline and in the NodeOptions.parameter_overrides property.
Source:
Returns:
- An array of Parameters
Type array
function

getParameters(namesopt) → {Array.<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.
Parameters:
Name Type Attributes Description
names Array.<string> <optional>
The names of the declared parameters to find or null indicating to return all declared parameters.
Source:
Returns:
- The parameters.
Type Array.<Parameter>
function

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
function

getServiceNamesAndTypes() → {array}

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

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
function

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
function

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
function

hasParameter(name) → {boolean}

Determine if a parameter has been declared.
Parameters:
Name Type Description
name string name of parameter
Source:
Returns:
- Return true if parameter is declared; false otherwise.
Type boolean
function

hasParameterDescriptor(name) → {boolean}

Determine if a parameter descriptor exists.
Parameters:
Name Type Description
name string The name of a descriptor to for.
Source:
Returns:
- True if a descriptor has been declared; otherwise false.
Type boolean
function

now() → {Time}

Get the current time using the node's clock.
Source:
Returns:
- The current time.
Type Time
function

setParameter(parameter) → {rclnodejs.rcl_interfaces.msg.SetParameterResult}

Replace a declared parameter. The parameter being replaced must be a declared parameter who's descriptor is not readOnly; otherwise an Error is thrown.
Parameters:
Name Type Description
parameter Parameter The new parameter.
Source:
Returns:
- The result of the operation.
Type rclnodejs.rcl_interfaces.msg.SetParameterResult
function

setParameters(parameters) → {Array.<rclnodejs.rcl_interfaces.msg.SetParameterResult>}

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.
Parameters:
Name Type Description
parameters Array.<Parameter> The parameters to set.
Source:
Returns:
- A list of SetParameterResult, one for each parameter that was set.
Type Array.<rclnodejs.rcl_interfaces.msg.SetParameterResult>
function

setParametersAtomically(parameters) → {rclnodejs.rcl_interfaces.msg.SetParameterResult}

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.
Parameters:
Name Type Description
parameters Array.<Parameter> The parameters to set.
Source:
Returns:
- describes the result of setting 1 or more parameters.
Type rclnodejs.rcl_interfaces.msg.SetParameterResult
function

undeclareParameter(name) → {undefined}

Undeclare a parameter. Readonly parameters can not be undeclared or updated.
Parameters:
Name Type Description
name string Name of parameter to undeclare.
Source:
Returns:
-
Type undefined