- Source:
Extends
Members
availableStates
Retrieve all registered states of the state-machine.
- Source:
availableTransitions
Retrieve the valid transitions available from the current state of the
state-machine.
- Source:
currentState
Access the current lifecycle state.
- Source:
transitions
Retrieve all registered transitions of the state-machine.
- Source:
Methods
_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
_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. |
- Inherited From:
- Source:
Returns:
- Type
- undefined
_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. |
- Inherited From:
- Source:
Returns:
- A single collective result.
- Type
- SetParameterResult
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
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. |
- Inherited From:
- Source:
Returns:
- Type
- undefined
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
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
countPublishers(topic) → {number}
Return the number of publishers on a given topic.
Parameters:
Name | Type | Description |
---|---|---|
topic |
string | The name of the topic. |
- Inherited From:
- 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. |
- Inherited From:
- 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
|
- Inherited From:
- 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. |
- Inherited From:
- Source:
Returns:
- An instance of GuardCondition.
- Type
- GuardCondition
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
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
|
- Inherited From:
- Source:
Returns:
- An instance of Publisher.
- Type
- Publisher
(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. |
- Inherited From:
- Source:
Returns:
- Promise resolving to new instance of Rate.
- Type
- Promise.<Rate>
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. |
- Inherited From:
- 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
|
||||||||||||
callback |
SubscriptionCallback | The callback to be call when receiving the topic subscribed. |
- Inherited From:
- Source:
- See:
Returns:
- An instance of Subscription.
- Type
- Subscription
createTimer(period, callback, clockopt) → {Timer}
Create a Timer.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
period |
number | The number representing period in millisecond. | ||
callback |
function | The callback to be called when timeout. | ||
clock |
Clock |
<optional> |
null | The clock which the timer gets time from. |
- Inherited From:
- Source:
Returns:
- An instance of Timer.
- Type
- Timer
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
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. |
- Inherited From:
- Source:
Returns:
- The newly declared parameter.
- Type
- Parameter
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. |
- Inherited From:
- Source:
Returns:
- The declared parameters.
- Type
- Array.<Parameter>
destroy() → {undefined}
Destroy all resource allocated by this node, including
Timer
s/Publisher
s/Subscription
s
/Client
s/Service
s
- Inherited From:
- Source:
Returns:
- Type
- undefined
destroyClient(client) → {undefined}
Destroy a Client.
Parameters:
Name | Type | Description |
---|---|---|
client |
Client | The Client to be destroyed. |
- Inherited From:
- Source:
Returns:
- Type
- undefined
destroyGuardCondition(guard) → {undefined}
Destroy a guard condition.
Parameters:
Name | Type | Description |
---|---|---|
guard |
GuardCondition | The guard condition to be destroyed. |
- Inherited From:
- Source:
Returns:
- Type
- undefined
destroyPublisher(publisher) → {undefined}
Destroy a Publisher.
Parameters:
Name | Type | Description |
---|---|---|
publisher |
Publisher | The Publisher to be destroyed. |
- Inherited From:
- Source:
Returns:
- Type
- undefined
destroyService(service) → {undefined}
Destroy a Service.
Parameters:
Name | Type | Description |
---|---|---|
service |
Service | The Service to be destroyed. |
- Inherited From:
- Source:
Returns:
- Type
- undefined
destroySubscription(subscription) → {undefined}
Destroy a Subscription.
Parameters:
Name | Type | Description |
---|---|---|
subscription |
Subscription | The Subscription to be destroyed. |
- Inherited From:
- Source:
Returns:
- Type
- undefined
destroyTimer(timer) → {undefined}
Destroy a Timer.
Parameters:
Name | Type | Description |
---|---|---|
timer |
Timer | The Timer to be destroyed. |
- Inherited From:
- Source:
Returns:
- Type
- undefined
getClock() → {Clock}
Get the clock used by the node.
- Inherited From:
- Source:
Returns:
- The nodes clock.
- Type
- Clock
getLogger() → {Logger}
Get the nodes logger.
- Inherited From:
- Source:
Returns:
- The logger for the node.
- Type
- Logger
getNodeNames() → {array}
Get the list of nodes discovered by the provided node.
- Inherited From:
- Source:
Returns:
- An array of the names.
- Type
- array
getNodeNamesAndNamespaces() → {array}
Get the list of nodes and their namespaces discovered by the provided node.
- Inherited From:
- Source:
Returns:
- An array of the names and namespaces.
- Type
- array
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. |
- Inherited From:
- Source:
Returns:
- The parameter.
- Type
- Parameter
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. |
- Inherited From:
- Source:
Returns:
- The parameter descriptor.
- Type
- ParameterDescriptor
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. |
- Inherited From:
- Source:
Returns:
- The parameter descriptors.
- Type
- Array.<ParameterDescriptor>
getParameterNames() → {Array.<string>}
Get the names of all declared parameters.
- Inherited From:
- Source:
Returns:
- The declared parameter names or empty array if
no parameters have been declared.
- Type
- Array.<string>
getParameterOverrides() → {array}
Get the list of parameter-overrides found on the commandline and
in the NodeOptions.parameter_overrides property.
- Inherited From:
- Source:
Returns:
- An array of Parameters
- Type
- array
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. |
- Inherited From:
- Source:
Returns:
- The parameters.
- Type
- Array.<Parameter>
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. |
- Inherited From:
- Source:
Returns:
- An array of the names and types.
- Type
- array
getServiceNamesAndTypes() → {array}
Get the list of services discovered by the provided node.
- Inherited From:
- 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. |
- Inherited From:
- 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. |
- Inherited From:
- 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. |
- Inherited From:
- Source:
Returns:
- An array of the names and types.
- Type
- array
hasParameter(name) → {boolean}
Determine if a parameter has been declared.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | name of parameter |
- Inherited From:
- Source:
Returns:
- Return true if parameter is declared; false otherwise.
- Type
- boolean
hasParameterDescriptor(name) → {boolean}
Determine if a parameter descriptor exists.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of a descriptor to for. |
- Inherited From:
- Source:
Returns:
- True if a descriptor has been declared; otherwise false.
- Type
- boolean
now() → {Time}
Get the current time using the node's clock.
- Inherited From:
- Source:
Returns:
- The current time.
- Type
- Time
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
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
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
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
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
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
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 |
- Inherited From:
- Source:
Returns:
- Type
- undefined
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. |
- Inherited From:
- Source:
Returns:
- The result of the operation.
- Type
- rclnodejs.rcl_interfaces.msg.SetParameterResult
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. |
- Inherited From:
- Source:
Returns:
- A list of SetParameterResult, one for each parameter that was set.
- Type
- Array.<rclnodejs.rcl_interfaces.msg.SetParameterResult>
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. |
- Inherited From:
- Source:
Returns:
- describes the result of setting 1 or more parameters.
- Type
- rclnodejs.rcl_interfaces.msg.SetParameterResult
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
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. |
- Inherited From:
- Source:
Returns:
-
- Type
- undefined