rclnodejs 1.5.2 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +79 -3
- package/lib/action/client.js +55 -9
- package/lib/action/deferred.js +8 -2
- package/lib/action/server.js +10 -1
- package/lib/action/uuid.js +4 -1
- package/lib/client.js +152 -3
- package/lib/clock.js +4 -1
- package/lib/context.js +12 -2
- package/lib/duration.js +37 -12
- package/lib/errors.js +571 -0
- package/lib/event_handler.js +21 -4
- package/lib/interface_loader.js +52 -12
- package/lib/lifecycle.js +8 -2
- package/lib/logging.js +12 -3
- package/lib/message_serialization.js +179 -0
- package/lib/native_loader.js +9 -4
- package/lib/node.js +283 -47
- package/lib/parameter.js +176 -45
- package/lib/parameter_client.js +506 -0
- package/lib/parameter_watcher.js +309 -0
- package/lib/qos.js +22 -5
- package/lib/rate.js +6 -1
- package/lib/serialization.js +7 -2
- package/lib/subscription.js +16 -1
- package/lib/time.js +136 -21
- package/lib/time_source.js +13 -4
- package/lib/utils.js +313 -0
- package/lib/validator.js +11 -12
- package/package.json +2 -7
- package/prebuilds/linux-arm64/humble-jammy-arm64-rclnodejs.node +0 -0
- package/prebuilds/linux-arm64/jazzy-noble-arm64-rclnodejs.node +0 -0
- package/prebuilds/linux-arm64/kilted-noble-arm64-rclnodejs.node +0 -0
- package/prebuilds/linux-x64/humble-jammy-x64-rclnodejs.node +0 -0
- package/prebuilds/linux-x64/jazzy-noble-x64-rclnodejs.node +0 -0
- package/prebuilds/linux-x64/kilted-noble-x64-rclnodejs.node +0 -0
- package/rosidl_convertor/idl_convertor.js +3 -2
- package/rosidl_gen/generate_worker.js +1 -1
- package/rosidl_gen/idl_generator.js +11 -24
- package/rosidl_gen/index.js +1 -1
- package/rosidl_gen/templates/action-template.js +68 -0
- package/rosidl_gen/templates/message-template.js +1113 -0
- package/rosidl_gen/templates/service-event-template.js +31 -0
- package/rosidl_gen/templates/service-template.js +44 -0
- package/rosidl_parser/rosidl_parser.js +2 -2
- package/third_party/ref-napi/lib/ref.js +0 -45
- package/types/base.d.ts +3 -0
- package/types/client.d.ts +36 -0
- package/types/errors.d.ts +447 -0
- package/types/index.d.ts +17 -0
- package/types/interfaces.d.ts +1910 -1
- package/types/node.d.ts +56 -1
- package/types/parameter_client.d.ts +252 -0
- package/types/parameter_watcher.d.ts +104 -0
- package/rosidl_gen/templates/CMakeLists.dot +0 -40
- package/rosidl_gen/templates/action.dot +0 -50
- package/rosidl_gen/templates/message.dot +0 -851
- package/rosidl_gen/templates/package.dot +0 -16
- package/rosidl_gen/templates/service.dot +0 -26
- package/rosidl_gen/templates/service_event.dot +0 -10
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright (c) 2025, The Robot Web Tools Contributors
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
function generateServiceEvent(data) {
|
|
16
|
+
const serviceInfo = data.serviceInfo;
|
|
17
|
+
|
|
18
|
+
return `# This file is automatically generated by rosidl_gen
|
|
19
|
+
#
|
|
20
|
+
# *** DO NOT EDIT directly
|
|
21
|
+
#
|
|
22
|
+
|
|
23
|
+
service_msgs/ServiceEventInfo info
|
|
24
|
+
|
|
25
|
+
${serviceInfo.pkgName}/${serviceInfo.interfaceName}_Request[<=1] request
|
|
26
|
+
|
|
27
|
+
${serviceInfo.pkgName}/${serviceInfo.interfaceName}_Response[<=1] response
|
|
28
|
+
`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = generateServiceEvent;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) 2025, The Robot Web Tools Contributors
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
function generateService(data) {
|
|
16
|
+
const serviceInfo = data.serviceInfo;
|
|
17
|
+
const className = `${serviceInfo.pkgName}__${serviceInfo.subFolder}__${serviceInfo.interfaceName}`;
|
|
18
|
+
|
|
19
|
+
return `// This file is automatically generated by rclnodejs
|
|
20
|
+
//
|
|
21
|
+
// *** DO NOT EDIT directly
|
|
22
|
+
//
|
|
23
|
+
|
|
24
|
+
'use strict';
|
|
25
|
+
|
|
26
|
+
class ${className} {
|
|
27
|
+
static get Request() {
|
|
28
|
+
return require('./${className}_Request.js');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static get Response() {
|
|
32
|
+
return require('./${className}_Response.js');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static type() {
|
|
36
|
+
return {pkgName: '${serviceInfo.pkgName}', subFolder: '${serviceInfo.subFolder}', interfaceName: '${serviceInfo.interfaceName}'};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = ${className};
|
|
41
|
+
`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = generateService;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
'use strict';
|
|
16
16
|
|
|
17
|
-
const compareVersions = require('
|
|
17
|
+
const { compareVersions } = require('../lib/utils.js');
|
|
18
18
|
const path = require('path');
|
|
19
19
|
const execFile = require('child_process').execFile;
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ const pythonExecutable = require('./py_utils').getPythonExecutable('python3');
|
|
|
22
22
|
|
|
23
23
|
const contextSupportedVersion = '21.0.0.0';
|
|
24
24
|
const currentVersion = process.version;
|
|
25
|
-
const isContextSupported = compareVersions
|
|
25
|
+
const isContextSupported = compareVersions(
|
|
26
26
|
currentVersion.substring(1, currentVersion.length),
|
|
27
27
|
contextSupportedVersion,
|
|
28
28
|
'>='
|
|
@@ -1471,51 +1471,6 @@ if (Buffer.prototype[inspectSym]) {
|
|
|
1471
1471
|
Buffer.prototype[inspectSym] = overwriteInspect(Buffer.prototype[inspectSym]);
|
|
1472
1472
|
}
|
|
1473
1473
|
|
|
1474
|
-
// does SlowBuffer inherit from Buffer? (node >= v0.7.9)
|
|
1475
|
-
if (!(exports.NULL instanceof Buffer)) {
|
|
1476
|
-
debug(
|
|
1477
|
-
"extending SlowBuffer's prototype since it doesn't inherit from Buffer.prototype"
|
|
1478
|
-
);
|
|
1479
|
-
|
|
1480
|
-
/*!
|
|
1481
|
-
* SlowBuffer convenience methods.
|
|
1482
|
-
*/
|
|
1483
|
-
|
|
1484
|
-
var SlowBuffer = require('buffer').SlowBuffer;
|
|
1485
|
-
|
|
1486
|
-
SlowBuffer.prototype.address = Buffer.prototype.address;
|
|
1487
|
-
SlowBuffer.prototype.hexAddress = Buffer.prototype.hexAddress;
|
|
1488
|
-
SlowBuffer.prototype.isNull = Buffer.prototype.isNull;
|
|
1489
|
-
SlowBuffer.prototype.ref = Buffer.prototype.ref;
|
|
1490
|
-
SlowBuffer.prototype.deref = Buffer.prototype.deref;
|
|
1491
|
-
SlowBuffer.prototype.readObject = Buffer.prototype.readObject;
|
|
1492
|
-
SlowBuffer.prototype.writeObject = Buffer.prototype.writeObject;
|
|
1493
|
-
SlowBuffer.prototype.readPointer = Buffer.prototype.readPointer;
|
|
1494
|
-
SlowBuffer.prototype.writePointer = Buffer.prototype.writePointer;
|
|
1495
|
-
SlowBuffer.prototype.readCString = Buffer.prototype.readCString;
|
|
1496
|
-
SlowBuffer.prototype.writeCString = Buffer.prototype.writeCString;
|
|
1497
|
-
SlowBuffer.prototype.reinterpret = Buffer.prototype.reinterpret;
|
|
1498
|
-
SlowBuffer.prototype.reinterpretUntilZeros =
|
|
1499
|
-
Buffer.prototype.reinterpretUntilZeros;
|
|
1500
|
-
SlowBuffer.prototype.readInt64BE = Buffer.prototype.readInt64BE;
|
|
1501
|
-
SlowBuffer.prototype.writeInt64BE = Buffer.prototype.writeInt64BE;
|
|
1502
|
-
SlowBuffer.prototype.readUInt64BE = Buffer.prototype.readUInt64BE;
|
|
1503
|
-
SlowBuffer.prototype.writeUInt64BE = Buffer.prototype.writeUInt64BE;
|
|
1504
|
-
SlowBuffer.prototype.readInt64LE = Buffer.prototype.readInt64LE;
|
|
1505
|
-
SlowBuffer.prototype.writeInt64LE = Buffer.prototype.writeInt64LE;
|
|
1506
|
-
SlowBuffer.prototype.readUInt64LE = Buffer.prototype.readUInt64LE;
|
|
1507
|
-
SlowBuffer.prototype.writeUInt64LE = Buffer.prototype.writeUInt64LE;
|
|
1508
|
-
/**
|
|
1509
|
-
* in node 6.9.1, inspect.custom does not give a correct value; so in this case, don't torch the whole process.
|
|
1510
|
-
* fixed in >6.9.2
|
|
1511
|
-
*/
|
|
1512
|
-
if (SlowBuffer.prototype[inspectSym]) {
|
|
1513
|
-
SlowBuffer.prototype[inspectSym] = overwriteInspect(
|
|
1514
|
-
SlowBuffer.prototype[inspectSym]
|
|
1515
|
-
);
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
1474
|
/**
|
|
1520
1475
|
* ...
|
|
1521
1476
|
*/
|
package/types/base.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
/// <reference path="./distro.d.ts" />
|
|
9
9
|
/// <reference path="./duration.d.ts" />
|
|
10
10
|
/// <reference path="./entity.d.ts" />
|
|
11
|
+
/// <reference path="./errors.d.ts" />
|
|
11
12
|
/// <reference path="./guard_condition.d.ts" />
|
|
12
13
|
/// <reference path="./interfaces.d.ts" />
|
|
13
14
|
/// <reference path="./lifecycle.d.ts" />
|
|
@@ -16,6 +17,8 @@
|
|
|
16
17
|
/// <reference path="./node.d.ts" />
|
|
17
18
|
/// <reference path="./node_options.d.ts" />
|
|
18
19
|
/// <reference path="./parameter.d.ts" />
|
|
20
|
+
/// <reference path="./parameter_client.d.ts" />
|
|
21
|
+
/// <reference path="./parameter_watcher.d.ts" />
|
|
19
22
|
/// <reference path="./publisher.d.ts" />
|
|
20
23
|
/// <reference path="./qos.d.ts" />
|
|
21
24
|
/// <reference path="./rate.d.ts" />
|
package/types/client.d.ts
CHANGED
|
@@ -14,6 +14,21 @@ declare module 'rclnodejs' {
|
|
|
14
14
|
callback: Client.ResponseCallback<T>
|
|
15
15
|
): void;
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Make a service request and return a Promise that resolves with the response.
|
|
19
|
+
*
|
|
20
|
+
* @param request - Request to be submitted.
|
|
21
|
+
* @param options - Optional parameters for the request.
|
|
22
|
+
* @returns Promise that resolves with the service response.
|
|
23
|
+
* @throws TimeoutError if the request times out (when options.timeout is exceeded).
|
|
24
|
+
* @throws AbortError if the request is manually aborted (via options.signal).
|
|
25
|
+
* @throws Error if the request fails for other reasons.
|
|
26
|
+
*/
|
|
27
|
+
sendRequestAsync(
|
|
28
|
+
request: ServiceRequestMessage<T>,
|
|
29
|
+
options?: Client.AsyncRequestOptions
|
|
30
|
+
): Promise<ServiceResponseMessage<T>>;
|
|
31
|
+
|
|
17
32
|
/**
|
|
18
33
|
* Checks if the service is ready.
|
|
19
34
|
*
|
|
@@ -74,5 +89,26 @@ declare module 'rclnodejs' {
|
|
|
74
89
|
export type ResponseCallback<T extends TypeClass<ServiceTypeClassName>> = (
|
|
75
90
|
response: ServiceResponseMessage<T>
|
|
76
91
|
) => void;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Options for async service requests
|
|
95
|
+
*/
|
|
96
|
+
export interface AsyncRequestOptions {
|
|
97
|
+
/**
|
|
98
|
+
* Timeout in milliseconds for the request.
|
|
99
|
+
* Internally uses AbortSignal.timeout() for standards compliance.
|
|
100
|
+
*/
|
|
101
|
+
timeout?: number;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* AbortSignal to cancel the request.
|
|
105
|
+
* When the signal is aborted, the request will be cancelled
|
|
106
|
+
* and the promise will reject with an AbortError.
|
|
107
|
+
*
|
|
108
|
+
* Can be combined with timeout parameter - whichever happens first
|
|
109
|
+
* will abort the request.
|
|
110
|
+
*/
|
|
111
|
+
signal?: AbortSignal;
|
|
112
|
+
}
|
|
77
113
|
}
|
|
78
114
|
}
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
// Copyright (c) 2025 Mahmoud Alghalayini. All rights reserved.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
declare module 'rclnodejs' {
|
|
16
|
+
/**
|
|
17
|
+
* Options for RclNodeError constructor
|
|
18
|
+
*/
|
|
19
|
+
export interface RclNodeErrorOptions {
|
|
20
|
+
/** Machine-readable error code (e.g., 'TIMEOUT', 'INVALID_ARGUMENT') */
|
|
21
|
+
code?: string;
|
|
22
|
+
/** Name of the node where error occurred */
|
|
23
|
+
nodeName?: string;
|
|
24
|
+
/** Type of entity (publisher, subscription, client, etc.) */
|
|
25
|
+
entityType?: string;
|
|
26
|
+
/** Name of the entity (topic name, service name, etc.) */
|
|
27
|
+
entityName?: string;
|
|
28
|
+
/** Original error that caused this error */
|
|
29
|
+
cause?: Error;
|
|
30
|
+
/** Additional error-specific details */
|
|
31
|
+
details?: any;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Base error class for all rclnodejs errors.
|
|
36
|
+
* Provides structured error information with context.
|
|
37
|
+
*/
|
|
38
|
+
export class RclNodeError extends Error {
|
|
39
|
+
/** Error code for machine-readable error identification */
|
|
40
|
+
code: string;
|
|
41
|
+
/** Name of the node where error occurred */
|
|
42
|
+
nodeName?: string;
|
|
43
|
+
/** Type of entity (publisher, subscription, client, etc.) */
|
|
44
|
+
entityType?: string;
|
|
45
|
+
/** Name of the entity (topic name, service name, etc.) */
|
|
46
|
+
entityName?: string;
|
|
47
|
+
/** Additional error-specific details */
|
|
48
|
+
details?: any;
|
|
49
|
+
/** Original error that caused this error */
|
|
50
|
+
cause?: Error;
|
|
51
|
+
/** Timestamp when error was created */
|
|
52
|
+
timestamp: Date;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @param message - Human-readable error message
|
|
56
|
+
* @param options - Additional error context
|
|
57
|
+
*/
|
|
58
|
+
constructor(message: string, options?: RclNodeErrorOptions);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Returns a detailed error object for logging/serialization
|
|
62
|
+
*/
|
|
63
|
+
toJSON(): {
|
|
64
|
+
name: string;
|
|
65
|
+
message: string;
|
|
66
|
+
code: string;
|
|
67
|
+
nodeName?: string;
|
|
68
|
+
entityType?: string;
|
|
69
|
+
entityName?: string;
|
|
70
|
+
details?: any;
|
|
71
|
+
timestamp: string;
|
|
72
|
+
stack?: string;
|
|
73
|
+
cause?: any;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Returns a user-friendly error description
|
|
78
|
+
*/
|
|
79
|
+
toString(): string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Options for ValidationError constructor
|
|
84
|
+
*/
|
|
85
|
+
export interface ValidationErrorOptions extends RclNodeErrorOptions {
|
|
86
|
+
/** Name of the argument that failed validation */
|
|
87
|
+
argumentName?: string;
|
|
88
|
+
/** The value that was provided */
|
|
89
|
+
providedValue?: any;
|
|
90
|
+
/** The expected type or format */
|
|
91
|
+
expectedType?: string;
|
|
92
|
+
/** The validation rule that failed */
|
|
93
|
+
validationRule?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Error thrown when validation fails
|
|
98
|
+
*/
|
|
99
|
+
export class ValidationError extends RclNodeError {
|
|
100
|
+
/** Name of the argument that failed validation */
|
|
101
|
+
argumentName?: string;
|
|
102
|
+
/** The value that was provided */
|
|
103
|
+
providedValue?: any;
|
|
104
|
+
/** The expected type or format */
|
|
105
|
+
expectedType?: string;
|
|
106
|
+
/** The validation rule that failed */
|
|
107
|
+
validationRule?: string;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @param message - Error message
|
|
111
|
+
* @param options - Additional options
|
|
112
|
+
*/
|
|
113
|
+
constructor(message: string, options?: ValidationErrorOptions);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Type validation error
|
|
118
|
+
*/
|
|
119
|
+
export class TypeValidationError extends ValidationError {
|
|
120
|
+
/**
|
|
121
|
+
* @param argumentName - Name of the argument
|
|
122
|
+
* @param providedValue - The value that was provided
|
|
123
|
+
* @param expectedType - The expected type
|
|
124
|
+
* @param options - Additional options
|
|
125
|
+
*/
|
|
126
|
+
constructor(
|
|
127
|
+
argumentName: string,
|
|
128
|
+
providedValue: any,
|
|
129
|
+
expectedType: string,
|
|
130
|
+
options?: RclNodeErrorOptions
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Range/value validation error
|
|
136
|
+
*/
|
|
137
|
+
export class RangeValidationError extends ValidationError {
|
|
138
|
+
/**
|
|
139
|
+
* @param argumentName - Name of the argument
|
|
140
|
+
* @param providedValue - The value that was provided
|
|
141
|
+
* @param constraint - The constraint that was violated
|
|
142
|
+
* @param options - Additional options
|
|
143
|
+
*/
|
|
144
|
+
constructor(
|
|
145
|
+
argumentName: string,
|
|
146
|
+
providedValue: any,
|
|
147
|
+
constraint: string,
|
|
148
|
+
options?: RclNodeErrorOptions
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* ROS name validation error (topics, nodes, services)
|
|
154
|
+
*/
|
|
155
|
+
export class NameValidationError extends ValidationError {
|
|
156
|
+
/** Index where validation failed */
|
|
157
|
+
invalidIndex: number;
|
|
158
|
+
/** The validation error message */
|
|
159
|
+
validationResult: string;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @param name - The invalid name
|
|
163
|
+
* @param nameType - Type of name (node, topic, service, etc.)
|
|
164
|
+
* @param validationResult - The validation error message
|
|
165
|
+
* @param invalidIndex - Index where validation failed
|
|
166
|
+
* @param options - Additional options
|
|
167
|
+
*/
|
|
168
|
+
constructor(
|
|
169
|
+
name: string,
|
|
170
|
+
nameType: string,
|
|
171
|
+
validationResult: string,
|
|
172
|
+
invalidIndex: number,
|
|
173
|
+
options?: RclNodeErrorOptions
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Base class for operation/runtime errors
|
|
179
|
+
*/
|
|
180
|
+
export class OperationError extends RclNodeError {
|
|
181
|
+
/**
|
|
182
|
+
* @param message - Error message
|
|
183
|
+
* @param options - Additional options
|
|
184
|
+
*/
|
|
185
|
+
constructor(message: string, options?: RclNodeErrorOptions);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Request timeout error
|
|
190
|
+
*/
|
|
191
|
+
export class TimeoutError extends OperationError {
|
|
192
|
+
/** Timeout duration in milliseconds */
|
|
193
|
+
timeout: number;
|
|
194
|
+
/** Type of operation that timed out */
|
|
195
|
+
operationType: string;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @param operationType - Type of operation that timed out
|
|
199
|
+
* @param timeoutMs - Timeout duration in milliseconds
|
|
200
|
+
* @param options - Additional options
|
|
201
|
+
*/
|
|
202
|
+
constructor(
|
|
203
|
+
operationType: string,
|
|
204
|
+
timeoutMs: number,
|
|
205
|
+
options?: RclNodeErrorOptions
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Request abortion error
|
|
211
|
+
*/
|
|
212
|
+
export class AbortError extends OperationError {
|
|
213
|
+
/** Type of operation that was aborted */
|
|
214
|
+
operationType: string;
|
|
215
|
+
/** Reason for abortion */
|
|
216
|
+
abortReason?: string;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* @param operationType - Type of operation that was aborted
|
|
220
|
+
* @param reason - Reason for abortion
|
|
221
|
+
* @param options - Additional options
|
|
222
|
+
*/
|
|
223
|
+
constructor(
|
|
224
|
+
operationType: string,
|
|
225
|
+
reason?: string,
|
|
226
|
+
options?: RclNodeErrorOptions
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Service not available error
|
|
232
|
+
*/
|
|
233
|
+
export class ServiceNotFoundError extends OperationError {
|
|
234
|
+
/** Name of the service */
|
|
235
|
+
serviceName: string;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @param serviceName - Name of the service
|
|
239
|
+
* @param options - Additional options
|
|
240
|
+
*/
|
|
241
|
+
constructor(serviceName: string, options?: RclNodeErrorOptions);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Remote node not found error
|
|
246
|
+
*/
|
|
247
|
+
export class NodeNotFoundError extends OperationError {
|
|
248
|
+
/** Name of the target node */
|
|
249
|
+
targetNodeName: string;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @param nodeName - Name of the node
|
|
253
|
+
* @param options - Additional options
|
|
254
|
+
*/
|
|
255
|
+
constructor(nodeName: string, options?: RclNodeErrorOptions);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Base error for parameter operations
|
|
260
|
+
*/
|
|
261
|
+
export class ParameterError extends RclNodeError {
|
|
262
|
+
/** Name of the parameter */
|
|
263
|
+
parameterName: string;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* @param message - Error message
|
|
267
|
+
* @param parameterName - Name of the parameter
|
|
268
|
+
* @param options - Additional options
|
|
269
|
+
*/
|
|
270
|
+
constructor(
|
|
271
|
+
message: string,
|
|
272
|
+
parameterName: string,
|
|
273
|
+
options?: RclNodeErrorOptions
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Parameter not found error
|
|
279
|
+
*/
|
|
280
|
+
export class ParameterNotFoundError extends ParameterError {
|
|
281
|
+
/**
|
|
282
|
+
* @param parameterName - Name of the parameter
|
|
283
|
+
* @param nodeName - Name of the node
|
|
284
|
+
* @param options - Additional options
|
|
285
|
+
*/
|
|
286
|
+
constructor(
|
|
287
|
+
parameterName: string,
|
|
288
|
+
nodeName: string,
|
|
289
|
+
options?: RclNodeErrorOptions
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Parameter type mismatch error
|
|
295
|
+
*/
|
|
296
|
+
export class ParameterTypeError extends ParameterError {
|
|
297
|
+
/** Expected parameter type */
|
|
298
|
+
expectedType: string;
|
|
299
|
+
/** Actual parameter type */
|
|
300
|
+
actualType: string;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* @param parameterName - Name of the parameter
|
|
304
|
+
* @param expectedType - Expected parameter type
|
|
305
|
+
* @param actualType - Actual parameter type
|
|
306
|
+
* @param options - Additional options
|
|
307
|
+
*/
|
|
308
|
+
constructor(
|
|
309
|
+
parameterName: string,
|
|
310
|
+
expectedType: string,
|
|
311
|
+
actualType: string,
|
|
312
|
+
options?: RclNodeErrorOptions
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Read-only parameter modification error
|
|
318
|
+
*/
|
|
319
|
+
export class ReadOnlyParameterError extends ParameterError {
|
|
320
|
+
/**
|
|
321
|
+
* @param parameterName - Name of the parameter
|
|
322
|
+
* @param options - Additional options
|
|
323
|
+
*/
|
|
324
|
+
constructor(parameterName: string, options?: RclNodeErrorOptions);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Base error for topic operations
|
|
329
|
+
*/
|
|
330
|
+
export class TopicError extends RclNodeError {
|
|
331
|
+
/** Name of the topic */
|
|
332
|
+
topicName: string;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* @param message - Error message
|
|
336
|
+
* @param topicName - Name of the topic
|
|
337
|
+
* @param options - Additional options
|
|
338
|
+
*/
|
|
339
|
+
constructor(
|
|
340
|
+
message: string,
|
|
341
|
+
topicName: string,
|
|
342
|
+
options?: RclNodeErrorOptions
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Publisher-specific error
|
|
348
|
+
*/
|
|
349
|
+
export class PublisherError extends TopicError {
|
|
350
|
+
/**
|
|
351
|
+
* @param message - Error message
|
|
352
|
+
* @param topicName - Name of the topic
|
|
353
|
+
* @param options - Additional options
|
|
354
|
+
*/
|
|
355
|
+
constructor(
|
|
356
|
+
message: string,
|
|
357
|
+
topicName: string,
|
|
358
|
+
options?: RclNodeErrorOptions
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Subscription-specific error
|
|
364
|
+
*/
|
|
365
|
+
export class SubscriptionError extends TopicError {
|
|
366
|
+
/**
|
|
367
|
+
* @param message - Error message
|
|
368
|
+
* @param topicName - Name of the topic
|
|
369
|
+
* @param options - Additional options
|
|
370
|
+
*/
|
|
371
|
+
constructor(
|
|
372
|
+
message: string,
|
|
373
|
+
topicName: string,
|
|
374
|
+
options?: RclNodeErrorOptions
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Base error for action operations
|
|
380
|
+
*/
|
|
381
|
+
export class ActionError extends RclNodeError {
|
|
382
|
+
/** Name of the action */
|
|
383
|
+
actionName: string;
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* @param message - Error message
|
|
387
|
+
* @param actionName - Name of the action
|
|
388
|
+
* @param options - Additional options
|
|
389
|
+
*/
|
|
390
|
+
constructor(
|
|
391
|
+
message: string,
|
|
392
|
+
actionName: string,
|
|
393
|
+
options?: RclNodeErrorOptions
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Goal rejected by action server
|
|
399
|
+
*/
|
|
400
|
+
export class GoalRejectedError extends ActionError {
|
|
401
|
+
/** ID of the rejected goal */
|
|
402
|
+
goalId: string;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* @param actionName - Name of the action
|
|
406
|
+
* @param goalId - ID of the rejected goal
|
|
407
|
+
* @param options - Additional options
|
|
408
|
+
*/
|
|
409
|
+
constructor(
|
|
410
|
+
actionName: string,
|
|
411
|
+
goalId: string,
|
|
412
|
+
options?: RclNodeErrorOptions
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Action server not found
|
|
418
|
+
*/
|
|
419
|
+
export class ActionServerNotFoundError extends ActionError {
|
|
420
|
+
/**
|
|
421
|
+
* @param actionName - Name of the action
|
|
422
|
+
* @param options - Additional options
|
|
423
|
+
*/
|
|
424
|
+
constructor(actionName: string, options?: RclNodeErrorOptions);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Wraps errors from native C++ layer with additional context
|
|
429
|
+
*/
|
|
430
|
+
export class NativeError extends RclNodeError {
|
|
431
|
+
/** Error message from C++ layer */
|
|
432
|
+
nativeMessage: string;
|
|
433
|
+
/** Operation that failed */
|
|
434
|
+
operation: string;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* @param nativeMessage - Error message from C++ layer
|
|
438
|
+
* @param operation - Operation that failed
|
|
439
|
+
* @param options - Additional options
|
|
440
|
+
*/
|
|
441
|
+
constructor(
|
|
442
|
+
nativeMessage: string,
|
|
443
|
+
operation: string,
|
|
444
|
+
options?: RclNodeErrorOptions
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -235,4 +235,21 @@ declare module 'rclnodejs' {
|
|
|
235
235
|
launchFile: string,
|
|
236
236
|
args: string[]
|
|
237
237
|
): Promise<{ process: ChildProcess }>;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Convert a message object to be JSON-safe by converting TypedArrays to regular arrays
|
|
241
|
+
* and handling BigInt, Infinity, NaN, etc. for JSON serialization.
|
|
242
|
+
* @param obj - The message object to convert
|
|
243
|
+
* @returns A JSON-safe version of the object
|
|
244
|
+
*/
|
|
245
|
+
function toJSONSafe(obj: any): any;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Convert a message object to a JSON string with proper handling of TypedArrays,
|
|
249
|
+
* BigInt, and other non-JSON-serializable values.
|
|
250
|
+
* @param obj - The message object to convert
|
|
251
|
+
* @param space - Space parameter for JSON.stringify formatting
|
|
252
|
+
* @returns The JSON string representation
|
|
253
|
+
*/
|
|
254
|
+
function toJSONString(obj: any, space?: number): string;
|
|
238
255
|
}
|