@wandelbots/nova-js 2.1.4-pr.feature-remove-v2-functionallity.113.bfa317e → 2.1.4-pr.feature-add-program-client.114.9d31b54
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/README.md +37 -0
- package/dist/lib/v2/NovaCellAPIClient.d.ts +5 -1
- package/dist/lib/v2/NovaCellAPIClient.d.ts.map +1 -1
- package/dist/lib/v2/ProgramsClient.d.ts +79 -0
- package/dist/lib/v2/ProgramsClient.d.ts.map +1 -0
- package/dist/lib/v2/index.cjs +139 -11
- package/dist/lib/v2/index.cjs.map +1 -1
- package/dist/lib/v2/index.d.ts +1 -0
- package/dist/lib/v2/index.d.ts.map +1 -1
- package/dist/lib/v2/index.js +138 -11
- package/dist/lib/v2/index.js.map +1 -1
- package/package.json +2 -2
- package/src/lib/v2/NovaCellAPIClient.ts +13 -0
- package/src/lib/v2/ProgramsClient.ts +150 -0
- package/src/lib/v2/index.ts +1 -0
- package/src/lib/v2/mock/MockNovaInstance.ts +4 -6
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ If you develop an react application we also provide a set of [react components](
|
|
|
17
17
|
|
|
18
18
|
- [Basic usage](#basic-usage)
|
|
19
19
|
- [API Version Support](#api-version-support)
|
|
20
|
+
- [Programs API (v2)](#programs-api-v2)
|
|
20
21
|
- [API calls](#api-calls)
|
|
21
22
|
- [Opening websockets](#opening-websockets)
|
|
22
23
|
- [Connect to a motion group](#connect-to-a-motion-group)
|
|
@@ -69,6 +70,42 @@ const { controllers } = await nova.api.controller.listRobotControllers()
|
|
|
69
70
|
|
|
70
71
|
We recommend using **v1** for production applications until v2 support is fully implemented.
|
|
71
72
|
|
|
73
|
+
## Programs API (v2)
|
|
74
|
+
|
|
75
|
+
For v2 instances, you can use the enhanced `ProgramsClient` to manage programs:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import { NovaClient } from "@wandelbots/nova-js/v2"
|
|
79
|
+
|
|
80
|
+
const nova = new NovaClient({
|
|
81
|
+
instanceUrl: "https://example.instance.wandelbots.io",
|
|
82
|
+
cellId: "cell",
|
|
83
|
+
accessToken: "...",
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
// Access the programs client
|
|
87
|
+
const programs = nova.cell("cell-id").programsClient
|
|
88
|
+
|
|
89
|
+
// List all available programs
|
|
90
|
+
const allPrograms = await programs.list()
|
|
91
|
+
|
|
92
|
+
// Start a program with arguments
|
|
93
|
+
const run = await programs.start("my-program", {
|
|
94
|
+
// Add your program-specific arguments here
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
// Stop a running program
|
|
98
|
+
await programs.stop("my-program")
|
|
99
|
+
|
|
100
|
+
// Work with a specific program
|
|
101
|
+
const myProgram = programs.forProgram("welding-program")
|
|
102
|
+
const details = await myProgram.getDetails()
|
|
103
|
+
const run = await myProgram.start({ /* program arguments */ })
|
|
104
|
+
await myProgram.stop()
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Note:** Real-time program state tracking via NATS messaging is planned for future releases. Currently, the API provides basic start/stop functionality.
|
|
108
|
+
|
|
72
109
|
## API calls
|
|
73
110
|
|
|
74
111
|
You can make calls to the REST API via `nova.api`, which contains a bunch of namespaced methods for each endpoint generated from the OpenAPI spec and documentation.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Configuration as BaseConfiguration } from "@wandelbots/nova-api/v2";
|
|
2
|
-
import { ApplicationApi, BUSInputsOutputsApi, CellApi, ControllerApi, ControllerInputsOutputsApi, JoggingApi, KinematicsApi, MotionGroupApi, MotionGroupModelsApi, StoreCollisionComponentsApi, StoreCollisionSetupsApi, StoreObjectApi, SystemApi, TrajectoryCachingApi, TrajectoryExecutionApi, TrajectoryPlanningApi, VirtualControllerApi, VirtualControllerBehaviorApi, VirtualControllerInputsOutputsApi } from "@wandelbots/nova-api/v2";
|
|
2
|
+
import { ApplicationApi, BUSInputsOutputsApi, CellApi, ControllerApi, ControllerInputsOutputsApi, JoggingApi, KinematicsApi, MotionGroupApi, MotionGroupModelsApi, ProgramApi, StoreCollisionComponentsApi, StoreCollisionSetupsApi, StoreObjectApi, SystemApi, TrajectoryCachingApi, TrajectoryExecutionApi, TrajectoryPlanningApi, VirtualControllerApi, VirtualControllerBehaviorApi, VirtualControllerInputsOutputsApi } from "@wandelbots/nova-api/v2";
|
|
3
3
|
import type { AxiosInstance } from "axios";
|
|
4
|
+
import { ProgramsClient } from "./ProgramsClient.js";
|
|
4
5
|
type OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never;
|
|
5
6
|
type UnwrapAxiosResponseReturn<T> = T extends (...a: any) => any ? (...a: Parameters<T>) => Promise<Awaited<ReturnType<T>> extends {
|
|
6
7
|
data: infer D;
|
|
@@ -44,6 +45,7 @@ export declare class NovaCellAPIClient {
|
|
|
44
45
|
readonly trajectoryPlanning: WithCellId<TrajectoryPlanningApi>;
|
|
45
46
|
readonly trajectoryExecution: WithCellId<TrajectoryExecutionApi>;
|
|
46
47
|
readonly trajectoryCaching: WithCellId<TrajectoryCachingApi>;
|
|
48
|
+
readonly programs: WithCellId<ProgramApi>;
|
|
47
49
|
readonly application: WithCellId<ApplicationApi>;
|
|
48
50
|
readonly applicationGlobal: WithUnwrappedAxiosResponse<ApplicationApi>;
|
|
49
51
|
readonly jogging: WithCellId<JoggingApi>;
|
|
@@ -55,6 +57,8 @@ export declare class NovaCellAPIClient {
|
|
|
55
57
|
readonly storeObject: WithCellId<StoreObjectApi>;
|
|
56
58
|
readonly storeCollisionComponents: WithCellId<StoreCollisionComponentsApi>;
|
|
57
59
|
readonly storeCollisionSetups: WithCellId<StoreCollisionSetupsApi>;
|
|
60
|
+
private _programsClient?;
|
|
61
|
+
get programsClient(): ProgramsClient;
|
|
58
62
|
}
|
|
59
63
|
export {};
|
|
60
64
|
//# sourceMappingURL=NovaCellAPIClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NovaCellAPIClient.d.ts","sourceRoot":"","sources":["../../../src/lib/v2/NovaCellAPIClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACjF,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,OAAO,EACP,aAAa,EACb,0BAA0B,EAC1B,UAAU,EACV,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,2BAA2B,EAC3B,uBAAuB,EACvB,cAAc,EACd,SAAS,EACT,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,iCAAiC,EAClC,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"NovaCellAPIClient.d.ts","sourceRoot":"","sources":["../../../src/lib/v2/NovaCellAPIClient.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Program, ProgramRun, ProgramRunState, ProgramStartRequest, ProgramApi } from "@wandelbots/nova-api/v2";
|
|
2
|
+
import type { NovaCellAPIClient, WithCellId } from "./NovaCellAPIClient.js";
|
|
3
|
+
/**
|
|
4
|
+
* Enhanced client for the Programs API providing intuitive program management
|
|
5
|
+
*/
|
|
6
|
+
export declare class ProgramsClient {
|
|
7
|
+
private client;
|
|
8
|
+
constructor(client: NovaCellAPIClient);
|
|
9
|
+
/**
|
|
10
|
+
* Get the underlying programs API for direct access
|
|
11
|
+
*/
|
|
12
|
+
get api(): WithCellId<ProgramApi>;
|
|
13
|
+
/**
|
|
14
|
+
* List all programs available in the cell
|
|
15
|
+
*/
|
|
16
|
+
list(): Promise<Program[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Get details of a specific program
|
|
19
|
+
*/
|
|
20
|
+
get(programId: string): Promise<Program>;
|
|
21
|
+
/**
|
|
22
|
+
* Start a program with the given arguments
|
|
23
|
+
*/
|
|
24
|
+
start(programId: string, args?: object): Promise<ProgramRun>;
|
|
25
|
+
/**
|
|
26
|
+
* Stop a running program
|
|
27
|
+
*/
|
|
28
|
+
stop(programId: string): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Execute a program and wait for it to complete
|
|
31
|
+
*
|
|
32
|
+
* Note: This method has limitations due to current API constraints.
|
|
33
|
+
* Real-time program state tracking will be available via NATS messaging
|
|
34
|
+
* in future versions. For now, this provides basic start functionality.
|
|
35
|
+
*
|
|
36
|
+
* @param programId - The program identifier
|
|
37
|
+
* @param args - Arguments to pass to the program
|
|
38
|
+
* @param options - Basic execution options
|
|
39
|
+
*/
|
|
40
|
+
execute(programId: string, args?: object, options?: {
|
|
41
|
+
onStart?: (run: ProgramRun) => void;
|
|
42
|
+
}): Promise<ProgramRun>;
|
|
43
|
+
/**
|
|
44
|
+
* Create a program runner helper for a specific program
|
|
45
|
+
*/
|
|
46
|
+
forProgram(programId: string): ProgramRunner;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Helper class for managing a specific program
|
|
50
|
+
*/
|
|
51
|
+
export declare class ProgramRunner {
|
|
52
|
+
private programs;
|
|
53
|
+
private programId;
|
|
54
|
+
constructor(programs: ProgramsClient, programId: string);
|
|
55
|
+
/**
|
|
56
|
+
* Get program details
|
|
57
|
+
*/
|
|
58
|
+
getDetails(): Promise<Program>;
|
|
59
|
+
/**
|
|
60
|
+
* Start this program
|
|
61
|
+
*/
|
|
62
|
+
start(args?: object): Promise<ProgramRun>;
|
|
63
|
+
/**
|
|
64
|
+
* Stop this program
|
|
65
|
+
*/
|
|
66
|
+
stop(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Execute this program (start and get initial run information)
|
|
69
|
+
*
|
|
70
|
+
* Note: This method has limitations due to current API constraints.
|
|
71
|
+
* Real-time program state tracking will be available via NATS messaging
|
|
72
|
+
* in future versions.
|
|
73
|
+
*/
|
|
74
|
+
execute(args?: object, options?: {
|
|
75
|
+
onStart?: (run: ProgramRun) => void;
|
|
76
|
+
}): Promise<ProgramRun>;
|
|
77
|
+
}
|
|
78
|
+
export type { Program, ProgramRun, ProgramRunState, ProgramStartRequest, };
|
|
79
|
+
//# sourceMappingURL=ProgramsClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgramsClient.d.ts","sourceRoot":"","sources":["../../../src/lib/v2/ProgramsClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,UAAU,EACX,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE3E;;GAEG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,iBAAiB;IAE7C;;OAEG;IACH,IAAI,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAEhC;IAED;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAIhC;;OAEG;IACG,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI9C;;OAEG;IACG,KAAK,CACT,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,MAAW,GAChB,OAAO,CAAC,UAAU,CAAC;IAOtB;;OAEG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5C;;;;;;;;;;OAUG;IACG,OAAO,CACX,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,MAAW,EACjB,OAAO,GAAE;QACP,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CAAA;KAC/B,GACL,OAAO,CAAC,UAAU,CAAC;IAetB;;OAEG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa;CAG7C;AAED;;GAEG;AACH,qBAAa,aAAa;IAEtB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS;gBADT,QAAQ,EAAE,cAAc,EACxB,SAAS,EAAE,MAAM;IAG3B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAIpC;;OAEG;IACG,KAAK,CAAC,IAAI,GAAE,MAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAInD;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;;;;OAMG;IACG,OAAO,CACX,IAAI,GAAE,MAAW,EACjB,OAAO,GAAE;QACP,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CAAA;KAC/B,GACL,OAAO,CAAC,UAAU,CAAC;CAGvB;AAGD,YAAY,EACV,OAAO,EACP,UAAU,EACV,eAAe,EACf,mBAAmB,GACpB,CAAA"}
|
package/dist/lib/v2/index.cjs
CHANGED
|
@@ -69,7 +69,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
69
69
|
var v2_exports = {};
|
|
70
70
|
__export(v2_exports, {
|
|
71
71
|
NovaCellAPIClient: () => NovaCellAPIClient,
|
|
72
|
-
NovaClient: () => NovaClient
|
|
72
|
+
NovaClient: () => NovaClient,
|
|
73
|
+
ProgramRunner: () => ProgramRunner,
|
|
74
|
+
ProgramsClient: () => ProgramsClient
|
|
73
75
|
});
|
|
74
76
|
module.exports = __toCommonJS(v2_exports);
|
|
75
77
|
__reExport(v2_exports, require("@wandelbots/nova-api/v2"), module.exports);
|
|
@@ -77,6 +79,125 @@ __reExport(v2_exports, require("@wandelbots/nova-api/v2"), module.exports);
|
|
|
77
79
|
// src/lib/v2/NovaCellAPIClient.ts
|
|
78
80
|
var import_v2 = require("@wandelbots/nova-api/v2");
|
|
79
81
|
var import_axios = __toESM(require("axios"), 1);
|
|
82
|
+
|
|
83
|
+
// src/lib/v2/ProgramsClient.ts
|
|
84
|
+
var ProgramsClient = class {
|
|
85
|
+
constructor(client) {
|
|
86
|
+
this.client = client;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get the underlying programs API for direct access
|
|
90
|
+
*/
|
|
91
|
+
get api() {
|
|
92
|
+
return this.client.programs;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* List all programs available in the cell
|
|
96
|
+
*/
|
|
97
|
+
list() {
|
|
98
|
+
return __async(this, null, function* () {
|
|
99
|
+
return yield this.api.listPrograms();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get details of a specific program
|
|
104
|
+
*/
|
|
105
|
+
get(programId) {
|
|
106
|
+
return __async(this, null, function* () {
|
|
107
|
+
return yield this.api.getProgram(programId);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Start a program with the given arguments
|
|
112
|
+
*/
|
|
113
|
+
start(_0) {
|
|
114
|
+
return __async(this, arguments, function* (programId, args = {}) {
|
|
115
|
+
const startRequest = {
|
|
116
|
+
arguments: args
|
|
117
|
+
};
|
|
118
|
+
return yield this.api.startProgram(programId, startRequest);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Stop a running program
|
|
123
|
+
*/
|
|
124
|
+
stop(programId) {
|
|
125
|
+
return __async(this, null, function* () {
|
|
126
|
+
return yield this.api.stopProgram(programId);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Execute a program and wait for it to complete
|
|
131
|
+
*
|
|
132
|
+
* Note: This method has limitations due to current API constraints.
|
|
133
|
+
* Real-time program state tracking will be available via NATS messaging
|
|
134
|
+
* in future versions. For now, this provides basic start functionality.
|
|
135
|
+
*
|
|
136
|
+
* @param programId - The program identifier
|
|
137
|
+
* @param args - Arguments to pass to the program
|
|
138
|
+
* @param options - Basic execution options
|
|
139
|
+
*/
|
|
140
|
+
execute(_0) {
|
|
141
|
+
return __async(this, arguments, function* (programId, args = {}, options = {}) {
|
|
142
|
+
const { onStart } = options;
|
|
143
|
+
const run = yield this.start(programId, args);
|
|
144
|
+
if (onStart) {
|
|
145
|
+
onStart(run);
|
|
146
|
+
}
|
|
147
|
+
return run;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Create a program runner helper for a specific program
|
|
152
|
+
*/
|
|
153
|
+
forProgram(programId) {
|
|
154
|
+
return new ProgramRunner(this, programId);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
var ProgramRunner = class {
|
|
158
|
+
constructor(programs, programId) {
|
|
159
|
+
this.programs = programs;
|
|
160
|
+
this.programId = programId;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get program details
|
|
164
|
+
*/
|
|
165
|
+
getDetails() {
|
|
166
|
+
return __async(this, null, function* () {
|
|
167
|
+
return yield this.programs.get(this.programId);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Start this program
|
|
172
|
+
*/
|
|
173
|
+
start() {
|
|
174
|
+
return __async(this, arguments, function* (args = {}) {
|
|
175
|
+
return yield this.programs.start(this.programId, args);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Stop this program
|
|
180
|
+
*/
|
|
181
|
+
stop() {
|
|
182
|
+
return __async(this, null, function* () {
|
|
183
|
+
return yield this.programs.stop(this.programId);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Execute this program (start and get initial run information)
|
|
188
|
+
*
|
|
189
|
+
* Note: This method has limitations due to current API constraints.
|
|
190
|
+
* Real-time program state tracking will be available via NATS messaging
|
|
191
|
+
* in future versions.
|
|
192
|
+
*/
|
|
193
|
+
execute() {
|
|
194
|
+
return __async(this, arguments, function* (args = {}, options = {}) {
|
|
195
|
+
return yield this.programs.execute(this.programId, args, options);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// src/lib/v2/NovaCellAPIClient.ts
|
|
80
201
|
var NovaCellAPIClient = class {
|
|
81
202
|
constructor(cellId, opts) {
|
|
82
203
|
this.cellId = cellId;
|
|
@@ -90,6 +211,7 @@ var NovaCellAPIClient = class {
|
|
|
90
211
|
this.trajectoryPlanning = this.withCellId(import_v2.TrajectoryPlanningApi);
|
|
91
212
|
this.trajectoryExecution = this.withCellId(import_v2.TrajectoryExecutionApi);
|
|
92
213
|
this.trajectoryCaching = this.withCellId(import_v2.TrajectoryCachingApi);
|
|
214
|
+
this.programs = this.withCellId(import_v2.ProgramApi);
|
|
93
215
|
this.application = this.withCellId(import_v2.ApplicationApi);
|
|
94
216
|
this.applicationGlobal = this.withUnwrappedResponsesOnly(import_v2.ApplicationApi);
|
|
95
217
|
this.jogging = this.withCellId(import_v2.JoggingApi);
|
|
@@ -158,6 +280,12 @@ var NovaCellAPIClient = class {
|
|
|
158
280
|
}
|
|
159
281
|
return apiClient;
|
|
160
282
|
}
|
|
283
|
+
get programsClient() {
|
|
284
|
+
if (!this._programsClient) {
|
|
285
|
+
this._programsClient = new ProgramsClient(this);
|
|
286
|
+
}
|
|
287
|
+
return this._programsClient;
|
|
288
|
+
}
|
|
161
289
|
};
|
|
162
290
|
|
|
163
291
|
// src/lib/v2/NovaClient.ts
|
|
@@ -1327,16 +1455,14 @@ var defaultMotionState = {
|
|
|
1327
1455
|
controller: "universalrobots-ur5e",
|
|
1328
1456
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1329
1457
|
sequence_number: 1,
|
|
1330
|
-
joint_position:
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
]
|
|
1339
|
-
},
|
|
1458
|
+
joint_position: [
|
|
1459
|
+
1.1699999570846558,
|
|
1460
|
+
-1.5700000524520874,
|
|
1461
|
+
1.3600000143051147,
|
|
1462
|
+
1.0299999713897705,
|
|
1463
|
+
1.2899999618530273,
|
|
1464
|
+
1.2799999713897705
|
|
1465
|
+
],
|
|
1340
1466
|
joint_limit_reached: {
|
|
1341
1467
|
limit_reached: [false, false, false, false, false, false]
|
|
1342
1468
|
},
|
|
@@ -1488,6 +1614,8 @@ var NovaClient = class {
|
|
|
1488
1614
|
0 && (module.exports = {
|
|
1489
1615
|
NovaCellAPIClient,
|
|
1490
1616
|
NovaClient,
|
|
1617
|
+
ProgramRunner,
|
|
1618
|
+
ProgramsClient,
|
|
1491
1619
|
...require("@wandelbots/nova-api/v2")
|
|
1492
1620
|
});
|
|
1493
1621
|
//# sourceMappingURL=index.cjs.map
|