Members
(constant) CallbackReturnCode :number
The values returned by TransitionCallback.
Type:
- number
- Source:
(constant) CancelResponse :number
Possible cancel responses.
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
REJECT |
number | |
ACCEPT |
number |
- Source:
(constant) ClockType :number
Enum for ClockType
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
ROS_TIME |
number | |
SYSTEM_TIME |
number | |
STEADY_TIME |
number |
- Source:
(constant) DEFAULT_NUMERIC_RANGE_TOLERANCE :number
The plus/minus tolerance for determining number equivalence.
Type:
- number
- Source:
- See:
(constant) DistroId
enum style distribution identifiers
- Source:
(readonly) DurabilityPolicy :number
Enum for DurabilityPolicy
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
RMW_QOS_POLICY_DURABILITY_SYSTEM_DEFAULT |
number | |
RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL |
number | |
RMW_QOS_POLICY_DURABILITY_VOLATILE |
number |
- Source:
(constant) GoalResponse :number
Possible goal responses.
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
REJECT |
number | |
ACCEPT |
number |
- Source:
(readonly) HistoryPolicy :number
Enum for HistoryPolicy
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
RMW_QOS_POLICY_HISTORY_SYSTEM_DEFAULT |
number | |
RMW_QOS_POLICY_HISTORY_KEEP_LAST |
number | |
RMW_QOS_POLICY_HISTORY_KEEP_ALL |
number |
- Source:
(readonly) LoggingSeverity :number
Enum for LoggingSeverity
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
UNSET |
number | |
DEBUG |
number | |
INFO |
number | |
WARN |
number | |
ERROR |
number | |
FATAL |
number |
- Source:
(constant) ParameterType :number
Enum for ParameterType
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
PARAMETER_NOT_SET |
number | |
PARAMETER_BOOL |
number | |
PARAMETER_INTEGER |
number | |
PARAMETER_DOUBLE |
number | |
PARAMETER_STRING |
number | |
PARAMETER_BYTE_ARRAY |
number | |
PARAMETER_BOOL_ARRAY |
number | |
PARAMETER_INTEGER_ARRAY |
number | |
PARAMETER_DOUBLE_ARRAY |
number | |
PARAMETER_STRING_ARRAY |
number |
- Source:
(constant) PublisherEventType :number
Enumeration for PublisherEventCallbacks event types.
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
PUBLISHER_OFFERED_DEADLINE_MISSED |
number | |
PUBLISHER_LIVELINESS_LOST |
number | |
PUBLISHER_OFFERED_INCOMPATIBLE_QOS |
number | |
PUBLISHER_INCOMPATIBLE_TYPE |
number | |
PUBLISHER_MATCHED |
number |
- Source:
(readonly) ReliabilityPolicy :number
Enum for ReliabilityPolicy
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT |
number | |
RMW_QOS_POLICY_RELIABILITY_RELIABLE |
number | |
RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT |
number |
- Source:
(constant) ServiceIntrospectionStates :ServiceIntrospectionState
Enum for service introspection states.
Type:
Properties:
| Name | Type | Description |
|---|---|---|
OFF |
ServiceIntrospectionState | |
METADATA |
ServiceIntrospectionState | |
CONTENTS |
ServiceIntrospectionState |
- Source:
(constant) SubscriptionEventType :number
Enumeration for SubscriptionEventCallbacks event types.
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
SUBSCRIPTION_REQUESTED_DEADLINE_MISSED |
number | |
SUBSCRIPTION_LIVELINESS_CHANGED |
number | |
SUBSCRIPTION_REQUESTED_INCOMPATIBLE_QOS |
number | |
SUBSCRIPTION_MESSAGE_LOST |
number | |
SUBSCRIPTION_INCOMPATIBLE_TYPE |
number | |
SUBSCRIPTION_MATCHED |
number |
- Source:
Methods
applySerializationMode(message, serializationMode) → {*}
Apply serialization mode conversion to a message object
Parameters:
| Name | Type | Description |
|---|---|---|
message |
* | The message object to convert |
serializationMode |
string | The serialization mode ('default', 'plain', 'json') |
- Source:
Returns:
The converted message
- Type
- *
compareVersions(version1, version2, operator) → {boolean}
Compare two semantic version strings.
Supports version strings in the format: x.y.z or x.y.z.w
where x, y, z, w are integers.
Parameters:
| Name | Type | Description |
|---|---|---|
version1 |
string | First version string (e.g., '1.2.3') |
version2 |
string | Second version string (e.g., '1.2.4') |
operator |
string | Comparison operator: '<', '<=', '>', '>=', '==', '!=' |
- Source:
Returns:
Result of the comparison
- Type
- boolean
Example
compareVersions('1.2.3', '1.2.4', '<') // true
compareVersions('2.0.0', '1.9.9', '>') // true
compareVersions('1.2.3', '1.2.3', '==') // true
compareVersions('1.2.3', '1.2.3', '>=') // true
(async) copy(src, dest, options) → {Promise.<void>}
Copy file or directory recursively
Replaces: fse.copy()
Parameters:
| Name | Type | Description |
|---|---|---|
src |
string | Source path |
dest |
string | Destination path |
options |
object | Copy options |
- Source:
Returns:
- Type
- Promise.<void>
defaultCancelCallback() → {number}
No cancellations.
- Source:
Returns:
- Always responds with rejection
- Type
- number
defaultGoalCallback() → {number}
Accept all goals.
- Source:
Returns:
- Always responds with acceptance.
- Type
- number
defaultHandleAcceptedCallback(goalHandle) → {undefined}
Execute the goal.
Parameters:
| Name | Type | Description |
|---|---|---|
goalHandle |
ServerGoalHandle | The server goal handle. |
- Source:
Returns:
- Type
- undefined
detectUbuntuCodename() → {string|null}
Detect Ubuntu codename from /etc/os-release
- Source:
Returns:
Ubuntu codename (e.g., 'noble', 'jammy') or null if not detectable
- Type
- string | null
(async) emptyDir(dirPath) → {Promise.<void>}
Empty a directory (remove all contents but keep the directory)
Replaces: fse.emptyDir()
Parameters:
| Name | Type | Description |
|---|---|---|
dirPath |
string | Path to directory |
- Source:
Returns:
- Type
- Promise.<void>
(async) ensureDir(dirPath) → {Promise.<void>}
Ensure directory exists, create recursively if needed (async)
Replaces: fse.ensureDir() / fse.mkdirs()
Parameters:
| Name | Type | Description |
|---|---|---|
dirPath |
string | Path to directory |
- Source:
Returns:
- Type
- Promise.<void>
ensureDirSync(dirPath)
Ensure directory exists, create recursively if needed (sync)
Replaces: fse.mkdirSync()
Parameters:
| Name | Type | Description |
|---|---|---|
dirPath |
string | Path to directory |
- Source:
getActionClientNamesAndTypesByNode(node, nodeName, namespace) → {array}
Get a list of action names and types for action clients associated with a node.
Parameters:
| Name | Type | Description |
|---|---|---|
node |
Node | The node used for discovery. |
nodeName |
string | The name of a remote node to get action clients for. |
namespace |
string | Namespace of the remote node. |
- Source:
Returns:
- An array of the names and types.
- Type
- array
getActionNamesAndTypes(node) → {array}
Get a list of action names and types.
Parameters:
| Name | Type | Description |
|---|---|---|
node |
Node | The node used for discovery. |
- Source:
Returns:
- An array of the names and types.
- Type
- array
getActionServerNamesAndTypesByNode(node, nodeName, namespace) → {array}
Get a list of action names and types for action servers associated with a node.
Parameters:
| Name | Type | Description |
|---|---|---|
node |
Node | The node used for discovery. |
nodeName |
string | The name of a remote node to get action servers for. |
namespace |
string | Namespace of the remote node. |
- Source:
Returns:
- An array of the names and types.
- Type
- array
(async) getCurrentGeneratorVersion() → {Promise.<(string|null)>}
Get the version of the generator that was used for the currently present interfaces.
Throws:
-
if there was an error reading the *generator.json* file (except for it being absent)
- Type
- Error
Returns:
The current version or null if the *generator.json* file was not found
- Type
- Promise.<(string|null)>
isClose(a, b, rtolopt, atolopt) → {boolean}
Check if two numbers are equal within a given tolerance.
This function compares two numbers using both relative and absolute tolerance,
matching the behavior of the 'is-close' npm package.
The comparison uses the formula:
abs(a - b) <= max(rtol * max(abs(a), abs(b)), atol)
Implementation checks:
1. Absolute tolerance: abs(a - b) <= atol
2. Relative tolerance: abs(a - b) / max(abs(a), abs(b)) <= rtol
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
a |
number | The first number to compare | ||
b |
number | The second number to compare | ||
rtol |
number |
<optional> |
1e-9 | The relative tolerance parameter (default: 1e-9) |
atol |
number |
<optional> |
0.0 | The absolute tolerance parameter (default: 0.0) |
- Source:
Returns:
True if the numbers are close within the tolerance
- Type
- boolean
Example
isClose(1.0, 1.0) // true - exact equality
isClose(1.0, 1.1, 0.01) // false - relative diff: 0.1/1.1 ≈ 0.091 > 0.01
isClose(10, 10.00001, 1e-6) // true - relative diff: 0.00001/10 = 1e-6 <= 1e-6
isClose(0, 0.05, 0, 0.1) // true - absolute diff: 0.05 <= 0.1 (atol)
isTypedArray(value) → {boolean}
Check if a value is a TypedArray
Parameters:
| Name | Type | Description |
|---|---|---|
value |
* | The value to check |
- Source:
Returns:
True if the value is a TypedArray
- Type
- boolean
isValidSerializationMode(mode) → {boolean}
Validate serialization mode
Parameters:
| Name | Type | Description |
|---|---|---|
mode |
string | The serialization mode to validate |
- Source:
Returns:
True if valid
- Type
- boolean
(async) mkdir(dirPath, options) → {Promise.<void>}
Create directory (async)
Replaces: fse.mkdir()
Parameters:
| Name | Type | Description |
|---|---|---|
dirPath |
string | Path to directory |
options |
object | mkdir options |
- Source:
Returns:
- Type
- Promise.<void>
needsJSONConversion(value) → {boolean}
Check if a value needs JSON conversion (BigInt, functions, etc.)
Parameters:
| Name | Type | Description |
|---|---|---|
value |
* | The value to check |
- Source:
Returns:
True if the value needs special JSON handling
- Type
- boolean
parameterTypeFromValue(value) → {ParameterType}
Infer a ParameterType for JS primitive types:
string, boolean, number and arrays of these types.
A TypeError is thrown for a value who's type is not one of
the set listed.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
any | The value to infer it's ParameterType |
- Source:
Returns:
- The ParameterType that best scribes the value.
- Type
- ParameterType
(async) pathExists(filePath) → {Promise.<boolean>}
Check if path exists (async)
Replaces: fse.exists()
Parameters:
| Name | Type | Description |
|---|---|---|
filePath |
string | Path to check |
- Source:
Returns:
- Type
- Promise.<boolean>
readJsonSync(filePath, options) → {any}
Read and parse JSON file synchronously
Replaces: fse.readJsonSync()
Parameters:
| Name | Type | Description |
|---|---|---|
filePath |
string | Path to JSON file |
options |
object | Read options |
- Source:
Returns:
Parsed JSON data
- Type
- any
(async) remove(filePath) → {Promise.<void>}
Remove file or directory (async)
Replaces: fse.remove()
Parameters:
| Name | Type | Description |
|---|---|---|
filePath |
string | Path to remove |
- Source:
Returns:
- Type
- Promise.<void>
removeSync(filePath)
Remove file or directory (sync)
Replaces: fse.removeSync()
Parameters:
| Name | Type | Description |
|---|---|---|
filePath |
string | Path to remove |
- Source:
ros2Launch(packageName, launchFile, argsopt) → {Promise.<{process: ChildProcess}>}
Run a ROS2 launch file using 'ros2 launch' command.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
packageName |
string | The name of the ROS2 package. | ||
launchFile |
string | The name of the launch file to run. | ||
args |
Array.<string> |
<optional> |
[] | Additional arguments to pass to the launch file. |
Returns:
A Promise that resolves with the process.
- Type
- Promise.<{process: ChildProcess}>
ros2Run(packageName, executableName, argsopt) → {Promise.<{process: ChildProcess}>}
Run a ROS2 package executable using 'ros2 run' command.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
packageName |
string | The name of the ROS2 package. | ||
executableName |
string | The name of the executable to run. | ||
args |
Array.<string> |
<optional> |
[] | Additional arguments to pass to the executable. |
Returns:
A Promise that resolves with the process.
- Type
- Promise.<{process: ChildProcess}>
toJSONSafe(obj) → {*}
Convert a message to be fully JSON-safe
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
* | The object to convert |
- Source:
Returns:
The JSON-safe converted object
- Type
- *
toJSONString(obj, spaceopt) → {string}
Convert a message to a JSON string
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
obj |
* | The object to convert | |
space |
number |
<optional> |
Space parameter for JSON.stringify formatting |
- Source:
Returns:
The JSON string representation
- Type
- string
toPlainArrays(obj) → {*}
Convert a message to plain arrays (TypedArray -> regular Array)
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
* | The object to convert |
- Source:
Returns:
The converted object with plain arrays
- Type
- *
validType(parameterType) → {boolean}
Determine if a number maps to is a valid ParameterType.
Parameters:
| Name | Type | Description |
|---|---|---|
parameterType |
ParameterType | The value to test. |
- Source:
Returns:
- True if value is a valid ParameterType; false otherwise.
- Type
- boolean
validValue(value, type) → {boolean}
Test if value can be represented by a ParameterType.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | The value to test. |
type |
ParameterType | The ParameterType to test value against. |
- Source:
Returns:
- True if value can be represented by type.
- Type
- boolean
(async) writeFile(filePath, data, options) → {Promise.<void>}
Write file with content (async)
Replaces: fse.writeFile()
Parameters:
| Name | Type | Description |
|---|---|---|
filePath |
string | Path to file |
data |
string | Buffer | Content to write |
options |
object | Write options |
- Source:
Returns:
- Type
- Promise.<void>
Type Definitions
RequestCallback(request, response) → {undefined}
This callback is called when a request is sent to service
Parameters:
| Name | Type | Description |
|---|---|---|
request |
Object | The request sent to the service |
response |
Response | The response to client. Use response.send() to send response object to client |
- Source:
- See:
Returns:
- Type
- undefined
ResponseCallback(response)
This callback is called when a resopnse is sent back from service
Parameters:
| Name | Type | Description |
|---|---|---|
response |
Object | The response sent from the service |
- Source:
- See:
SerializedState
Type:
- object
Properties:
| Name | Type | Description |
|---|---|---|
id |
number | code identifying the type of this state. |
label |
string | readable name of this state. |
- Source:
ServiceIntrospectionState
Type:
- number
- Source:
SetParametersCallback(parameters) → {rcl_interfaces.msg.SetParameterResult}
This callback is called when declaring a parameter or setting a parameter.
The callback is provided a list of parameters and returns a SetParameterResult
to indicate approval or veto of the operation.
Parameters:
| Name | Type | Description |
|---|---|---|
parameters |
Array.<Parameter> | The message published |
- Source:
- See:
Returns:
-
- Type
- rcl_interfaces.msg.SetParameterResult
SubscriptionCallback(message)
This callback is called when a message is published
Parameters:
| Name | Type | Description |
|---|---|---|
message |
Object | The message published |
- Source:
- See:
TransitionCallback(previousState) → {CallbackReturnCode}
This callback is invoked when LifecycleNode is transitioning to a new state.
Parameters:
| Name | Type | Description |
|---|---|---|
previousState |
State | The previous node lifecycle state. |
- Source:
- See:
Returns:
- The result of the callback.
- Type
- CallbackReturnCode