Constructor
class
new LifecycleNode(nodeName, namespaceopt, contextopt, optionsopt, enableCommunicationsInterfaceopt)
Create a managed Node that implements a well-defined life-cycle state
model using the ros2 client library (rcl) lifecyle api.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
nodeName |
string | The name used to register in ROS. | ||
namespace |
string |
<optional> |
'' | The namespace used in ROS. |
context |
Context |
<optional> |
Context.defaultContext() | The context to create the node in. |
options |
NodeOptions |
<optional> |
NodeOptions.defaultOptions | The options to configure the new node behavior. |
enableCommunicationsInterface |
boolean |
<optional> |
true | Enable lifecycle service interfaces, e.g., GetState. |
- Source:
Throws:
If the given context is not registered.
Type
Error
Extends
Members
member
availableStates
Retrieve all registered states of the state-machine.
- Source:
member
availableTransitions
Retrieve the valid transitions available from the current state of the
state-machine.
- Source:
member
context
Get the context in which this node was created.
- Overrides:
- Source:
member
currentState
Access the current lifecycle state.
- Source:
member
isInitialized
Check if state machine is initialized.
- Source:
member
spinning
Determine if this node is spinning.
- Overrides:
- Source:
member
transitions
Retrieve all registered transitions of the state-machine.
- Source:
Methods
function
_onGetAvailableTransitions(request, response) → {unknown}
The GetAvailableTransitions service handler.
Parameters:
| Name | Type | Description |
|---|---|---|
request |
Object | The GetAvailableTransitions service request |
response |
Object | The GetAvailableTranactions service response. |
- Source:
Returns:
void.
Type
unknown
function
_runWithMessageType(Type, callback) → {undefined}
Invokes the callback with a raw message of the given type. After the callback completes
the message will be destroyed.
Parameters:
| Name | Type | Description |
|---|---|---|
Type |
function | Message type to create. |
callback |
function | Callback to invoke. First parameter will be the raw message, and the second is a function to retrieve the deserialized message. |
- Overrides:
- Source:
Returns:
Type
undefined
function
_setParametersAtomically(parameters, declareParameterMode) → {SetParameterResult}
Internal method for updating parameters atomically.
Prior to setting the parameters each SetParameterEventCallback registered
using setOnParameterEventCallback() is called in succession with the parameters
list. Any SetParameterEventCallback that retuns does not return a successful
result will cause the entire operation to terminate with no changes to the
parameters. When all SetParameterEventCallbacks return successful then the
list of parameters is updated.
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. |
- Overrides:
- Source:
Returns:
- A single collective result.
Type
SetParameterResult
function
activate(callbackReturnValuenullable) → {State}
Initiate a transition from the INACTIVE state to the ACTIVE state.
If an onActivate callback has been registered it will be invoked.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
callbackReturnValue |
CallbackReturnValue |
<nullable> |
value holder for the CallbackReturnCode returned from the callback. |
- Source:
Throws:
If transition is invalid for the current state.
Type
Error
Returns:
The new state, should be ACTIVE.
Type
State
function
addOnSetParametersCallback(callback) → {undefined}
Add a callback to the front of the list of callbacks invoked for parameter declaration
and setting. No checks are made for duplicate callbacks.
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
SetParametersCallback | The callback to add. |
- Overrides:
- Source:
Returns:
Type
undefined
function
cleanup(callbackReturnValuenullable) → {State}
Initiate a transition from the INACTIVE state to the UNCONFIGURED state.
If an onCleanup callback has been registered it will be invoked.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
callbackReturnValue |
CallbackReturnValue |
<nullable> |
value holder for the CallbackReturnCode returned from the callback. |
- Source:
Throws:
If transition is invalid for the current state.
Type
Error
Returns:
The new state, should be INACTIVE.
Type
State
function
configure(callbackReturnValuenullable) → {State}
Initiate a transition from the UNCONFIGURED state to the INACTIVE state.
If an onConfigure callback has been registered it will be invoked.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
callbackReturnValue |
CallbackReturnValue |
<nullable> |
value holder for the CallbackReturnCode returned from the callback. |
- Source:
Throws:
If transition is invalid for the current state.
Type
Error
Returns:
The new state, should be INACTIVE.
Type
State
function
countClients(serviceName) → {Number}
Get the number of clients on a given service name.
Parameters:
| Name | Type | Description |
|---|---|---|
serviceName |
string | the service name |
- Overrides:
- Source:
Returns:
Type
Number
function
countPublishers(topic) → {number}
Return the number of publishers on a given topic.
Parameters:
| Name | Type | Description |
|---|---|---|
topic |
string | The name of the topic. |
- Overrides:
- Source:
Returns:
- Number of publishers on the given topic.
Type
number
function
countServices(serviceName) → {Number}
Get the number of services on a given service name.
Parameters:
| Name | Type | Description |
|---|---|---|
serviceName |
string | the service name |
- Overrides:
- Source:
Returns:
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. |
- Overrides:
- 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
|
- Overrides:
- 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. |
- Overrides:
- Source:
Returns:
- An instance of GuardCondition.
Type
GuardCondition
function
createLifecyclePublisher(typeClass, topic, options) → {LifecyclePublisher}
Create a LifecyclePublisher.
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
|
- Source:
Returns:
- An instance of LifecyclePublisher.
Type
LifecyclePublisher
function
createPublisher(typeClass, topic, options, eventCallbacks) → {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
|
|||||||||
eventCallbacks |
PublisherEventCallbacks | The event callbacks for the publisher. |
- Overrides:
- Source:
Returns:
- An instance of Publisher.
Type
Publisher
function
(async) createRate(hz) → {Promise.<Rate>}
Create a Rate.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
hz |
number | 1 | The frequency of the rate timer; default is 1 hz. |
- Overrides:
- Source:
Returns:
- Promise resolving to new instance of Rate.
Type
Promise.<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
|
|||||||||
callback |
RequestCallback | The callback to be called when receiving request. |
- Overrides:
- Source:
- See:
Returns:
- An instance of Service.
Type
Service
function
createSubscription(typeClass, topic, options, callback, eventCallbacks) → {Subscription}
Create a Subscription with optional content-filtering.
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
|
||||||||||||||||||||||||||||||||||||||||||
callback |
SubscriptionCallback | The callback to be call when receiving the topic subscribed. The topic will be an instance of null-terminated Buffer when options.isRaw is true. | ||||||||||||||||||||||||||||||||||||||||||
eventCallbacks |
SubscriptionEventCallbacks | The event callbacks for the subscription. |
- Overrides:
- Source:
- See:
Throws:
- May throw an RMW error if content-filter is malformed.
Type
ERROR
Returns:
- An instance of Subscription.
Type
Subscription
function
createTimer(period, callback, clockopt) → {Timer}
Create a Timer.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
period |
bigint | The number representing period in nanoseconds. | ||
callback |
function | The callback to be called when timeout. | ||
clock |
Clock |
<optional> |
null | The clock which the timer gets time from. |
- Overrides:
- Source:
Returns:
- An instance of Timer.
Type
Timer
function
deactivate(callbackReturnValuenullable) → {State}
Initiate a transition from the ACTIVE state to the INACTIVE state.
If an onDeactivate callback has been registered it will be invoked.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
callbackReturnValue |
CallbackReturnValue |
<nullable> |
value holder for the CallbackReturnCode returned from the callback. |
- Source:
Throws:
If transition is invalid for the current state.
Type
Error
Returns:
The new state, should be INACTIVE.
Type
State
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. |
- Overrides:
- 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.
Prior to declaring the parameters each SetParameterEventCallback registered
using setOnParameterEventCallback() is called in succession with the parameters
list. Any SetParameterEventCallback that retuns does not return a successful
result will cause the entire operation to terminate with no changes to the
parameters. When all SetParameterEventCallbacks return successful then the
list of parameters is updated.
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. |
- Overrides:
- Source:
Returns:
- The declared parameters.
Type
Array.<Parameter>
function
destroy() → {undefined}
Destroy all resource allocated by this node, including
Timers/Publishers/Subscriptions
/Clients/Services
- Overrides:
- Source:
Returns:
Type
undefined
function
destroyClient(client) → {undefined}
Destroy a Client.
Parameters:
| Name | Type | Description |
|---|---|---|
client |
Client | The Client to be destroyed. |
- Overrides:
- Source:
Returns:
Type
undefined
function
destroyGuardCondition(guard) → {undefined}
Destroy a guard condition.
Parameters:
| Name | Type | Description |
|---|---|---|
guard |
GuardCondition | The guard condition to be destroyed. |
- Overrides:
- Source:
Returns:
Type
undefined
function
destroyPublisher(publisher) → {undefined}
Destroy a Publisher.
Parameters:
| Name | Type | Description |
|---|---|---|
publisher |
Publisher | The Publisher to be destroyed. |
- Overrides:
- Source:
Returns:
Type
undefined
function
destroyService(service) → {undefined}
Destroy a Service.
Parameters:
| Name | Type | Description |
|---|---|---|
service |
Service | The Service to be destroyed. |
- Overrides:
- Source:
Returns:
Type
undefined
function
destroySubscription(subscription) → {undefined}
Destroy a Subscription.
Parameters:
| Name | Type | Description |
|---|---|---|
subscription |
Subscription | The Subscription to be destroyed. |
- Overrides:
- Source:
Returns:
Type
undefined
function
destroyTimer(timer) → {undefined}
Destroy a Timer.
Parameters:
| Name | Type | Description |
|---|---|---|
timer |
Timer | The Timer to be destroyed. |
- Overrides:
- Source:
Returns:
Type
undefined
function
getClientNamesAndTypesByNode(nodeName, namespace) → {Array.<{name: string, types: Array.<string>}>}
Get service names and types for which a remote node has clients.
Parameters:
| Name | Type | Description |
|---|---|---|
nodeName |
string | The name of the node. |
namespace |
string | The name of the namespace. |
- Overrides:
- Source:
Returns:
- An array of the names and types.
Type
Array.<{name: string, types: Array.<string>}>
function
getClock() → {Clock}
Get the clock used by the node.
- Overrides:
- Source:
Returns:
- The nodes clock.
Type
Clock
function
getFullyQualifiedName() → {string}
Get the fully qualified name of the node.
- Overrides:
- Source:
Returns:
- String containing the fully qualified name of the node.
Type
string
function
getLogger() → {Logger}
Get the nodes logger.
- Overrides:
- Source:
Returns:
- The logger for the node.
Type
Logger
function
getNodeNames() → {Array.<string>}
Get the list of nodes discovered by the provided node.
- Overrides:
- Source:
Returns:
- An array of the names.
Type
Array.<string>
function
getNodeNamesAndNamespaces() → {Array.<{name: string, namespace: string}>}
Get the list of nodes and their namespaces discovered by the provided node.
- Overrides:
- Source:
Returns:
An array of the names and namespaces.
Type
Array.<{name: string, namespace: string}>
function
getNodeNamesAndNamespacesWithEnclaves() → {Array.<{name: string, namespace: string, enclave: string}>}
Get the list of nodes and their namespaces with enclaves discovered by the provided node.
- Overrides:
- Source:
Returns:
An array of the names, namespaces and enclaves.
Type
Array.<{name: string, namespace: string, enclave: string}>
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. |
- Overrides:
- 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. |
- Overrides:
- Source:
Returns:
- The parameter descriptor.
Type
ParameterDescriptor
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. |
- Overrides:
- Source:
Returns:
- The parameter descriptors.
Type
Array.<ParameterDescriptor>
function
getParameterNames() → {Array.<string>}
Get the names of all declared parameters.
- Overrides:
- Source:
Returns:
- The declared parameter names or empty array if
no parameters have been declared.
Type
Array.<string>
function
getParameterOverrides() → {Array.<Parameter>}
Get the list of parameter-overrides found on the commandline and
in the NodeOptions.parameter_overrides property.
- Overrides:
- Source:
Returns:
- An array of Parameters.
Type
Array.<Parameter>
function
getParameterTypes(namesopt) → {Uint8Array}
Get the types of given parameters.
Return the types of given parameters.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
names |
Array.<string> |
<optional> |
The names of the declared parameters. |
- Overrides:
- Source:
Returns:
- The types.
Type
Uint8Array
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. |
- Overrides:
- Source:
Returns:
- The parameters.
Type
Array.<Parameter>
function
getPublisherNamesAndTypesByNode(nodeName, namespace, noDemangle) → {Array.<{name: string, types: Array.<string>}>}
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. |
- Overrides:
- Source:
Returns:
- An array of the names and types.
Type
Array.<{name: string, types: Array.<string>}>
function
getPublishersInfoByTopic(topic, noDemangleopt) → {Array}
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.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
topic |
string | The topic on which to find the publishers. | ||
noDemangle |
boolean |
<optional> |
false | If `true`, `topic` needs to be a valid middleware topic name, otherwise it should be a valid ROS topic name. Defaults to `false`. |
- Overrides:
- Source:
Returns:
- list of publishers
Type
Array
function
getRMWImplementationIdentifier() → {string}
Get the RMW implementation identifier
- Overrides:
- Source:
Returns:
- The RMW implementation identifier.
Type
string
function
getServiceNamesAndTypes() → {Array.<{name: string, types: Array.<string>}>}
Get the list of services discovered by the provided node.
- Overrides:
- Source:
Returns:
- An array of the names and types.
Type
Array.<{name: string, types: Array.<string>}>
function
getServiceNamesAndTypesByNode(nodeName, namespace) → {Array.<{name: string, types: Array.<string>}>}
Get service names and types for which a remote node has servers.
Parameters:
| Name | Type | Description |
|---|---|---|
nodeName |
string | The name of the node. |
namespace |
string | The name of the namespace. |
- Overrides:
- Source:
Returns:
- An array of the names and types.
Type
Array.<{name: string, types: Array.<string>}>
function
getSubscriptionNamesAndTypesByNode(nodeName, namespace, noDemangle) → {Array.<{name: string, types: Array.<string>}>}
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. |
- Overrides:
- Source:
Returns:
- An array of the names and types.
Type
Array.<{name: string, types: Array.<string>}>
function
getSubscriptionsInfoByTopic(topic, noDemangleopt) → {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.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
topic |
string | The topic on which to find the subscriptions. | ||
noDemangle |
boolean |
<optional> |
false | If `true`, `topic` needs to be a valid middleware topic name, otherwise it should be a valid ROS topic name. Defaults to `false`. |
- Overrides:
- Source:
Returns:
- list of subscriptions
Type
Array
function
getTopicNamesAndTypes(noDemangle) → {Array.<{name: string, types: Array.<string>}>}
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. |
- Overrides:
- Source:
Returns:
- An array of the names and types.
Type
Array.<{name: string, types: Array.<string>}>
function
hasParameter(name) → {boolean}
Determine if a parameter has been declared.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | name of parameter |
- Overrides:
- 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. |
- Overrides:
- Source:
Returns:
- true if a descriptor has been declared; otherwise false.
Type
boolean
function
name() → {string}
Get the name of the node.
- Overrides:
- Source:
Returns:
Type
string
function
namespace() → {string}
Get the namespace of the node.
- Overrides:
- Source:
Returns:
Type
string
function
now() → {Time}
Get the current time using the node's clock.
- Overrides:
- Source:
Returns:
- The current time.
Type
Time
function
print() → {undefined}
Log the state machine data.
- Source:
Returns:
void.
Type
undefined
function
registerOnActivate(cb) → {unknown}
Register a callback function to be invoked during the activate() action.
Parameters:
| Name | Type | Description |
|---|---|---|
cb |
TransitionCallback | The callback function to invoke. |
- Source:
Returns:
void.
Type
unknown
function
registerOnCleanup(cb) → {unknown}
Register a callback function to be invoked during the cleanup() action.
Parameters:
| Name | Type | Description |
|---|---|---|
cb |
TransitionCallback | The callback function to invoke. |
- Source:
Returns:
void.
Type
unknown
function
registerOnConfigure(cb) → {unknown}
Register a callback function to be invoked during the configure() action.
Parameters:
| Name | Type | Description |
|---|---|---|
cb |
TransitionCallback | The callback function to invoke. |
- Source:
Returns:
void.
Type
unknown
function
registerOnDeactivate(cb) → {unknown}
Register a callback function to be invoked during the deactivate() action.
Parameters:
| Name | Type | Description |
|---|---|---|
cb |
TransitionCallback | The callback function to invoke. |
- Source:
Returns:
void.
Type
unknown
function
registerOnError(cb) → {unknown}
Register a callback function to be invoked when an error occurs during a
state transition.
Parameters:
| Name | Type | Description |
|---|---|---|
cb |
TransitionCallback | The callback function to invoke. |
- Source:
Returns:
void.
Type
unknown
function
registerOnShutdown(cb) → {unknown}
Register a callback function to be invoked during the shutdown() action.
Parameters:
| Name | Type | Description |
|---|---|---|
cb |
TransitionCallback | The callback function to invoke. |
- Source:
Returns:
void
Type
unknown
function
removeOnSetParametersCallback(callback) → {undefined}
Remove a callback from the list of SetParametersCallbacks.
If the callback is not found the process is a nop.
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
SetParametersCallback | The callback to be removed |
- Overrides:
- Source:
Returns:
Type
undefined
function
resolveServiceName(service, onlyExpandopt) → {string}
Return a service name expanded and remapped.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
service |
string | Service name to be expanded and remapped. | ||
onlyExpand |
boolean |
<optional> |
false | If `true`, remapping rules won't be applied. |
- Overrides:
- Source:
Returns:
- A fully qualified service name.
Type
string
function
resolveTopicName(topicName, onlyExpandopt) → {string}
Return a topic name expanded and remapped.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
topicName |
string | Topic name to be expanded and remapped. | ||
onlyExpand |
boolean |
<optional> |
false | If `true`, remapping rules won't be applied. |
- Overrides:
- Source:
Returns:
- A fully qualified topic name.
Type
string
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. |
- Overrides:
- 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.
Prior to setting the parameters each SetParameterEventCallback registered
using setOnParameterEventCallback() is called in succession with the parameters
list. Any SetParameterEventCallback that retuns does not return a successful
result will cause the entire operation to terminate with no changes to the
parameters. When all SetParameterEventCallbacks return successful then the
list of parameters is updated.
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. |
- Overrides:
- 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.
Prior to setting the parameters each SetParameterEventCallback registered
using setOnParameterEventCallback() is called in succession with the parameters
list. Any SetParameterEventCallback that retuns does not return a successful
result will cause the entire operation to terminate with no changes to the
parameters. When all SetParameterEventCallbacks return successful then the
list of parameters is updated.d
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. |
- Overrides:
- Source:
Returns:
- describes the result of setting 1 or more parameters.
Type
rclnodejs.rcl_interfaces.msg.SetParameterResult
function
shutdown(callbackReturnValuenullable) → {State}
Initiate a transition to the FINALIZED state from any of the following
states: UNCONFIGURED, INACTIVE or ACTIVE state. If an onConfigure
callback has been registered it will be invoked.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
callbackReturnValue |
CallbackReturnValue |
<nullable> |
value holder for the CallbackReturnCode returned from the callback. |
- Source:
Throws:
If transition is invalid for the current state.
Type
Error
Returns:
The new state, should be FINALIZED.
Type
State
function
spin(node, timeoutopt) → {undefined}
Trigger the event loop to continuously check for and route.
incoming events.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
node |
Node | The node to be spun up. | ||
timeout |
number |
<optional> |
10 | Timeout to wait in milliseconds. Block forever if negative. Don't wait if 0. |
- Overrides:
- Source:
Throws:
If the node is already spinning.
Type
Error
Returns:
Type
undefined
function
spinOnce(node, timeoutopt) → {undefined}
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().
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
node |
Node | The node to be spun. | ||
timeout |
number |
<optional> |
10 | Timeout to wait in milliseconds. Block forever if negative. Don't wait if 0. |
- Overrides:
- Source:
Throws:
If the node is already spinning.
Type
Error
Returns:
Type
undefined
function
startSpinning()
Use spin().
- Overrides:
- Source:
function
stop() → {undefined}
Terminate spinning - no further events will be received.
- Overrides:
- Source:
Returns:
Type
undefined
function
stopSpinning() → {undefined}
Terminate spinning - no further events will be received.
- Overrides:
- Deprecated:
- since 0.18.0, Use stop().
- Source:
Returns:
Type
undefined
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. |
- Overrides:
- Source:
Returns:
-
Type
undefined