@dronedeploy/rocos-js-sdk 4.3.1 → 4.4.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/cjs/models/gamepad/GamepadConfig.d.ts +100 -0
- package/cjs/models/gamepad/GamepadConfig.js +47 -0
- package/cjs/models/gamepad/index.d.ts +1 -0
- package/cjs/models/gamepad/index.js +17 -0
- package/cjs/models/index.d.ts +1 -0
- package/cjs/models/index.js +1 -0
- package/cjs/services/ProfileService.d.ts +3 -2
- package/cjs/services/ProfileService.js +0 -4
- package/cjs/services/RobotService.d.ts +3 -3
- package/cjs/services/RobotService.js +0 -4
- package/esm/models/gamepad/GamepadConfig.d.ts +100 -0
- package/esm/models/gamepad/GamepadConfig.js +44 -0
- package/esm/models/gamepad/index.d.ts +1 -0
- package/esm/models/gamepad/index.js +1 -0
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/services/ProfileService.d.ts +3 -2
- package/esm/services/ProfileService.js +0 -4
- package/esm/services/RobotService.d.ts +3 -3
- package/esm/services/RobotService.js +0 -4
- package/package.json +1 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export declare enum GamepadButtonType {
|
|
2
|
+
UNKNOWN = 0,
|
|
3
|
+
UP = 1,
|
|
4
|
+
DOWN = 2,
|
|
5
|
+
LEFT = 3,
|
|
6
|
+
RIGHT = 4,
|
|
7
|
+
LEFT_STICK_X = 5,
|
|
8
|
+
LEFT_STICK_Y = 6,
|
|
9
|
+
LEFT_STICK_BUTTON = 7,// Stick pressed
|
|
10
|
+
RIGHT_STICK_X = 8,
|
|
11
|
+
RIGHT_STICK_Y = 9,
|
|
12
|
+
RIGHT_STICK_BUTTON = 10,// Stick pressed
|
|
13
|
+
LEFT_BUMPER = 11,
|
|
14
|
+
RIGHT_BUMPER = 12,
|
|
15
|
+
LEFT_TRIGGER = 13,
|
|
16
|
+
RIGHT_TRIGGER = 14,
|
|
17
|
+
A = 15,// Xbox
|
|
18
|
+
B = 16,// Xbox
|
|
19
|
+
X = 17,// Xbox
|
|
20
|
+
Y = 18,// Xbox
|
|
21
|
+
BACK = 19,// Xbox
|
|
22
|
+
START = 20,// Xbox
|
|
23
|
+
GUIDE = 21,// Xbox
|
|
24
|
+
SHARE = 22,// PS4
|
|
25
|
+
OPTIONS = 23,// PS4
|
|
26
|
+
PS = 24,// PS4
|
|
27
|
+
CIRCLE = 25,// PS4
|
|
28
|
+
SQUARE = 26,// PS4
|
|
29
|
+
TRIANGLE = 27
|
|
30
|
+
}
|
|
31
|
+
/** Per-axis tuning keyed by GamepadButtonType. Absent entirely on configs saved before axis tuning existed. */
|
|
32
|
+
export type GamepadAxisValueMap = Partial<Record<GamepadButtonType, number>>;
|
|
33
|
+
export declare enum GamepadTriggerType {
|
|
34
|
+
ONCE = "once",
|
|
35
|
+
CONTINUOUSLY = "continuously"
|
|
36
|
+
}
|
|
37
|
+
export declare enum GamepadCommandVersion {
|
|
38
|
+
COMMANDS = "commands",
|
|
39
|
+
CONTROLS = "controls",
|
|
40
|
+
COMMANDS_V2 = "commands-v2",
|
|
41
|
+
RUN_JS = "run-js"
|
|
42
|
+
}
|
|
43
|
+
export interface GamepadButtonRef {
|
|
44
|
+
type: GamepadButtonType;
|
|
45
|
+
text: string;
|
|
46
|
+
}
|
|
47
|
+
export interface GamepadAction {
|
|
48
|
+
name: string;
|
|
49
|
+
source: GamepadButtonRef;
|
|
50
|
+
commandId: string;
|
|
51
|
+
/** Absent on configs saved before Commands V2 existed. */
|
|
52
|
+
commandVersion?: GamepadCommandVersion;
|
|
53
|
+
triggerType: GamepadTriggerType;
|
|
54
|
+
/** Milliseconds between repeats. Only meaningful for `continuously`. */
|
|
55
|
+
frequency: number;
|
|
56
|
+
}
|
|
57
|
+
export interface GamepadVariable {
|
|
58
|
+
name: string;
|
|
59
|
+
source: GamepadButtonRef;
|
|
60
|
+
/** Expression evaluated against the button value, with `$value` and `$msg` in scope. */
|
|
61
|
+
value: string;
|
|
62
|
+
/** Stored as a string by the console editor, and used when the source button is absent. */
|
|
63
|
+
defaultValue?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface GamepadHardwareMapping {
|
|
66
|
+
buttons: GamepadButtonRef[];
|
|
67
|
+
axes: GamepadButtonRef[];
|
|
68
|
+
}
|
|
69
|
+
/** Identifies the physical controller model this config applies to, matched against the browser's Gamepad.id. */
|
|
70
|
+
export interface GamepadHardware {
|
|
71
|
+
id: string;
|
|
72
|
+
type: string;
|
|
73
|
+
name: string;
|
|
74
|
+
mapping: GamepadHardwareMapping;
|
|
75
|
+
}
|
|
76
|
+
export interface GamepadConfig {
|
|
77
|
+
gamepad: GamepadHardware;
|
|
78
|
+
actions: GamepadAction[];
|
|
79
|
+
variables: GamepadVariable[];
|
|
80
|
+
axisDeadzones?: GamepadAxisValueMap;
|
|
81
|
+
axisExpos?: GamepadAxisValueMap;
|
|
82
|
+
}
|
|
83
|
+
/** One stored gamepad config, scoped to a specific physical controller model (GamepadConfig.gamepad). */
|
|
84
|
+
export interface GamepadConfigItem {
|
|
85
|
+
id: string;
|
|
86
|
+
value: GamepadConfig;
|
|
87
|
+
/** Robot-scoped response only: whether this robot's config overrides its robot definition's. */
|
|
88
|
+
_isOverridden?: boolean;
|
|
89
|
+
}
|
|
90
|
+
/** Response shape of RobotService/ProfileService getGamepads — one item per registered controller model. */
|
|
91
|
+
export interface GamepadConfigResponse {
|
|
92
|
+
version?: string;
|
|
93
|
+
type: string;
|
|
94
|
+
items: GamepadConfigItem[];
|
|
95
|
+
/** Robot-scoped response only. */
|
|
96
|
+
robotDefinitionId?: string;
|
|
97
|
+
username?: string;
|
|
98
|
+
createdAt?: string;
|
|
99
|
+
updatedAt?: string;
|
|
100
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GamepadCommandVersion = exports.GamepadTriggerType = exports.GamepadButtonType = void 0;
|
|
4
|
+
// Ref: https://github.com/alaingilbert/GamepadJs
|
|
5
|
+
var GamepadButtonType;
|
|
6
|
+
(function (GamepadButtonType) {
|
|
7
|
+
GamepadButtonType[GamepadButtonType["UNKNOWN"] = 0] = "UNKNOWN";
|
|
8
|
+
GamepadButtonType[GamepadButtonType["UP"] = 1] = "UP";
|
|
9
|
+
GamepadButtonType[GamepadButtonType["DOWN"] = 2] = "DOWN";
|
|
10
|
+
GamepadButtonType[GamepadButtonType["LEFT"] = 3] = "LEFT";
|
|
11
|
+
GamepadButtonType[GamepadButtonType["RIGHT"] = 4] = "RIGHT";
|
|
12
|
+
GamepadButtonType[GamepadButtonType["LEFT_STICK_X"] = 5] = "LEFT_STICK_X";
|
|
13
|
+
GamepadButtonType[GamepadButtonType["LEFT_STICK_Y"] = 6] = "LEFT_STICK_Y";
|
|
14
|
+
GamepadButtonType[GamepadButtonType["LEFT_STICK_BUTTON"] = 7] = "LEFT_STICK_BUTTON";
|
|
15
|
+
GamepadButtonType[GamepadButtonType["RIGHT_STICK_X"] = 8] = "RIGHT_STICK_X";
|
|
16
|
+
GamepadButtonType[GamepadButtonType["RIGHT_STICK_Y"] = 9] = "RIGHT_STICK_Y";
|
|
17
|
+
GamepadButtonType[GamepadButtonType["RIGHT_STICK_BUTTON"] = 10] = "RIGHT_STICK_BUTTON";
|
|
18
|
+
GamepadButtonType[GamepadButtonType["LEFT_BUMPER"] = 11] = "LEFT_BUMPER";
|
|
19
|
+
GamepadButtonType[GamepadButtonType["RIGHT_BUMPER"] = 12] = "RIGHT_BUMPER";
|
|
20
|
+
GamepadButtonType[GamepadButtonType["LEFT_TRIGGER"] = 13] = "LEFT_TRIGGER";
|
|
21
|
+
GamepadButtonType[GamepadButtonType["RIGHT_TRIGGER"] = 14] = "RIGHT_TRIGGER";
|
|
22
|
+
GamepadButtonType[GamepadButtonType["A"] = 15] = "A";
|
|
23
|
+
GamepadButtonType[GamepadButtonType["B"] = 16] = "B";
|
|
24
|
+
GamepadButtonType[GamepadButtonType["X"] = 17] = "X";
|
|
25
|
+
GamepadButtonType[GamepadButtonType["Y"] = 18] = "Y";
|
|
26
|
+
GamepadButtonType[GamepadButtonType["BACK"] = 19] = "BACK";
|
|
27
|
+
GamepadButtonType[GamepadButtonType["START"] = 20] = "START";
|
|
28
|
+
GamepadButtonType[GamepadButtonType["GUIDE"] = 21] = "GUIDE";
|
|
29
|
+
GamepadButtonType[GamepadButtonType["SHARE"] = 22] = "SHARE";
|
|
30
|
+
GamepadButtonType[GamepadButtonType["OPTIONS"] = 23] = "OPTIONS";
|
|
31
|
+
GamepadButtonType[GamepadButtonType["PS"] = 24] = "PS";
|
|
32
|
+
GamepadButtonType[GamepadButtonType["CIRCLE"] = 25] = "CIRCLE";
|
|
33
|
+
GamepadButtonType[GamepadButtonType["SQUARE"] = 26] = "SQUARE";
|
|
34
|
+
GamepadButtonType[GamepadButtonType["TRIANGLE"] = 27] = "TRIANGLE";
|
|
35
|
+
})(GamepadButtonType || (exports.GamepadButtonType = GamepadButtonType = {}));
|
|
36
|
+
var GamepadTriggerType;
|
|
37
|
+
(function (GamepadTriggerType) {
|
|
38
|
+
GamepadTriggerType["ONCE"] = "once";
|
|
39
|
+
GamepadTriggerType["CONTINUOUSLY"] = "continuously";
|
|
40
|
+
})(GamepadTriggerType || (exports.GamepadTriggerType = GamepadTriggerType = {}));
|
|
41
|
+
var GamepadCommandVersion;
|
|
42
|
+
(function (GamepadCommandVersion) {
|
|
43
|
+
GamepadCommandVersion["COMMANDS"] = "commands";
|
|
44
|
+
GamepadCommandVersion["CONTROLS"] = "controls";
|
|
45
|
+
GamepadCommandVersion["COMMANDS_V2"] = "commands-v2";
|
|
46
|
+
GamepadCommandVersion["RUN_JS"] = "run-js";
|
|
47
|
+
})(GamepadCommandVersion || (exports.GamepadCommandVersion = GamepadCommandVersion = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './GamepadConfig';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./GamepadConfig"), exports);
|
package/cjs/models/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './Dashboard';
|
|
|
11
11
|
export * from './ExportDataQuery';
|
|
12
12
|
export * from './EventDefinition';
|
|
13
13
|
export * from './file/FileEnums';
|
|
14
|
+
export * from './gamepad';
|
|
14
15
|
export * from './graph';
|
|
15
16
|
export * from './HttpError';
|
|
16
17
|
export * from './IBaseService';
|
package/cjs/models/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __exportStar(require("./Dashboard"), exports);
|
|
|
27
27
|
__exportStar(require("./ExportDataQuery"), exports);
|
|
28
28
|
__exportStar(require("./EventDefinition"), exports);
|
|
29
29
|
__exportStar(require("./file/FileEnums"), exports);
|
|
30
|
+
__exportStar(require("./gamepad"), exports);
|
|
30
31
|
__exportStar(require("./graph"), exports);
|
|
31
32
|
__exportStar(require("./HttpError"), exports);
|
|
32
33
|
__exportStar(require("./IBaseService"), exports);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AgentSettingsRequestItem, AgentSettingsResponse } from '../models/IRobotSettings';
|
|
2
2
|
import { CreateRobotDefinitionRequest, RobotProfile } from '../models/RobotProfile';
|
|
3
|
+
import { GamepadConfigItem, GamepadConfigResponse } from '../models/gamepad/GamepadConfig';
|
|
3
4
|
import { RocosError } from '../models/RocosError';
|
|
4
5
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
|
5
6
|
import { Dashboard } from '../models/Dashboard';
|
|
@@ -226,7 +227,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
|
|
|
226
227
|
* @param definitionId - Robot definition Id
|
|
227
228
|
* @description - Renamed from robotDefGetGamepads
|
|
228
229
|
*/
|
|
229
|
-
getGamepads(projectId: string, definitionId: string): Promise<
|
|
230
|
+
getGamepads(projectId: string, definitionId: string): Promise<GamepadConfigResponse>;
|
|
230
231
|
/** Export robot definition into JSON format
|
|
231
232
|
*
|
|
232
233
|
* Can be used to import robot definition into another project
|
|
@@ -265,5 +266,5 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
|
|
|
265
266
|
* @param model - \payload
|
|
266
267
|
* @description - Renamed from robotDefUpdateGamepads
|
|
267
268
|
*/
|
|
268
|
-
updateGamepads(projectId: string, definitionId: string, model:
|
|
269
|
+
updateGamepads(projectId: string, definitionId: string, model: GamepadConfigItem[]): Promise<void>;
|
|
269
270
|
}
|
|
@@ -324,7 +324,6 @@ class ProfileService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
|
324
324
|
* @param definitionId - Robot definition Id
|
|
325
325
|
* @description - Renamed from robotDefGetGamepads
|
|
326
326
|
*/
|
|
327
|
-
// TODO: map the response object
|
|
328
327
|
async getGamepads(projectId, definitionId) {
|
|
329
328
|
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_GAMEPAD_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), `Failed to get gamepads for ${projectId}, definitionId ${definitionId}.`);
|
|
330
329
|
}
|
|
@@ -380,9 +379,6 @@ class ProfileService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
|
380
379
|
* @param model - \payload
|
|
381
380
|
* @description - Renamed from robotDefUpdateGamepads
|
|
382
381
|
*/
|
|
383
|
-
// TODO: map the request model
|
|
384
|
-
// TODO: map the response object
|
|
385
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
386
382
|
async updateGamepads(projectId, definitionId, model) {
|
|
387
383
|
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_DEFINITION_GAMEPAD_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), model, `Failed to update gamepads for ${projectId}, definitionId ${definitionId}.`);
|
|
388
384
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentSettingsResponse, IBaseService, IConnectedCallsign, IRobot, IRobotListItem, IRobotSettings, IRobotTemplate, IRocosSDKConfig, RocosError } from '../models';
|
|
1
|
+
import { AgentSettingsResponse, GamepadConfigItem, GamepadConfigResponse, IBaseService, IConnectedCallsign, IRobot, IRobotListItem, IRobotSettings, IRobotTemplate, IRocosSDKConfig, RocosError } from '../models';
|
|
2
2
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
|
3
3
|
export declare class RobotService extends BaseServiceAbstract implements IBaseService {
|
|
4
4
|
constructor(config: IRocosSDKConfig);
|
|
@@ -272,7 +272,7 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
|
|
|
272
272
|
* @param projectId - Project Id
|
|
273
273
|
* @param callsign - Robot callsign
|
|
274
274
|
*/
|
|
275
|
-
getGamepads(projectId: string, callsign: string): Promise<
|
|
275
|
+
getGamepads(projectId: string, callsign: string): Promise<GamepadConfigResponse>;
|
|
276
276
|
/**
|
|
277
277
|
* Update gamepads for a robot
|
|
278
278
|
*
|
|
@@ -280,7 +280,7 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
|
|
|
280
280
|
* @param callsign - Robot callsign
|
|
281
281
|
* @param model - \payload
|
|
282
282
|
*/
|
|
283
|
-
updateGamepads(projectId: string, callsign: string, model:
|
|
283
|
+
updateGamepads(projectId: string, callsign: string, model: GamepadConfigItem[]): Promise<void>;
|
|
284
284
|
getConnectedCallsigns(projectId: string): Promise<Map<string, IConnectedCallsign>>;
|
|
285
285
|
getConnectedCallsign(projectId: string, callsign: string): Promise<IConnectedCallsign>;
|
|
286
286
|
}
|
|
@@ -449,7 +449,6 @@ class RobotService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
|
449
449
|
* @param projectId - Project Id
|
|
450
450
|
* @param callsign - Robot callsign
|
|
451
451
|
*/
|
|
452
|
-
// TODO: map the response object
|
|
453
452
|
async getGamepads(projectId, callsign) {
|
|
454
453
|
return this.callGet((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ROBOT_GAMEPAD_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), `Failed to get gamepads for ${projectId}, callsign ${callsign}.`);
|
|
455
454
|
}
|
|
@@ -460,9 +459,6 @@ class RobotService extends BaseServiceAbstract_1.BaseServiceAbstract {
|
|
|
460
459
|
* @param callsign - Robot callsign
|
|
461
460
|
* @param model - \payload
|
|
462
461
|
*/
|
|
463
|
-
// TODO: map the request model
|
|
464
|
-
// TODO: map the response object
|
|
465
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
466
462
|
async updateGamepads(projectId, callsign, model) {
|
|
467
463
|
return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_PROJECT_ROBOT_GAMEPAD_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), model, `Failed to update gamepads for ${projectId}, callsign ${callsign}.`);
|
|
468
464
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export declare enum GamepadButtonType {
|
|
2
|
+
UNKNOWN = 0,
|
|
3
|
+
UP = 1,
|
|
4
|
+
DOWN = 2,
|
|
5
|
+
LEFT = 3,
|
|
6
|
+
RIGHT = 4,
|
|
7
|
+
LEFT_STICK_X = 5,
|
|
8
|
+
LEFT_STICK_Y = 6,
|
|
9
|
+
LEFT_STICK_BUTTON = 7,// Stick pressed
|
|
10
|
+
RIGHT_STICK_X = 8,
|
|
11
|
+
RIGHT_STICK_Y = 9,
|
|
12
|
+
RIGHT_STICK_BUTTON = 10,// Stick pressed
|
|
13
|
+
LEFT_BUMPER = 11,
|
|
14
|
+
RIGHT_BUMPER = 12,
|
|
15
|
+
LEFT_TRIGGER = 13,
|
|
16
|
+
RIGHT_TRIGGER = 14,
|
|
17
|
+
A = 15,// Xbox
|
|
18
|
+
B = 16,// Xbox
|
|
19
|
+
X = 17,// Xbox
|
|
20
|
+
Y = 18,// Xbox
|
|
21
|
+
BACK = 19,// Xbox
|
|
22
|
+
START = 20,// Xbox
|
|
23
|
+
GUIDE = 21,// Xbox
|
|
24
|
+
SHARE = 22,// PS4
|
|
25
|
+
OPTIONS = 23,// PS4
|
|
26
|
+
PS = 24,// PS4
|
|
27
|
+
CIRCLE = 25,// PS4
|
|
28
|
+
SQUARE = 26,// PS4
|
|
29
|
+
TRIANGLE = 27
|
|
30
|
+
}
|
|
31
|
+
/** Per-axis tuning keyed by GamepadButtonType. Absent entirely on configs saved before axis tuning existed. */
|
|
32
|
+
export type GamepadAxisValueMap = Partial<Record<GamepadButtonType, number>>;
|
|
33
|
+
export declare enum GamepadTriggerType {
|
|
34
|
+
ONCE = "once",
|
|
35
|
+
CONTINUOUSLY = "continuously"
|
|
36
|
+
}
|
|
37
|
+
export declare enum GamepadCommandVersion {
|
|
38
|
+
COMMANDS = "commands",
|
|
39
|
+
CONTROLS = "controls",
|
|
40
|
+
COMMANDS_V2 = "commands-v2",
|
|
41
|
+
RUN_JS = "run-js"
|
|
42
|
+
}
|
|
43
|
+
export interface GamepadButtonRef {
|
|
44
|
+
type: GamepadButtonType;
|
|
45
|
+
text: string;
|
|
46
|
+
}
|
|
47
|
+
export interface GamepadAction {
|
|
48
|
+
name: string;
|
|
49
|
+
source: GamepadButtonRef;
|
|
50
|
+
commandId: string;
|
|
51
|
+
/** Absent on configs saved before Commands V2 existed. */
|
|
52
|
+
commandVersion?: GamepadCommandVersion;
|
|
53
|
+
triggerType: GamepadTriggerType;
|
|
54
|
+
/** Milliseconds between repeats. Only meaningful for `continuously`. */
|
|
55
|
+
frequency: number;
|
|
56
|
+
}
|
|
57
|
+
export interface GamepadVariable {
|
|
58
|
+
name: string;
|
|
59
|
+
source: GamepadButtonRef;
|
|
60
|
+
/** Expression evaluated against the button value, with `$value` and `$msg` in scope. */
|
|
61
|
+
value: string;
|
|
62
|
+
/** Stored as a string by the console editor, and used when the source button is absent. */
|
|
63
|
+
defaultValue?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface GamepadHardwareMapping {
|
|
66
|
+
buttons: GamepadButtonRef[];
|
|
67
|
+
axes: GamepadButtonRef[];
|
|
68
|
+
}
|
|
69
|
+
/** Identifies the physical controller model this config applies to, matched against the browser's Gamepad.id. */
|
|
70
|
+
export interface GamepadHardware {
|
|
71
|
+
id: string;
|
|
72
|
+
type: string;
|
|
73
|
+
name: string;
|
|
74
|
+
mapping: GamepadHardwareMapping;
|
|
75
|
+
}
|
|
76
|
+
export interface GamepadConfig {
|
|
77
|
+
gamepad: GamepadHardware;
|
|
78
|
+
actions: GamepadAction[];
|
|
79
|
+
variables: GamepadVariable[];
|
|
80
|
+
axisDeadzones?: GamepadAxisValueMap;
|
|
81
|
+
axisExpos?: GamepadAxisValueMap;
|
|
82
|
+
}
|
|
83
|
+
/** One stored gamepad config, scoped to a specific physical controller model (GamepadConfig.gamepad). */
|
|
84
|
+
export interface GamepadConfigItem {
|
|
85
|
+
id: string;
|
|
86
|
+
value: GamepadConfig;
|
|
87
|
+
/** Robot-scoped response only: whether this robot's config overrides its robot definition's. */
|
|
88
|
+
_isOverridden?: boolean;
|
|
89
|
+
}
|
|
90
|
+
/** Response shape of RobotService/ProfileService getGamepads — one item per registered controller model. */
|
|
91
|
+
export interface GamepadConfigResponse {
|
|
92
|
+
version?: string;
|
|
93
|
+
type: string;
|
|
94
|
+
items: GamepadConfigItem[];
|
|
95
|
+
/** Robot-scoped response only. */
|
|
96
|
+
robotDefinitionId?: string;
|
|
97
|
+
username?: string;
|
|
98
|
+
createdAt?: string;
|
|
99
|
+
updatedAt?: string;
|
|
100
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Ref: https://github.com/alaingilbert/GamepadJs
|
|
2
|
+
export var GamepadButtonType;
|
|
3
|
+
(function (GamepadButtonType) {
|
|
4
|
+
GamepadButtonType[GamepadButtonType["UNKNOWN"] = 0] = "UNKNOWN";
|
|
5
|
+
GamepadButtonType[GamepadButtonType["UP"] = 1] = "UP";
|
|
6
|
+
GamepadButtonType[GamepadButtonType["DOWN"] = 2] = "DOWN";
|
|
7
|
+
GamepadButtonType[GamepadButtonType["LEFT"] = 3] = "LEFT";
|
|
8
|
+
GamepadButtonType[GamepadButtonType["RIGHT"] = 4] = "RIGHT";
|
|
9
|
+
GamepadButtonType[GamepadButtonType["LEFT_STICK_X"] = 5] = "LEFT_STICK_X";
|
|
10
|
+
GamepadButtonType[GamepadButtonType["LEFT_STICK_Y"] = 6] = "LEFT_STICK_Y";
|
|
11
|
+
GamepadButtonType[GamepadButtonType["LEFT_STICK_BUTTON"] = 7] = "LEFT_STICK_BUTTON";
|
|
12
|
+
GamepadButtonType[GamepadButtonType["RIGHT_STICK_X"] = 8] = "RIGHT_STICK_X";
|
|
13
|
+
GamepadButtonType[GamepadButtonType["RIGHT_STICK_Y"] = 9] = "RIGHT_STICK_Y";
|
|
14
|
+
GamepadButtonType[GamepadButtonType["RIGHT_STICK_BUTTON"] = 10] = "RIGHT_STICK_BUTTON";
|
|
15
|
+
GamepadButtonType[GamepadButtonType["LEFT_BUMPER"] = 11] = "LEFT_BUMPER";
|
|
16
|
+
GamepadButtonType[GamepadButtonType["RIGHT_BUMPER"] = 12] = "RIGHT_BUMPER";
|
|
17
|
+
GamepadButtonType[GamepadButtonType["LEFT_TRIGGER"] = 13] = "LEFT_TRIGGER";
|
|
18
|
+
GamepadButtonType[GamepadButtonType["RIGHT_TRIGGER"] = 14] = "RIGHT_TRIGGER";
|
|
19
|
+
GamepadButtonType[GamepadButtonType["A"] = 15] = "A";
|
|
20
|
+
GamepadButtonType[GamepadButtonType["B"] = 16] = "B";
|
|
21
|
+
GamepadButtonType[GamepadButtonType["X"] = 17] = "X";
|
|
22
|
+
GamepadButtonType[GamepadButtonType["Y"] = 18] = "Y";
|
|
23
|
+
GamepadButtonType[GamepadButtonType["BACK"] = 19] = "BACK";
|
|
24
|
+
GamepadButtonType[GamepadButtonType["START"] = 20] = "START";
|
|
25
|
+
GamepadButtonType[GamepadButtonType["GUIDE"] = 21] = "GUIDE";
|
|
26
|
+
GamepadButtonType[GamepadButtonType["SHARE"] = 22] = "SHARE";
|
|
27
|
+
GamepadButtonType[GamepadButtonType["OPTIONS"] = 23] = "OPTIONS";
|
|
28
|
+
GamepadButtonType[GamepadButtonType["PS"] = 24] = "PS";
|
|
29
|
+
GamepadButtonType[GamepadButtonType["CIRCLE"] = 25] = "CIRCLE";
|
|
30
|
+
GamepadButtonType[GamepadButtonType["SQUARE"] = 26] = "SQUARE";
|
|
31
|
+
GamepadButtonType[GamepadButtonType["TRIANGLE"] = 27] = "TRIANGLE";
|
|
32
|
+
})(GamepadButtonType || (GamepadButtonType = {}));
|
|
33
|
+
export var GamepadTriggerType;
|
|
34
|
+
(function (GamepadTriggerType) {
|
|
35
|
+
GamepadTriggerType["ONCE"] = "once";
|
|
36
|
+
GamepadTriggerType["CONTINUOUSLY"] = "continuously";
|
|
37
|
+
})(GamepadTriggerType || (GamepadTriggerType = {}));
|
|
38
|
+
export var GamepadCommandVersion;
|
|
39
|
+
(function (GamepadCommandVersion) {
|
|
40
|
+
GamepadCommandVersion["COMMANDS"] = "commands";
|
|
41
|
+
GamepadCommandVersion["CONTROLS"] = "controls";
|
|
42
|
+
GamepadCommandVersion["COMMANDS_V2"] = "commands-v2";
|
|
43
|
+
GamepadCommandVersion["RUN_JS"] = "run-js";
|
|
44
|
+
})(GamepadCommandVersion || (GamepadCommandVersion = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './GamepadConfig';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './GamepadConfig';
|
package/esm/models/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './Dashboard';
|
|
|
11
11
|
export * from './ExportDataQuery';
|
|
12
12
|
export * from './EventDefinition';
|
|
13
13
|
export * from './file/FileEnums';
|
|
14
|
+
export * from './gamepad';
|
|
14
15
|
export * from './graph';
|
|
15
16
|
export * from './HttpError';
|
|
16
17
|
export * from './IBaseService';
|
package/esm/models/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export * from './Dashboard';
|
|
|
11
11
|
export * from './ExportDataQuery';
|
|
12
12
|
export * from './EventDefinition';
|
|
13
13
|
export * from './file/FileEnums';
|
|
14
|
+
export * from './gamepad';
|
|
14
15
|
export * from './graph';
|
|
15
16
|
export * from './HttpError';
|
|
16
17
|
export * from './IBaseService';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AgentSettingsRequestItem, AgentSettingsResponse } from '../models/IRobotSettings';
|
|
2
2
|
import { CreateRobotDefinitionRequest, RobotProfile } from '../models/RobotProfile';
|
|
3
|
+
import { GamepadConfigItem, GamepadConfigResponse } from '../models/gamepad/GamepadConfig';
|
|
3
4
|
import { RocosError } from '../models/RocosError';
|
|
4
5
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
|
5
6
|
import { Dashboard } from '../models/Dashboard';
|
|
@@ -226,7 +227,7 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
|
|
|
226
227
|
* @param definitionId - Robot definition Id
|
|
227
228
|
* @description - Renamed from robotDefGetGamepads
|
|
228
229
|
*/
|
|
229
|
-
getGamepads(projectId: string, definitionId: string): Promise<
|
|
230
|
+
getGamepads(projectId: string, definitionId: string): Promise<GamepadConfigResponse>;
|
|
230
231
|
/** Export robot definition into JSON format
|
|
231
232
|
*
|
|
232
233
|
* Can be used to import robot definition into another project
|
|
@@ -265,5 +266,5 @@ export declare class ProfileService extends BaseServiceAbstract implements IBase
|
|
|
265
266
|
* @param model - \payload
|
|
266
267
|
* @description - Renamed from robotDefUpdateGamepads
|
|
267
268
|
*/
|
|
268
|
-
updateGamepads(projectId: string, definitionId: string, model:
|
|
269
|
+
updateGamepads(projectId: string, definitionId: string, model: GamepadConfigItem[]): Promise<void>;
|
|
269
270
|
}
|
|
@@ -321,7 +321,6 @@ export class ProfileService extends BaseServiceAbstract {
|
|
|
321
321
|
* @param definitionId - Robot definition Id
|
|
322
322
|
* @description - Renamed from robotDefGetGamepads
|
|
323
323
|
*/
|
|
324
|
-
// TODO: map the response object
|
|
325
324
|
async getGamepads(projectId, definitionId) {
|
|
326
325
|
return this.callGet(formatServiceUrl(API_PROJECT_DEFINITION_GAMEPAD_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), `Failed to get gamepads for ${projectId}, definitionId ${definitionId}.`);
|
|
327
326
|
}
|
|
@@ -377,9 +376,6 @@ export class ProfileService extends BaseServiceAbstract {
|
|
|
377
376
|
* @param model - \payload
|
|
378
377
|
* @description - Renamed from robotDefUpdateGamepads
|
|
379
378
|
*/
|
|
380
|
-
// TODO: map the request model
|
|
381
|
-
// TODO: map the response object
|
|
382
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
383
379
|
async updateGamepads(projectId, definitionId, model) {
|
|
384
380
|
return this.callPost(formatServiceUrl(API_PROJECT_DEFINITION_GAMEPAD_URL, { url: this.config.url, projectId, definitionId }, this.config.insecure), model, `Failed to update gamepads for ${projectId}, definitionId ${definitionId}.`);
|
|
385
381
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentSettingsResponse, IBaseService, IConnectedCallsign, IRobot, IRobotListItem, IRobotSettings, IRobotTemplate, IRocosSDKConfig, RocosError } from '../models';
|
|
1
|
+
import { AgentSettingsResponse, GamepadConfigItem, GamepadConfigResponse, IBaseService, IConnectedCallsign, IRobot, IRobotListItem, IRobotSettings, IRobotTemplate, IRocosSDKConfig, RocosError } from '../models';
|
|
2
2
|
import { BaseServiceAbstract } from './BaseServiceAbstract';
|
|
3
3
|
export declare class RobotService extends BaseServiceAbstract implements IBaseService {
|
|
4
4
|
constructor(config: IRocosSDKConfig);
|
|
@@ -272,7 +272,7 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
|
|
|
272
272
|
* @param projectId - Project Id
|
|
273
273
|
* @param callsign - Robot callsign
|
|
274
274
|
*/
|
|
275
|
-
getGamepads(projectId: string, callsign: string): Promise<
|
|
275
|
+
getGamepads(projectId: string, callsign: string): Promise<GamepadConfigResponse>;
|
|
276
276
|
/**
|
|
277
277
|
* Update gamepads for a robot
|
|
278
278
|
*
|
|
@@ -280,7 +280,7 @@ export declare class RobotService extends BaseServiceAbstract implements IBaseSe
|
|
|
280
280
|
* @param callsign - Robot callsign
|
|
281
281
|
* @param model - \payload
|
|
282
282
|
*/
|
|
283
|
-
updateGamepads(projectId: string, callsign: string, model:
|
|
283
|
+
updateGamepads(projectId: string, callsign: string, model: GamepadConfigItem[]): Promise<void>;
|
|
284
284
|
getConnectedCallsigns(projectId: string): Promise<Map<string, IConnectedCallsign>>;
|
|
285
285
|
getConnectedCallsign(projectId: string, callsign: string): Promise<IConnectedCallsign>;
|
|
286
286
|
}
|
|
@@ -446,7 +446,6 @@ export class RobotService extends BaseServiceAbstract {
|
|
|
446
446
|
* @param projectId - Project Id
|
|
447
447
|
* @param callsign - Robot callsign
|
|
448
448
|
*/
|
|
449
|
-
// TODO: map the response object
|
|
450
449
|
async getGamepads(projectId, callsign) {
|
|
451
450
|
return this.callGet(formatServiceUrl(API_PROJECT_ROBOT_GAMEPAD_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), `Failed to get gamepads for ${projectId}, callsign ${callsign}.`);
|
|
452
451
|
}
|
|
@@ -457,9 +456,6 @@ export class RobotService extends BaseServiceAbstract {
|
|
|
457
456
|
* @param callsign - Robot callsign
|
|
458
457
|
* @param model - \payload
|
|
459
458
|
*/
|
|
460
|
-
// TODO: map the request model
|
|
461
|
-
// TODO: map the response object
|
|
462
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
463
459
|
async updateGamepads(projectId, callsign, model) {
|
|
464
460
|
return this.callPost(formatServiceUrl(API_PROJECT_ROBOT_GAMEPAD_URL, { url: this.config.url, projectId, callsign }, this.config.insecure), model, `Failed to update gamepads for ${projectId}, callsign ${callsign}.`);
|
|
465
461
|
}
|