abb-rws-client 0.2.0 → 0.7.1
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/CHANGELOG.md +171 -0
- package/README.md +364 -143
- package/dist/HttpSession.d.ts.map +1 -1
- package/dist/HttpSession.js +18 -1
- package/dist/HttpSession.js.map +1 -1
- package/dist/IRWSAdapter.d.ts +421 -0
- package/dist/IRWSAdapter.d.ts.map +1 -0
- package/dist/IRWSAdapter.js +2 -0
- package/dist/IRWSAdapter.js.map +1 -0
- package/dist/Logger.d.ts +35 -0
- package/dist/Logger.d.ts.map +1 -0
- package/dist/Logger.js +24 -0
- package/dist/Logger.js.map +1 -0
- package/dist/MultiRobotManager.d.ts +56 -0
- package/dist/MultiRobotManager.d.ts.map +1 -0
- package/dist/MultiRobotManager.js +129 -0
- package/dist/MultiRobotManager.js.map +1 -0
- package/dist/RWS1Adapter.d.ts +297 -0
- package/dist/RWS1Adapter.d.ts.map +1 -0
- package/dist/RWS1Adapter.js +870 -0
- package/dist/RWS1Adapter.js.map +1 -0
- package/dist/RWS2Adapter.d.ts +20 -0
- package/dist/RWS2Adapter.d.ts.map +1 -0
- package/dist/RWS2Adapter.js +19 -0
- package/dist/RWS2Adapter.js.map +1 -0
- package/dist/ResourceMapper.d.ts +226 -2
- package/dist/ResourceMapper.d.ts.map +1 -1
- package/dist/ResourceMapper.js +286 -3
- package/dist/ResourceMapper.js.map +1 -1
- package/dist/ResponseParser.d.ts +81 -2
- package/dist/ResponseParser.d.ts.map +1 -1
- package/dist/ResponseParser.js +309 -3
- package/dist/ResponseParser.js.map +1 -1
- package/dist/RobotManager.d.ts +536 -0
- package/dist/RobotManager.d.ts.map +1 -0
- package/dist/RobotManager.js +1523 -0
- package/dist/RobotManager.js.map +1 -0
- package/dist/RwsClient.d.ts +280 -4
- package/dist/RwsClient.d.ts.map +1 -1
- package/dist/RwsClient.js +698 -10
- package/dist/RwsClient.js.map +1 -1
- package/dist/RwsClient2.d.ts +438 -0
- package/dist/RwsClient2.d.ts.map +1 -0
- package/dist/RwsClient2.js +1672 -0
- package/dist/RwsClient2.js.map +1 -0
- package/dist/WsSubscriber.d.ts.map +1 -1
- package/dist/WsSubscriber.js +18 -11
- package/dist/WsSubscriber.js.map +1 -1
- package/dist/XhtmlParser.d.ts +24 -0
- package/dist/XhtmlParser.d.ts.map +1 -0
- package/dist/XhtmlParser.js +56 -0
- package/dist/XhtmlParser.js.map +1 -0
- package/dist/detect.d.ts +54 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/detect.js +187 -0
- package/dist/detect.js.map +1 -0
- package/dist/index.d.ts +30 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +190 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/examples/01-quickstart-auto.mjs +20 -0
- package/examples/02-rws1-explicit.mjs +30 -0
- package/examples/03-rws2-explicit.mjs +26 -0
- package/examples/04-multi-robot.mjs +35 -0
- package/examples/05-remote-control-rmmp.mjs +52 -0
- package/examples/06-pull-module-source.mjs +38 -0
- package/package.json +31 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* abb-rws-client — public API
|
|
3
3
|
*
|
|
4
|
-
* Typed HTTP/WebSocket client for ABB
|
|
5
|
-
*
|
|
4
|
+
* Typed HTTP/WebSocket client for ABB robot controllers, covering BOTH RWS protocols:
|
|
5
|
+
* - RWS 1.0 — IRC5 / RobotWare 6.x → use `RwsClient` (HTTP Digest, JSON via ?json=1)
|
|
6
|
+
* - RWS 2.0 — OmniCore / RobotWare 7.x → use `RwsClient2` (HTTP Basic, XHTML;v=2.0)
|
|
7
|
+
*
|
|
8
|
+
* Don't know which protocol the controller speaks? Use `createClient(host)` —
|
|
9
|
+
* it probes the WWW-Authenticate header and returns the right one.
|
|
10
|
+
*
|
|
11
|
+
* For polymorphic code that wants a single type across both protocols, use
|
|
12
|
+
* the `IRWSAdapter` interface and the `RWS1Adapter` / `RWS2Adapter` wrappers
|
|
13
|
+
* — or the `createAdapter(host)` helper.
|
|
14
|
+
*
|
|
15
|
+
* Higher-level helpers:
|
|
16
|
+
* - `RobotManager` — connection lifecycle, polling, WS subscriptions, port discovery
|
|
17
|
+
* - `MultiRobotManager` — multi-controller orchestration
|
|
18
|
+
* - `XhtmlParser` — RWS 2.0 response parser (exported for advanced users)
|
|
19
|
+
* - `setLogger(impl)` — install your own logging backend
|
|
6
20
|
*/
|
|
7
21
|
export { RwsClient } from './RwsClient.js';
|
|
22
|
+
export { RwsClient2 } from './RwsClient2.js';
|
|
23
|
+
export { RWS1Adapter } from './RWS1Adapter.js';
|
|
24
|
+
export { RWS2Adapter } from './RWS2Adapter.js';
|
|
25
|
+
export type { IRWSAdapter } from './IRWSAdapter.js';
|
|
26
|
+
export { RobotManager } from './RobotManager.js';
|
|
27
|
+
export type { RobotState, ChangeHandler, ProbeResult, DiscoveredController, ErrorListener } from './RobotManager.js';
|
|
28
|
+
export { MultiRobotManager } from './MultiRobotManager.js';
|
|
29
|
+
export type { RobotConfig } from './MultiRobotManager.js';
|
|
30
|
+
export { createClient, createAdapter, probeHost, probeProtocol } from './detect.js';
|
|
31
|
+
export type { AnyClient, Protocol, ConnectOptions, ProbeResult as DetectProbeResult } from './detect.js';
|
|
32
|
+
export { XhtmlParser } from './XhtmlParser.js';
|
|
33
|
+
export { setLogger } from './Logger.js';
|
|
34
|
+
export type { Logger } from './Logger.js';
|
|
8
35
|
export { RwsError } from './types.js';
|
|
9
|
-
export type { RwsClientOptions, RwsErrorCode, ControllerState, OperationMode, ExecutionState, JointTarget, RobTarget, Signal, RapidTask, SubscriptionResource, SubscriptionEvent, } from './types.js';
|
|
36
|
+
export type { RwsClientOptions, RwsErrorCode, ControllerState, OperationMode, ExecutionState, ExecutionInfo, ExecutionCycle, JointTarget, RobTarget, CartesianFull, Signal, RapidTask, IoNetwork, IoDevice, SystemInfo, ControllerIdentity, ControllerClock, ElogMessage, FileEntry, MastershipDomain, CollisionDetectionState, RapidSymbolProperties, RapidSymbolInfo, RapidSymbolSearchParams, UiInstruction, RestartMode, SubscriptionResource, SubscriptionEvent, } from './types.js';
|
|
10
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACrH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpF,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGzG,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,SAAS,EACT,aAAa,EACb,MAAM,EACN,SAAS,EACT,SAAS,EACT,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* abb-rws-client — public API
|
|
3
3
|
*
|
|
4
|
-
* Typed HTTP/WebSocket client for ABB
|
|
5
|
-
*
|
|
4
|
+
* Typed HTTP/WebSocket client for ABB robot controllers, covering BOTH RWS protocols:
|
|
5
|
+
* - RWS 1.0 — IRC5 / RobotWare 6.x → use `RwsClient` (HTTP Digest, JSON via ?json=1)
|
|
6
|
+
* - RWS 2.0 — OmniCore / RobotWare 7.x → use `RwsClient2` (HTTP Basic, XHTML;v=2.0)
|
|
7
|
+
*
|
|
8
|
+
* Don't know which protocol the controller speaks? Use `createClient(host)` —
|
|
9
|
+
* it probes the WWW-Authenticate header and returns the right one.
|
|
10
|
+
*
|
|
11
|
+
* For polymorphic code that wants a single type across both protocols, use
|
|
12
|
+
* the `IRWSAdapter` interface and the `RWS1Adapter` / `RWS2Adapter` wrappers
|
|
13
|
+
* — or the `createAdapter(host)` helper.
|
|
14
|
+
*
|
|
15
|
+
* Higher-level helpers:
|
|
16
|
+
* - `RobotManager` — connection lifecycle, polling, WS subscriptions, port discovery
|
|
17
|
+
* - `MultiRobotManager` — multi-controller orchestration
|
|
18
|
+
* - `XhtmlParser` — RWS 2.0 response parser (exported for advanced users)
|
|
19
|
+
* - `setLogger(impl)` — install your own logging backend
|
|
6
20
|
*/
|
|
21
|
+
// Protocol clients
|
|
7
22
|
export { RwsClient } from './RwsClient.js';
|
|
23
|
+
export { RwsClient2 } from './RwsClient2.js';
|
|
24
|
+
// Unified-interface adapters
|
|
25
|
+
export { RWS1Adapter } from './RWS1Adapter.js';
|
|
26
|
+
export { RWS2Adapter } from './RWS2Adapter.js';
|
|
27
|
+
// High-level managers
|
|
28
|
+
export { RobotManager } from './RobotManager.js';
|
|
29
|
+
export { MultiRobotManager } from './MultiRobotManager.js';
|
|
30
|
+
// Auto-detection helpers
|
|
31
|
+
export { createClient, createAdapter, probeHost, probeProtocol } from './detect.js';
|
|
32
|
+
// Helpers
|
|
33
|
+
export { XhtmlParser } from './XhtmlParser.js';
|
|
34
|
+
export { setLogger } from './Logger.js';
|
|
35
|
+
// Errors
|
|
8
36
|
export { RwsError } from './types.js';
|
|
9
37
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mBAAmB;AACnB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,6BAA6B;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,sBAAsB;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,yBAAyB;AACzB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGpF,UAAU;AACV,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,SAAS;AACT,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export type ControllerState = 'init' | 'motoroff' | 'motoron' | 'guardstop' | 'emergencystop' | 'emergencystopreset' | 'sysfail';
|
|
2
2
|
export type OperationMode = 'AUTO' | 'MANR' | 'MANF';
|
|
3
3
|
export type ExecutionState = 'running' | 'stopped';
|
|
4
|
+
/** Full execution state including current cycle mode. */
|
|
5
|
+
export interface ExecutionInfo {
|
|
6
|
+
state: ExecutionState;
|
|
7
|
+
/** Current cycle mode: 'once' | 'forever' | 'asis' | 'oncedone' */
|
|
8
|
+
cycle: string;
|
|
9
|
+
}
|
|
4
10
|
export interface JointTarget {
|
|
5
11
|
rax_1: number;
|
|
6
12
|
rax_2: number;
|
|
@@ -32,12 +38,185 @@ export interface RapidTask {
|
|
|
32
38
|
active: boolean;
|
|
33
39
|
motiontask: boolean;
|
|
34
40
|
}
|
|
41
|
+
/** Extended RobTarget that includes robot configuration flags returned by /cartesian */
|
|
42
|
+
export interface CartesianFull extends RobTarget {
|
|
43
|
+
/** Shoulder configuration: 0 = front, -1 = back */
|
|
44
|
+
j1: number;
|
|
45
|
+
/** Elbow configuration: -1 = down, 1 = up */
|
|
46
|
+
j4: number;
|
|
47
|
+
/** Wrist configuration: -1 = flip, 1 = no flip */
|
|
48
|
+
j6: number;
|
|
49
|
+
/** External axis configuration */
|
|
50
|
+
jx: number;
|
|
51
|
+
}
|
|
52
|
+
export interface IoNetwork {
|
|
53
|
+
name: string;
|
|
54
|
+
/** Physical state: 'running' | 'stopped' */
|
|
55
|
+
pstate: string;
|
|
56
|
+
/** Logical state: 'started' | 'stopped' */
|
|
57
|
+
lstate: string;
|
|
58
|
+
}
|
|
59
|
+
export interface IoDevice {
|
|
60
|
+
name: string;
|
|
61
|
+
network: string;
|
|
62
|
+
lstate: string;
|
|
63
|
+
pstate: string;
|
|
64
|
+
address: string;
|
|
65
|
+
}
|
|
66
|
+
export interface SystemInfo {
|
|
67
|
+
/** Controller/system name */
|
|
68
|
+
name: string;
|
|
69
|
+
/** RobotWare version string, e.g. '6.13.0164' */
|
|
70
|
+
rwVersion: string;
|
|
71
|
+
/** System GUID */
|
|
72
|
+
sysid: string;
|
|
73
|
+
/** Timestamp when RobotWare started */
|
|
74
|
+
startTime: string;
|
|
75
|
+
/** Licensed RobotWare options */
|
|
76
|
+
options: string[];
|
|
77
|
+
}
|
|
78
|
+
export interface ControllerIdentity {
|
|
79
|
+
/** Controller name */
|
|
80
|
+
name: string;
|
|
81
|
+
/** Controller ID */
|
|
82
|
+
id: string;
|
|
83
|
+
/** 'Real Controller' | 'Virtual Controller' */
|
|
84
|
+
type: string;
|
|
85
|
+
/** MAC address */
|
|
86
|
+
mac: string;
|
|
87
|
+
}
|
|
88
|
+
export interface ElogMessage {
|
|
89
|
+
/** Sequence number */
|
|
90
|
+
seqnum: number;
|
|
91
|
+
/** Event code, e.g. 10126 */
|
|
92
|
+
code: number;
|
|
93
|
+
/** 1 = info, 2 = warning, 3 = error */
|
|
94
|
+
msgtype: number;
|
|
95
|
+
/** Timestamp string from controller */
|
|
96
|
+
timestamp: string;
|
|
97
|
+
/** Source name (subsystem that generated the event) */
|
|
98
|
+
srcName: string;
|
|
99
|
+
title: string;
|
|
100
|
+
desc: string;
|
|
101
|
+
causes: string;
|
|
102
|
+
consequences: string;
|
|
103
|
+
actions: string;
|
|
104
|
+
}
|
|
105
|
+
/** Controller clock date/time. */
|
|
106
|
+
export interface ControllerClock {
|
|
107
|
+
/** Format: 'YYYY-MM-DD T HH:MM:SS' */
|
|
108
|
+
datetime: string;
|
|
109
|
+
}
|
|
110
|
+
/** Active RAPID UI instruction (e.g. TPReadNum, TPReadFK waiting for input). */
|
|
111
|
+
export interface UiInstruction {
|
|
112
|
+
/** Instruction name, e.g. 'TPReadNum', 'TPReadFK' */
|
|
113
|
+
instr: string;
|
|
114
|
+
/** Event type: 'SEND' | 'POST' | 'ABORT' */
|
|
115
|
+
event: string;
|
|
116
|
+
/** Stack URL — used as {stackurl} when setting a parameter value */
|
|
117
|
+
stack: string;
|
|
118
|
+
/** Execution level: 'NORMAL' | 'TRAP' | ... */
|
|
119
|
+
execlv: string;
|
|
120
|
+
/** Message text displayed on FlexPendant */
|
|
121
|
+
msg: string;
|
|
122
|
+
}
|
|
123
|
+
/** A RAPID symbol found by search (abbreviated properties). */
|
|
124
|
+
export interface RapidSymbolInfo {
|
|
125
|
+
/** Full symbol path, e.g. 'RAPID/T_ROB1/user/reg1' */
|
|
126
|
+
symburl: string;
|
|
127
|
+
name: string;
|
|
128
|
+
/** Symbol type: 'var' | 'per' | 'con' | 'fun' | 'prc' | etc. */
|
|
129
|
+
symtyp: string;
|
|
130
|
+
/** Data type name, e.g. 'num', 'string', 'bool', 'robtarget' */
|
|
131
|
+
dattyp: string;
|
|
132
|
+
/** Number of array dimensions (0 = scalar) */
|
|
133
|
+
ndim: number;
|
|
134
|
+
local: boolean;
|
|
135
|
+
ro: boolean;
|
|
136
|
+
taskvar: boolean;
|
|
137
|
+
}
|
|
138
|
+
/** Parameters for RAPID symbol search. */
|
|
139
|
+
export interface RapidSymbolSearchParams {
|
|
140
|
+
/** Task name; required */
|
|
141
|
+
task: string;
|
|
142
|
+
/** Search scope: 'block' | 'scope' | 'stack' */
|
|
143
|
+
view?: 'block' | 'scope' | 'stack';
|
|
144
|
+
/** Variable filter: 'rw' | 'ro' | 'loop' | 'any' */
|
|
145
|
+
vartyp?: string;
|
|
146
|
+
/** Symbol type filter: 'var' | 'per' | 'con' | 'fun' | 'prc' | 'mod' | 'tsk' | 'any' */
|
|
147
|
+
symtyp?: string;
|
|
148
|
+
/** Data type filter, e.g. 'num', 'bool', 'robtarget' */
|
|
149
|
+
dattyp?: string;
|
|
150
|
+
/** Regex pattern for symbol name matching */
|
|
151
|
+
regexp?: string;
|
|
152
|
+
/** Whether to search recursively; default true */
|
|
153
|
+
recursive?: boolean;
|
|
154
|
+
/** URL of module/routine to search within */
|
|
155
|
+
blockurl?: string;
|
|
156
|
+
}
|
|
157
|
+
/** Controller restart mode. */
|
|
158
|
+
export type RestartMode = 'restart' | 'istart' | 'pstart' | 'bstart';
|
|
159
|
+
export interface FileEntry {
|
|
160
|
+
name: string;
|
|
161
|
+
type: 'file' | 'dir';
|
|
162
|
+
/** File size in bytes (files only) */
|
|
163
|
+
size?: number;
|
|
164
|
+
/** Creation timestamp from controller */
|
|
165
|
+
created?: string;
|
|
166
|
+
/** Last-modified timestamp from controller */
|
|
167
|
+
modified?: string;
|
|
168
|
+
/** Whether the file is read-only (files only) */
|
|
169
|
+
readonly?: boolean;
|
|
170
|
+
}
|
|
171
|
+
export type MastershipDomain = 'cfg' | 'motion' | 'rapid';
|
|
172
|
+
/**
|
|
173
|
+
* Collision detection state returned by GET /rw/panel/coldetstate.
|
|
174
|
+
* INIT = no collision detected (normal operation).
|
|
175
|
+
* TRIGGERED = collision detected, not yet acknowledged.
|
|
176
|
+
* CONFIRMED = collision confirmed.
|
|
177
|
+
* TRIGGERED_ACK = collision acknowledged.
|
|
178
|
+
*/
|
|
179
|
+
export type CollisionDetectionState = 'INIT' | 'TRIGGERED' | 'CONFIRMED' | 'TRIGGERED_ACK';
|
|
180
|
+
/** Execution cycle mode returned/set by /rw/rapid/execution */
|
|
181
|
+
export type ExecutionCycle = 'once' | 'forever' | 'asis';
|
|
182
|
+
/**
|
|
183
|
+
* RAPID symbol properties returned by GET /rw/rapid/symbol/properties/RAPID/{task}/{module}/{symbol}.
|
|
184
|
+
* symtyp: 'var' | 'per' | 'con' | 'par' | 'fun' | 'prc' | 'mod' | 'tsk' | 'any' | 'udef' | 'atm' | 'rec' | 'ali' | 'rcp'
|
|
185
|
+
*/
|
|
186
|
+
export interface RapidSymbolProperties {
|
|
187
|
+
/** Full symbol URL path */
|
|
188
|
+
symburl: string;
|
|
189
|
+
/** Symbol type: var/per/con/par/fun/prc/mod/tsk/any/udef/atm/rec/ali/rcp */
|
|
190
|
+
symtyp: string;
|
|
191
|
+
/** Whether the symbol has a name */
|
|
192
|
+
named: boolean;
|
|
193
|
+
/** Data type name, e.g. 'num', 'string', 'bool', 'robtarget' */
|
|
194
|
+
dattyp: string;
|
|
195
|
+
/** Number of array dimensions (0 = scalar) */
|
|
196
|
+
ndim: number;
|
|
197
|
+
/** Dimension sizes as a string, e.g. '[3]' for 3-element array */
|
|
198
|
+
dim: string;
|
|
199
|
+
/** Whether the symbol is heap-allocated */
|
|
200
|
+
heap: boolean;
|
|
201
|
+
/** Whether the symbol definition is complete (linked) */
|
|
202
|
+
linked: boolean;
|
|
203
|
+
/** Whether the symbol is module-local (not global) */
|
|
204
|
+
local: boolean;
|
|
205
|
+
/** Whether the persistent is read-only */
|
|
206
|
+
ro: boolean;
|
|
207
|
+
/** Whether the symbol is task-global (taskvar) */
|
|
208
|
+
taskvar: boolean;
|
|
209
|
+
/** Storage type: 'local' | 'task' | 'global' */
|
|
210
|
+
storage: string;
|
|
211
|
+
/** URL reference to the type symbol */
|
|
212
|
+
typurl: string;
|
|
213
|
+
}
|
|
35
214
|
export interface RwsClientOptions {
|
|
36
215
|
/** IP address or hostname, e.g. '192.168.125.1' or '127.0.0.1' for RobotStudio */
|
|
37
216
|
host: string;
|
|
38
217
|
/** HTTP port; default 80 */
|
|
39
218
|
port?: number;
|
|
40
|
-
/** Default '
|
|
219
|
+
/** Default 'Admin' */
|
|
41
220
|
username?: string;
|
|
42
221
|
/** Default 'robotics' */
|
|
43
222
|
password?: string;
|
|
@@ -48,19 +227,27 @@ export interface RwsClientOptions {
|
|
|
48
227
|
/** Saved -http-session- cookie value to reuse an existing controller session slot */
|
|
49
228
|
sessionCookie?: string;
|
|
50
229
|
}
|
|
51
|
-
export type SubscriptionResource = 'execution' | 'controllerstate' | 'operationmode' | {
|
|
230
|
+
export type SubscriptionResource = 'execution' | 'controllerstate' | 'operationmode' | 'speedratio' | 'coldetstate' | 'uiinstr' | {
|
|
52
231
|
type: 'signal';
|
|
53
232
|
name: string;
|
|
54
233
|
} | {
|
|
55
234
|
type: 'persvar';
|
|
56
235
|
name: string;
|
|
236
|
+
} | {
|
|
237
|
+
type: 'taskchange';
|
|
238
|
+
task: string;
|
|
239
|
+
} | {
|
|
240
|
+
type: 'execycle';
|
|
241
|
+
} | {
|
|
242
|
+
type: 'elog';
|
|
243
|
+
domain: number;
|
|
57
244
|
};
|
|
58
245
|
export interface SubscriptionEvent {
|
|
59
246
|
resource: string;
|
|
60
247
|
value: string;
|
|
61
248
|
timestamp: Date;
|
|
62
249
|
}
|
|
63
|
-
export type RwsErrorCode = 'SESSION_EXPIRED' | 'AUTH_FAILED' | 'MOTORS_OFF' | 'MODULE_NOT_FOUND' | 'RATE_LIMITED' | 'CONTROLLER_BUSY' | 'NETWORK_ERROR' | 'PARSE_ERROR' | 'UNKNOWN';
|
|
250
|
+
export type RwsErrorCode = 'SESSION_EXPIRED' | 'AUTH_FAILED' | 'MOTORS_OFF' | 'MODULE_NOT_FOUND' | 'RATE_LIMITED' | 'CONTROLLER_BUSY' | 'NETWORK_ERROR' | 'PARSE_ERROR' | 'PROTOCOL_DETECT_FAILED' | 'UNKNOWN';
|
|
64
251
|
/**
|
|
65
252
|
* Typed error thrown by all abb-rws-client public methods.
|
|
66
253
|
* Always check `code` for programmatic error handling.
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA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Ed;;;GAGG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEhB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CASzF;AAID,oFAAoF;AACpF,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,6DAA6D;AAC7D,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
package/dist/types.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// abb-rws-client — type definitions
|
|
2
2
|
// Targets RWS 1.0 (RobotWare 6.x) only. Not compatible with RWS 2.0 / RobotWare 7.x / OmniCore.
|
|
3
|
+
// v0.5.0 — added: UI instructions, RAPID symbol search, controller clock, execution cycle in state, task activate/deactivate, elog seqnum, subscription coldetstate/execycle/elog/uiinstr, opmode lock, controller restart
|
|
3
4
|
/**
|
|
4
5
|
* Typed error thrown by all abb-rws-client public methods.
|
|
5
6
|
* Always check `code` for programmatic error handling.
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,gGAAgG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,gGAAgG;AAChG,2NAA2N;AAqS3N;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,IAAI,CAAe;IACnB,UAAU,CAAU;IACpB,SAAS,CAAU;IAE5B,YAAY,OAAe,EAAE,IAAkB,EAAE,UAAmB,EAAE,SAAkB;QACtF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,oFAAoF;QACpF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Auto-detect protocol — works for both IRC5 (RWS 1.0) and OmniCore (RWS 2.0).
|
|
2
|
+
// Useful when your code has to support both controller generations.
|
|
3
|
+
|
|
4
|
+
import { createClient, RwsClient2 } from 'abb-rws-client';
|
|
5
|
+
|
|
6
|
+
const client = await createClient({
|
|
7
|
+
host: process.env.RWS_HOST || '127.0.0.1',
|
|
8
|
+
// username/password default to 'Admin' / 'robotics' (built-in admin account, full UAS grants)
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
console.log(`Connected via ${client instanceof RwsClient2 ? 'RWS 2.0' : 'RWS 1.0'}`);
|
|
12
|
+
|
|
13
|
+
const state = await client.getControllerState(); // 'motoron' | 'motoroff' | 'init' | …
|
|
14
|
+
const mode = await client.getOperationMode(); // 'AUTO' | 'MANR' | 'MANF'
|
|
15
|
+
const speed = await client.getSpeedRatio();
|
|
16
|
+
const exec = await client.getRapidExecutionState();
|
|
17
|
+
|
|
18
|
+
console.log({ state, mode, speed, execstate: exec });
|
|
19
|
+
|
|
20
|
+
await client.disconnect();
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Explicit RWS 1.0 client — for IRC5 controllers (RobotWare 6.x).
|
|
2
|
+
// Use this when you only target RWS 1.0 and don't need protocol detection.
|
|
3
|
+
|
|
4
|
+
import { RwsClient } from 'abb-rws-client';
|
|
5
|
+
|
|
6
|
+
const client = new RwsClient({
|
|
7
|
+
host: process.env.RWS_HOST || '192.168.125.1',
|
|
8
|
+
port: 80,
|
|
9
|
+
username: 'Admin',
|
|
10
|
+
password: 'robotics',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
await client.connect();
|
|
14
|
+
|
|
15
|
+
// Controller / panel
|
|
16
|
+
console.log('state:', await client.getControllerState());
|
|
17
|
+
console.log('opmode:', await client.getOperationMode());
|
|
18
|
+
|
|
19
|
+
// Motion
|
|
20
|
+
console.log('joints:', await client.getJointPositions());
|
|
21
|
+
console.log('cartesian:', await client.getCartesianPosition());
|
|
22
|
+
|
|
23
|
+
// RAPID
|
|
24
|
+
console.log('tasks:', (await client.getRapidTasks()).map(t => t.name));
|
|
25
|
+
console.log('modules:', await client.listModules('T_ROB1'));
|
|
26
|
+
|
|
27
|
+
// I/O
|
|
28
|
+
console.log('signals (first 5):', (await client.listAllSignals(0, 5)).map(s => `${s.name}=${s.value}`));
|
|
29
|
+
|
|
30
|
+
await client.disconnect();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Explicit RWS 2.0 client — for OmniCore controllers (RobotWare 7.x).
|
|
2
|
+
// Use this when you only target RWS 2.0 and don't need protocol detection.
|
|
3
|
+
|
|
4
|
+
import { RwsClient2 } from 'abb-rws-client';
|
|
5
|
+
|
|
6
|
+
// RWS 2.0 wants a base URL (scheme + host + port) instead of separate fields.
|
|
7
|
+
// Real OmniCore: https://<host>:443 | VC: https://127.0.0.1:5466
|
|
8
|
+
const client = new RwsClient2(
|
|
9
|
+
process.env.RWS_URL || 'https://127.0.0.1:5466',
|
|
10
|
+
'Admin',
|
|
11
|
+
'robotics',
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
await client.connect();
|
|
15
|
+
|
|
16
|
+
console.log('state:', await client.getControllerState());
|
|
17
|
+
console.log('opmode:', await client.getOperationMode());
|
|
18
|
+
console.log('joints:', await client.getJointPositions());
|
|
19
|
+
console.log('tasks:', (await client.getRapidTasks()).map(t => t.name));
|
|
20
|
+
|
|
21
|
+
// RWS 2.0 symbol API: suffix-style (different from RWS 1.0).
|
|
22
|
+
// Read a known-good symbol from BASE module:
|
|
23
|
+
const tool0 = await client.getRapidVariable('T_ROB1', 'BASE', 'tool0');
|
|
24
|
+
console.log('tool0:', tool0.slice(0, 60), '…');
|
|
25
|
+
|
|
26
|
+
await client.disconnect();
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Multi-robot orchestration — manages multiple controllers in one process.
|
|
2
|
+
// The MultiRobotManager keeps one robot "active" at a time (handy for UIs)
|
|
3
|
+
// while still polling state for all of them.
|
|
4
|
+
|
|
5
|
+
import { MultiRobotManager } from 'abb-rws-client';
|
|
6
|
+
|
|
7
|
+
const multi = MultiRobotManager.fromConfigs([
|
|
8
|
+
{ id: 'irb120-cell-A', name: 'Cell A IRB120', host: '127.0.0.1', port: 5466, useHttps: true, username: 'Admin', password: 'robotics' },
|
|
9
|
+
{ id: 'irb1200-cell-B', name: 'Cell B IRB1200', host: '127.0.0.1', port: 80, useHttps: false, username: 'Admin', password: 'robotics' },
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
// Single sink for connection failures across all robots.
|
|
13
|
+
multi.onError(async (msg, actions) => {
|
|
14
|
+
console.error(`[MultiRobot] ${msg} — actions: ${actions.join(', ')}`);
|
|
15
|
+
return undefined; // headless: just log, don't auto-reconnect
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
multi.onDidChange(() => {
|
|
19
|
+
const a = multi.active;
|
|
20
|
+
if (a) {
|
|
21
|
+
console.log(`[${multi.activeId}] state=${a.state.ctrlstate} mode=${a.state.opmode}`);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Connect each robot independently — failures don't stop the others.
|
|
26
|
+
for (const { id } of multi.entries) {
|
|
27
|
+
await multi.connectRobot(id).catch(e => console.warn(`Could not connect ${id}: ${e.message}`));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Run for 30s, observing state changes, then clean shutdown.
|
|
31
|
+
await new Promise(r => setTimeout(r, 30_000));
|
|
32
|
+
|
|
33
|
+
for (const { id } of multi.entries) {
|
|
34
|
+
await multi.disconnectRobot(id).catch(() => {});
|
|
35
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Acquire Remote Mastership Privilege (RMMP) before doing modify ops.
|
|
2
|
+
//
|
|
3
|
+
// Without RMMP, AUTO-mode modify operations (start RAPID, set PP, write
|
|
4
|
+
// variables, etc.) return HTTP 403 even when mastership is acquired. RMMP
|
|
5
|
+
// is a separate user-level grant: requesting it triggers a popup on the
|
|
6
|
+
// FlexPendant; the operator taps Allow once and you have write access.
|
|
7
|
+
//
|
|
8
|
+
// This is what RobotStudio Online does — that's why it "just works".
|
|
9
|
+
|
|
10
|
+
import { RobotManager, RWS2Adapter, RwsClient2 } from 'abb-rws-client';
|
|
11
|
+
|
|
12
|
+
const client = new RwsClient2({
|
|
13
|
+
host: process.env.RWS_HOST || '127.0.0.1',
|
|
14
|
+
port: Number(process.env.RWS_PORT) || 5466,
|
|
15
|
+
username: process.env.RWS_USER || 'Admin',
|
|
16
|
+
password: process.env.RWS_PASS || 'robotics',
|
|
17
|
+
});
|
|
18
|
+
await client.connect();
|
|
19
|
+
|
|
20
|
+
const robot = new RobotManager({ adapter: new RWS2Adapter(client) });
|
|
21
|
+
await robot.start();
|
|
22
|
+
|
|
23
|
+
// 1) Check current RMMP state
|
|
24
|
+
let priv = await robot.getRmmpPrivilege();
|
|
25
|
+
console.log(`Current RMMP: ${priv}`);
|
|
26
|
+
|
|
27
|
+
// 2) If no privilege, request it. The FlexPendant pops up; operator approves.
|
|
28
|
+
if (priv === 'none') {
|
|
29
|
+
console.log('Requesting RMMP — operator must approve on the FlexPendant…');
|
|
30
|
+
await robot.requestRmmp('modify');
|
|
31
|
+
|
|
32
|
+
// Poll until the operator approves (or 30s timeout)
|
|
33
|
+
for (let i = 0; i < 30; i++) {
|
|
34
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
35
|
+
priv = await robot.getRmmpPrivilege();
|
|
36
|
+
if (priv === 'modify' || priv === 'exclusive') { break; }
|
|
37
|
+
process.stdout.write('.');
|
|
38
|
+
}
|
|
39
|
+
console.log();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (priv === 'modify' || priv === 'exclusive') {
|
|
43
|
+
console.log(`✓ ${priv} privilege granted. Modify ops will now work in AUTO.`);
|
|
44
|
+
// Example: PP-to-Main + start
|
|
45
|
+
// await robot.resetRapid();
|
|
46
|
+
// await robot.startRapid();
|
|
47
|
+
} else {
|
|
48
|
+
console.log(`✗ Operator did not grant RMMP. Cannot do modify ops.`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
await robot.stop();
|
|
52
|
+
await client.disconnect();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Download a loaded module's RAPID source from the controller.
|
|
2
|
+
//
|
|
3
|
+
// This is the typical "git workflow" entry point: pull what's currently
|
|
4
|
+
// running, diff against your repo, push back when ready.
|
|
5
|
+
//
|
|
6
|
+
// Run: RWS_HOST=192.168.125.1 node examples/06-pull-module-source.mjs MotionTest
|
|
7
|
+
|
|
8
|
+
import { createClient } from 'abb-rws-client';
|
|
9
|
+
import { RobotManager, RWS2Adapter } from 'abb-rws-client';
|
|
10
|
+
import * as fs from 'node:fs/promises';
|
|
11
|
+
|
|
12
|
+
const moduleName = process.argv[2] ?? 'user';
|
|
13
|
+
|
|
14
|
+
const client = await createClient({
|
|
15
|
+
host: process.env.RWS_HOST || '127.0.0.1',
|
|
16
|
+
port: Number(process.env.RWS_PORT) || undefined,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Wrap with RobotManager only if you need lifecycle features. For a one-shot
|
|
20
|
+
// pull, the raw client is enough.
|
|
21
|
+
const isRws2 = client.constructor.name === 'RwsClient2';
|
|
22
|
+
let source;
|
|
23
|
+
if (isRws2) {
|
|
24
|
+
// RwsClient2 doesn't expose getModuleSource directly — go through the adapter.
|
|
25
|
+
const robot = new RobotManager({ adapter: new RWS2Adapter(client) });
|
|
26
|
+
await robot.start();
|
|
27
|
+
source = await robot.getModuleSource('T_ROB1', moduleName);
|
|
28
|
+
await robot.stop();
|
|
29
|
+
} else {
|
|
30
|
+
// RWS 1.0 has it on the client.
|
|
31
|
+
source = await client.getModuleSource?.('T_ROB1', moduleName) ?? '';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
await fs.writeFile(`${moduleName}.mod`, source, 'utf8');
|
|
35
|
+
console.log(`✓ Wrote ${moduleName}.mod (${source.length} bytes)`);
|
|
36
|
+
console.log('Now: git diff, edit, git commit, push back via loadModule.');
|
|
37
|
+
|
|
38
|
+
await client.disconnect();
|
package/package.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "abb-rws-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
|
+
"description": "Typed TypeScript/Node.js client for ABB Robot Web Services — supports both RWS 1.0 (IRC5/RobotWare 6) and RWS 2.0 (OmniCore/RobotWare 7).",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"abb",
|
|
7
|
+
"robot",
|
|
8
|
+
"rws",
|
|
9
|
+
"robot-web-services",
|
|
10
|
+
"irc5",
|
|
11
|
+
"omnicore",
|
|
12
|
+
"robotstudio",
|
|
13
|
+
"robotware",
|
|
14
|
+
"industrial-robot"
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"homepage": "https://github.com/merajsafari/abb-rws-client",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/merajsafari/abb-rws-client.git"
|
|
21
|
+
},
|
|
4
22
|
"type": "module",
|
|
5
23
|
"main": "dist/index.js",
|
|
6
24
|
"types": "dist/index.d.ts",
|
|
@@ -11,24 +29,32 @@
|
|
|
11
29
|
}
|
|
12
30
|
},
|
|
13
31
|
"files": [
|
|
14
|
-
"dist"
|
|
32
|
+
"dist",
|
|
33
|
+
"examples",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE",
|
|
36
|
+
"CHANGELOG.md"
|
|
15
37
|
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18"
|
|
40
|
+
},
|
|
16
41
|
"scripts": {
|
|
17
42
|
"build": "tsc",
|
|
18
43
|
"test": "vitest run",
|
|
19
44
|
"test:watch": "vitest",
|
|
20
|
-
"lint": "eslint src"
|
|
45
|
+
"lint": "eslint src",
|
|
46
|
+
"prepublishOnly": "npm run build && npm test"
|
|
21
47
|
},
|
|
22
48
|
"devDependencies": {
|
|
23
49
|
"@types/node": "^20.0.0",
|
|
50
|
+
"@types/ws": "^8.18.1",
|
|
24
51
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
25
52
|
"@typescript-eslint/parser": "^8.0.0",
|
|
26
53
|
"eslint": "^9.0.0",
|
|
27
54
|
"typescript": "^5.4.0",
|
|
28
|
-
"vitest": "^1.6.
|
|
55
|
+
"vitest": "^1.6.1"
|
|
29
56
|
},
|
|
30
57
|
"dependencies": {
|
|
31
|
-
"abb-rws-client": "file:abb-rws-client-0.1.4.tgz",
|
|
32
58
|
"ws": "^8.20.0"
|
|
33
59
|
}
|
|
34
60
|
}
|