tjbot-ce 3.0.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/LICENSE +202 -0
- package/README.md +382 -0
- package/dist/camera/camera.d.ts +62 -0
- package/dist/camera/camera.d.ts.map +1 -0
- package/dist/camera/camera.js +155 -0
- package/dist/camera/camera.js.map +1 -0
- package/dist/camera/index.d.ts +18 -0
- package/dist/camera/index.d.ts.map +1 -0
- package/dist/camera/index.js +18 -0
- package/dist/camera/index.js.map +1 -0
- package/dist/config/config-types.d.ts +75 -0
- package/dist/config/config-types.d.ts.map +1 -0
- package/dist/config/config-types.generated.d.ts +495 -0
- package/dist/config/config-types.generated.d.ts.map +1 -0
- package/dist/config/config-types.generated.js +2 -0
- package/dist/config/config-types.generated.js.map +1 -0
- package/dist/config/config-types.js +175 -0
- package/dist/config/config-types.js.map +1 -0
- package/dist/config/index.d.ts +20 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +19 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/tjbot-config.d.ts +98 -0
- package/dist/config/tjbot-config.d.ts.map +1 -0
- package/dist/config/tjbot-config.js +309 -0
- package/dist/config/tjbot-config.js.map +1 -0
- package/dist/config/vendor/colors.yaml +61 -0
- package/dist/config/vendor/model-registry.yaml +275 -0
- package/dist/config/vendor/tjbot-config.schema.yaml +792 -0
- package/dist/config/vendor/tjbot.default.toml +452 -0
- package/dist/led/index.d.ts +20 -0
- package/dist/led/index.d.ts.map +1 -0
- package/dist/led/index.js +20 -0
- package/dist/led/index.js.map +1 -0
- package/dist/led/led-common-anode.d.ts +38 -0
- package/dist/led/led-common-anode.d.ts.map +1 -0
- package/dist/led/led-common-anode.js +79 -0
- package/dist/led/led-common-anode.js.map +1 -0
- package/dist/led/led-neopixel-spi.d.ts +60 -0
- package/dist/led/led-neopixel-spi.d.ts.map +1 -0
- package/dist/led/led-neopixel-spi.js +216 -0
- package/dist/led/led-neopixel-spi.js.map +1 -0
- package/dist/led/led-neopixel-ws281x.js +186 -0
- package/dist/led/led-neopixel.d.ts +57 -0
- package/dist/led/led-neopixel.d.ts.map +1 -0
- package/dist/led/led-neopixel.js +235 -0
- package/dist/led/led-neopixel.js.map +1 -0
- package/dist/microphone/index.d.ts +18 -0
- package/dist/microphone/index.d.ts.map +1 -0
- package/dist/microphone/index.js +18 -0
- package/dist/microphone/index.js.map +1 -0
- package/dist/microphone/microphone.d.ts +65 -0
- package/dist/microphone/microphone.d.ts.map +1 -0
- package/dist/microphone/microphone.js +179 -0
- package/dist/microphone/microphone.js.map +1 -0
- package/dist/rpi-drivers/index.d.ts +22 -0
- package/dist/rpi-drivers/index.d.ts.map +1 -0
- package/dist/rpi-drivers/index.js +22 -0
- package/dist/rpi-drivers/index.js.map +1 -0
- package/dist/rpi-drivers/rpi-detect.d.ts +24 -0
- package/dist/rpi-drivers/rpi-detect.d.ts.map +1 -0
- package/dist/rpi-drivers/rpi-detect.js +49 -0
- package/dist/rpi-drivers/rpi-detect.js.map +1 -0
- package/dist/rpi-drivers/rpi-driver.d.ts +116 -0
- package/dist/rpi-drivers/rpi-driver.d.ts.map +1 -0
- package/dist/rpi-drivers/rpi-driver.js +261 -0
- package/dist/rpi-drivers/rpi-driver.js.map +1 -0
- package/dist/rpi-drivers/rpi3-driver.d.ts +47 -0
- package/dist/rpi-drivers/rpi3-driver.d.ts.map +1 -0
- package/dist/rpi-drivers/rpi3-driver.js +145 -0
- package/dist/rpi-drivers/rpi3-driver.js.map +1 -0
- package/dist/rpi-drivers/rpi4-driver.d.ts +35 -0
- package/dist/rpi-drivers/rpi4-driver.d.ts.map +1 -0
- package/dist/rpi-drivers/rpi4-driver.js +101 -0
- package/dist/rpi-drivers/rpi4-driver.js.map +1 -0
- package/dist/rpi-drivers/rpi5-driver.d.ts +33 -0
- package/dist/rpi-drivers/rpi5-driver.d.ts.map +1 -0
- package/dist/rpi-drivers/rpi5-driver.js +78 -0
- package/dist/rpi-drivers/rpi5-driver.js.map +1 -0
- package/dist/servo/index.d.ts +19 -0
- package/dist/servo/index.d.ts.map +1 -0
- package/dist/servo/index.js +19 -0
- package/dist/servo/index.js.map +1 -0
- package/dist/servo/servo-constants.d.ts +33 -0
- package/dist/servo/servo-constants.d.ts.map +1 -0
- package/dist/servo/servo-constants.js +34 -0
- package/dist/servo/servo-constants.js.map +1 -0
- package/dist/servo/servo-lgpio.d.ts +82 -0
- package/dist/servo/servo-lgpio.d.ts.map +1 -0
- package/dist/servo/servo-lgpio.js +178 -0
- package/dist/servo/servo-lgpio.js.map +1 -0
- package/dist/speaker/audio-player.d.ts +30 -0
- package/dist/speaker/audio-player.d.ts.map +1 -0
- package/dist/speaker/audio-player.js +68 -0
- package/dist/speaker/audio-player.js.map +1 -0
- package/dist/speaker/index.d.ts +18 -0
- package/dist/speaker/index.d.ts.map +1 -0
- package/dist/speaker/index.js +18 -0
- package/dist/speaker/index.js.map +1 -0
- package/dist/speaker/speaker.d.ts +53 -0
- package/dist/speaker/speaker.d.ts.map +1 -0
- package/dist/speaker/speaker.js +125 -0
- package/dist/speaker/speaker.js.map +1 -0
- package/dist/stt/backends/azure-stt.d.ts +32 -0
- package/dist/stt/backends/azure-stt.d.ts.map +1 -0
- package/dist/stt/backends/azure-stt.js +227 -0
- package/dist/stt/backends/azure-stt.js.map +1 -0
- package/dist/stt/backends/google-cloud-stt.d.ts +31 -0
- package/dist/stt/backends/google-cloud-stt.d.ts.map +1 -0
- package/dist/stt/backends/google-cloud-stt.js +371 -0
- package/dist/stt/backends/google-cloud-stt.js.map +1 -0
- package/dist/stt/backends/ibm-watson-stt.d.ts +32 -0
- package/dist/stt/backends/ibm-watson-stt.d.ts.map +1 -0
- package/dist/stt/backends/ibm-watson-stt.js +190 -0
- package/dist/stt/backends/ibm-watson-stt.js.map +1 -0
- package/dist/stt/backends/sherpa-onnx-stt.d.ts +117 -0
- package/dist/stt/backends/sherpa-onnx-stt.d.ts.map +1 -0
- package/dist/stt/backends/sherpa-onnx-stt.js +694 -0
- package/dist/stt/backends/sherpa-onnx-stt.js.map +1 -0
- package/dist/stt/index.d.ts +20 -0
- package/dist/stt/index.d.ts.map +1 -0
- package/dist/stt/index.js +21 -0
- package/dist/stt/index.js.map +1 -0
- package/dist/stt/stt-engine.d.ts +68 -0
- package/dist/stt/stt-engine.d.ts.map +1 -0
- package/dist/stt/stt-engine.js +99 -0
- package/dist/stt/stt-engine.js.map +1 -0
- package/dist/stt/stt-utils.d.ts +36 -0
- package/dist/stt/stt-utils.d.ts.map +1 -0
- package/dist/stt/stt-utils.js +112 -0
- package/dist/stt/stt-utils.js.map +1 -0
- package/dist/stt/stt.d.ts +52 -0
- package/dist/stt/stt.d.ts.map +1 -0
- package/dist/stt/stt.js +100 -0
- package/dist/stt/stt.js.map +1 -0
- package/dist/tjbot.d.ts +317 -0
- package/dist/tjbot.d.ts.map +1 -0
- package/dist/tjbot.js +736 -0
- package/dist/tjbot.js.map +1 -0
- package/dist/tts/backends/azure-tts.d.ts +30 -0
- package/dist/tts/backends/azure-tts.d.ts.map +1 -0
- package/dist/tts/backends/azure-tts.js +92 -0
- package/dist/tts/backends/azure-tts.js.map +1 -0
- package/dist/tts/backends/google-cloud-tts.d.ts +38 -0
- package/dist/tts/backends/google-cloud-tts.d.ts.map +1 -0
- package/dist/tts/backends/google-cloud-tts.js +116 -0
- package/dist/tts/backends/google-cloud-tts.js.map +1 -0
- package/dist/tts/backends/ibm-watson-tts.d.ts +42 -0
- package/dist/tts/backends/ibm-watson-tts.d.ts.map +1 -0
- package/dist/tts/backends/ibm-watson-tts.js +99 -0
- package/dist/tts/backends/ibm-watson-tts.js.map +1 -0
- package/dist/tts/backends/sherpa-onnx-tts.d.ts +80 -0
- package/dist/tts/backends/sherpa-onnx-tts.d.ts.map +1 -0
- package/dist/tts/backends/sherpa-onnx-tts.js +237 -0
- package/dist/tts/backends/sherpa-onnx-tts.js.map +1 -0
- package/dist/tts/index.d.ts +19 -0
- package/dist/tts/index.d.ts.map +1 -0
- package/dist/tts/index.js +20 -0
- package/dist/tts/index.js.map +1 -0
- package/dist/tts/tts-engine.d.ts +67 -0
- package/dist/tts/tts-engine.d.ts.map +1 -0
- package/dist/tts/tts-engine.js +109 -0
- package/dist/tts/tts-engine.js.map +1 -0
- package/dist/tts/tts.d.ts +47 -0
- package/dist/tts/tts.d.ts.map +1 -0
- package/dist/tts/tts.js +101 -0
- package/dist/tts/tts.js.map +1 -0
- package/dist/utils/colors.d.ts +39 -0
- package/dist/utils/colors.d.ts.map +1 -0
- package/dist/utils/colors.js +155 -0
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/constants.d.ts +41 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +43 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/credentials.d.ts +43 -0
- package/dist/utils/credentials.d.ts.map +1 -0
- package/dist/utils/credentials.js +121 -0
- package/dist/utils/credentials.js.map +1 -0
- package/dist/utils/errors.d.ts +26 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +32 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +25 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +23 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logging.d.ts +44 -0
- package/dist/utils/logging.d.ts.map +1 -0
- package/dist/utils/logging.js +113 -0
- package/dist/utils/logging.js.map +1 -0
- package/dist/utils/model-registry.d.ts +142 -0
- package/dist/utils/model-registry.d.ts.map +1 -0
- package/dist/utils/model-registry.js +391 -0
- package/dist/utils/model-registry.js.map +1 -0
- package/dist/utils/utils.d.ts +33 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +50 -0
- package/dist/utils/utils.js.map +1 -0
- package/dist/vision/backends/azure-vision.d.ts +33 -0
- package/dist/vision/backends/azure-vision.d.ts.map +1 -0
- package/dist/vision/backends/azure-vision.js +151 -0
- package/dist/vision/backends/azure-vision.js.map +1 -0
- package/dist/vision/backends/google-cloud-vision.d.ts +32 -0
- package/dist/vision/backends/google-cloud-vision.d.ts.map +1 -0
- package/dist/vision/backends/google-cloud-vision.js +193 -0
- package/dist/vision/backends/google-cloud-vision.js.map +1 -0
- package/dist/vision/backends/onnx.d.ts +116 -0
- package/dist/vision/backends/onnx.d.ts.map +1 -0
- package/dist/vision/backends/onnx.js +781 -0
- package/dist/vision/backends/onnx.js.map +1 -0
- package/dist/vision/index.d.ts +19 -0
- package/dist/vision/index.d.ts.map +1 -0
- package/dist/vision/index.js +20 -0
- package/dist/vision/index.js.map +1 -0
- package/dist/vision/vision-engine.d.ts +131 -0
- package/dist/vision/vision-engine.d.ts.map +1 -0
- package/dist/vision/vision-engine.js +97 -0
- package/dist/vision/vision-engine.js.map +1 -0
- package/dist/vision/vision.d.ts +48 -0
- package/dist/vision/vision.d.ts.map +1 -0
- package/dist/vision/vision.js +83 -0
- package/dist/vision/vision.js.map +1 -0
- package/package.json +124 -0
package/dist/tjbot.d.ts
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2016-2025 IBM Corp. All Rights Reserved.
|
|
3
|
+
* Copyright 2026-present TJBot Contributors. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { TJBotConfigSchema } from './config/config-types.js';
|
|
18
|
+
import { TJBotConfig } from './config/tjbot-config.js';
|
|
19
|
+
import { RPiHardwareDriver } from './rpi-drivers/index.js';
|
|
20
|
+
import { Hardware } from './utils/index.js';
|
|
21
|
+
import { ModelType } from './utils/model-registry.js';
|
|
22
|
+
import { FaceDetectionMetadata, ImageClassificationResult, ImageDescriptionResult, ObjectDetectionResult } from './vision/index.js';
|
|
23
|
+
/**
|
|
24
|
+
* Class representing a TJBot
|
|
25
|
+
*/
|
|
26
|
+
declare class TJBot {
|
|
27
|
+
/**
|
|
28
|
+
* TJBot library version
|
|
29
|
+
* @readonly
|
|
30
|
+
*/
|
|
31
|
+
static VERSION: string;
|
|
32
|
+
/**
|
|
33
|
+
* Singleton instance
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
private static instance;
|
|
37
|
+
/**
|
|
38
|
+
* Hardware list
|
|
39
|
+
* @readonly
|
|
40
|
+
*/
|
|
41
|
+
static Hardware: typeof Hardware;
|
|
42
|
+
/**
|
|
43
|
+
* TJBot configuration
|
|
44
|
+
*/
|
|
45
|
+
config: TJBotConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Raspberry Pi model on which TJBot is running
|
|
48
|
+
* @example "Raspberry Pi 5"
|
|
49
|
+
*/
|
|
50
|
+
rpiModel: string;
|
|
51
|
+
/**
|
|
52
|
+
* Raspberry Pi hardware driver
|
|
53
|
+
*/
|
|
54
|
+
rpiDriver: RPiHardwareDriver;
|
|
55
|
+
/**
|
|
56
|
+
* Cache of the colors recognized by TJBot
|
|
57
|
+
*/
|
|
58
|
+
private _shineColors;
|
|
59
|
+
/**
|
|
60
|
+
* Flag to track if TJBot has been initialized
|
|
61
|
+
*/
|
|
62
|
+
private _initialized;
|
|
63
|
+
/**
|
|
64
|
+
* Promise for in-flight cleanup operation, if any.
|
|
65
|
+
*/
|
|
66
|
+
private _cleanupPromise;
|
|
67
|
+
/**
|
|
68
|
+
* Guard to ensure process lifecycle hooks are installed only once.
|
|
69
|
+
*/
|
|
70
|
+
private _processHooksInstalled;
|
|
71
|
+
/**
|
|
72
|
+
* Private constructor.
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
private constructor();
|
|
76
|
+
/**
|
|
77
|
+
* Get the singleton instance of TJBot.
|
|
78
|
+
* @returns {TJBot} The singleton TJBot instance
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
static getInstance(): TJBot;
|
|
82
|
+
/**
|
|
83
|
+
* Get recipe-specific configuration. This method can be used before calling `TJBot.getInstance().initialize()`
|
|
84
|
+
* in case a recipe needs to dynamically determine which hardware components should be configured.
|
|
85
|
+
* @param {string=} recipeConfigPath (optional) Path to recipe configuration file (default: recipe.toml in current working directory)
|
|
86
|
+
* @return {Record<string, unknown>} The recipe configuration as a key-value object. If no recipe configuration file is found, returns an empty object.
|
|
87
|
+
*
|
|
88
|
+
*/
|
|
89
|
+
static getRecipeConfig(recipeConfigPath?: string): Record<string, unknown>;
|
|
90
|
+
/**
|
|
91
|
+
* Initialize TJBot with configuration. Can be called multiple times to reconfigure.
|
|
92
|
+
* Performs cleanup of previous initialization, loads configuration, detects hardware,
|
|
93
|
+
* initializes all configured hardware and AI models eagerly.
|
|
94
|
+
* @param {Partial<TJBotConfigSchema>=} overrideConfig (optional) Configuration object to overlay on top of loaded config.
|
|
95
|
+
* @param {string=} recipeConfigPath (optional) Path to recipe configuration file (default: recipe.toml in current working directory)
|
|
96
|
+
* @throws {TJBotError} if configuration file cannot be loaded, is invalid, or cleanup fails
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
initialize(overrideConfig?: Partial<TJBotConfigSchema>, recipeConfigPath?: string): Promise<TJBot>;
|
|
100
|
+
/**
|
|
101
|
+
* Initialize hardware devices
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
private initializeHardware;
|
|
105
|
+
/**
|
|
106
|
+
* Eagerly initialize local AI models (STT, TTS, Vision) if configured
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
109
|
+
private initializeAIModels;
|
|
110
|
+
/**
|
|
111
|
+
* Clean up all resources. Called automatically before re-initialization.
|
|
112
|
+
* @throws {TJBotError} if cleanup fails
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
private cleanup;
|
|
116
|
+
/**
|
|
117
|
+
* Install process lifecycle hooks so TJBot hardware resources are cleaned up
|
|
118
|
+
* automatically when a recipe exits or is interrupted.
|
|
119
|
+
*/
|
|
120
|
+
private installProcessCleanupHooks;
|
|
121
|
+
/**
|
|
122
|
+
* Best-effort automatic cleanup path used by process lifecycle hooks.
|
|
123
|
+
* Uses a timeout in fatal/signal scenarios so process termination does not hang.
|
|
124
|
+
*/
|
|
125
|
+
private runLifecycleCleanup;
|
|
126
|
+
/**
|
|
127
|
+
* Change the level of TJBot's logging.
|
|
128
|
+
* @param {string} level Logging level (see Winston's [list of logging levels](https://github.com/winstonjs/winston?tab=readme-ov-file#using-logging-levels))
|
|
129
|
+
* @public
|
|
130
|
+
*/
|
|
131
|
+
setLogLevel(level: string): void;
|
|
132
|
+
/**
|
|
133
|
+
* Assert that TJBot is able to perform a specified capability.
|
|
134
|
+
* @private
|
|
135
|
+
* @param {string} capability The capability assert (see TJBot.prototype.capabilities).
|
|
136
|
+
*/
|
|
137
|
+
private assertCapability;
|
|
138
|
+
/**
|
|
139
|
+
* Sleep for the specified number of seconds.
|
|
140
|
+
* @param sec Number of seconds to sleep
|
|
141
|
+
*/
|
|
142
|
+
sleep(sec: number): Promise<void>;
|
|
143
|
+
/** ------------------------------------------------------------------------ */
|
|
144
|
+
/** LOCAL AI/ML MODELS */
|
|
145
|
+
/** ------------------------------------------------------------------------ */
|
|
146
|
+
/**
|
|
147
|
+
* List the AI/ML models on this device.
|
|
148
|
+
* @returns {string[]} Array of installed model keys
|
|
149
|
+
*/
|
|
150
|
+
getLocalModels(modelType?: ModelType, installedOnly?: boolean): string[];
|
|
151
|
+
/** ------------------------------------------------------------------------ */
|
|
152
|
+
/** LISTEN */
|
|
153
|
+
/** ------------------------------------------------------------------------ */
|
|
154
|
+
/**
|
|
155
|
+
* Listen for a spoken utterance (offline mode - returns transcript).
|
|
156
|
+
* @returns {Promise<string>} The transcribed text
|
|
157
|
+
* @throws {TJBotError} if the microphone hardware is not initialized
|
|
158
|
+
* @public
|
|
159
|
+
*/
|
|
160
|
+
listen(): Promise<string>;
|
|
161
|
+
/**
|
|
162
|
+
* Listen for a spoken utterance (streaming mode - uses callbacks).
|
|
163
|
+
* @param onPartialResult Callback for partial transcription results
|
|
164
|
+
* @param onFinalResult Callback for final transcription result
|
|
165
|
+
* @returns {Promise<void>} Promise that resolves when transcription completes
|
|
166
|
+
* @throws {TJBotError} if the microphone hardware is not initialized
|
|
167
|
+
* @public
|
|
168
|
+
*/
|
|
169
|
+
listen(onPartialResult: (text: string) => void, onFinalResult: (text: string) => void): Promise<void>;
|
|
170
|
+
/** ------------------------------------------------------------------------ */
|
|
171
|
+
/** SEE */
|
|
172
|
+
/** ------------------------------------------------------------------------ */
|
|
173
|
+
/**
|
|
174
|
+
* Capture an image and return it as a buffer.
|
|
175
|
+
* @return {Promise<Buffer>} The captured image as a buffer.
|
|
176
|
+
* @throws {TJBotError} if the camera hardware is not initialized
|
|
177
|
+
* @public
|
|
178
|
+
*/
|
|
179
|
+
see(): Promise<Buffer>;
|
|
180
|
+
/**
|
|
181
|
+
* Capture an image and save it in the given path.
|
|
182
|
+
* @param {string=} filePath (optional) Path at which to save the photo file. If not
|
|
183
|
+
* specified, photo will be saved in a temp location.
|
|
184
|
+
* @return {string} Path at which the photo was saved.
|
|
185
|
+
* @throws {TJBotError} if the camera hardware is not initialized
|
|
186
|
+
* @public
|
|
187
|
+
*/
|
|
188
|
+
look(filePath?: string): Promise<string>;
|
|
189
|
+
/**
|
|
190
|
+
* Detect objects in an image using the configured vision engine.
|
|
191
|
+
* @param {Buffer|string} image Image buffer or file path
|
|
192
|
+
* @returns {Promise<ObjectDetectionResult[]>}
|
|
193
|
+
*/
|
|
194
|
+
detectObjects(image: Buffer | string): Promise<ObjectDetectionResult[]>;
|
|
195
|
+
/**
|
|
196
|
+
* Classify an image using the configured vision engine.
|
|
197
|
+
* @param {Buffer|string} image Image buffer or file path
|
|
198
|
+
* @returns {Promise<ImageClassificationResult[]>}
|
|
199
|
+
*/
|
|
200
|
+
classifyImage(image: Buffer | string): Promise<ImageClassificationResult[]>;
|
|
201
|
+
/**
|
|
202
|
+
* Detect faces in an image using the configured vision engine.
|
|
203
|
+
* @param {Buffer|string} image Image buffer or file path
|
|
204
|
+
* @returns {Promise<{isFaceDetected: boolean, metadata: FaceDetectionMetadata[]}>}
|
|
205
|
+
*/
|
|
206
|
+
detectFaces(image: Buffer | string): Promise<{
|
|
207
|
+
isFaceDetected: boolean;
|
|
208
|
+
metadata: FaceDetectionMetadata[];
|
|
209
|
+
}>;
|
|
210
|
+
/**
|
|
211
|
+
* Describe an image using the configured vision engine (Azure only).
|
|
212
|
+
* @param {Buffer|string} image Image buffer or file path
|
|
213
|
+
* @returns {Promise<ImageDescriptionResult>}
|
|
214
|
+
*/
|
|
215
|
+
describeImage(image: Buffer | string): Promise<ImageDescriptionResult>;
|
|
216
|
+
/** ------------------------------------------------------------------------ */
|
|
217
|
+
/** SHINE */
|
|
218
|
+
/** ------------------------------------------------------------------------ */
|
|
219
|
+
/**
|
|
220
|
+
* Change the color of the LED.
|
|
221
|
+
* @param {string} color The color to shine the LED. May be specified in a number of
|
|
222
|
+
* formats, including: hexadecimal, (e.g. "0xF12AC4", "11FF22", "#AABB24"), "on", "off",
|
|
223
|
+
* or may be a named color in the `colornames` package. Hexadecimal colors
|
|
224
|
+
* follow an #RRGGBB format.
|
|
225
|
+
* @returns {Promise<void>} A promise that resolves when the LED color has been set.
|
|
226
|
+
* @see {@link https://github.com/timoxley/colornames|Colornames} for a list of color names.
|
|
227
|
+
* @throws {TJBotError} if the LED hardware is not initialized or if color is invalid
|
|
228
|
+
* @public
|
|
229
|
+
*/
|
|
230
|
+
shine(color: string): Promise<void>;
|
|
231
|
+
/**
|
|
232
|
+
* Pulse the LED a single time.
|
|
233
|
+
* @param {string} color The color to shine the LED. May be specified in a number of
|
|
234
|
+
* formats, including: hexadecimal, (e.g. "0xF12AC4", "11FF22", "#AABB24"), "on", "off",
|
|
235
|
+
* or may be a named color in the `colornames` package. Hexadecimal colors
|
|
236
|
+
* follow an #RRGGBB format.
|
|
237
|
+
* @param {float=} duration The duration the pulse should last. The duration should be in
|
|
238
|
+
* the range [0.5, 2.0] seconds.
|
|
239
|
+
* @returns {Promise<void>} A promise that resolves when the LED pulse animation completes.
|
|
240
|
+
* @see {@link https://github.com/timoxley/colornames|Colornames} for a list of color names.
|
|
241
|
+
* @throws {TJBotError} if the LED hardware is not initialized, color is invalid, or duration exceeds 2.0 seconds
|
|
242
|
+
* @public
|
|
243
|
+
*/
|
|
244
|
+
pulse(color: string, duration?: number): Promise<void>;
|
|
245
|
+
/**
|
|
246
|
+
* Get the list of all colors recognized by TJBot.
|
|
247
|
+
* @return {array} List of all named colors recognized by `shine()` and `pulse()`.
|
|
248
|
+
* @public
|
|
249
|
+
*/
|
|
250
|
+
shineColors(): string[];
|
|
251
|
+
/**
|
|
252
|
+
* Get a random color.
|
|
253
|
+
* @return {string} Random named color.
|
|
254
|
+
* @public
|
|
255
|
+
*/
|
|
256
|
+
randomColor(): string;
|
|
257
|
+
/** ------------------------------------------------------------------------ */
|
|
258
|
+
/** SPEAK */
|
|
259
|
+
/** ------------------------------------------------------------------------ */
|
|
260
|
+
/**
|
|
261
|
+
* Speak a message.
|
|
262
|
+
* @param {string} message The message to speak.
|
|
263
|
+
* @throws {TJBotError} if the speaker hardware is not initialized
|
|
264
|
+
* @public
|
|
265
|
+
*/
|
|
266
|
+
speak(message: string): Promise<void>;
|
|
267
|
+
/**
|
|
268
|
+
* Play a sound at the specified path.
|
|
269
|
+
* @param {string} soundFile The path to the sound file to be played.
|
|
270
|
+
* @public
|
|
271
|
+
*/
|
|
272
|
+
play(soundFile: string): Promise<void>;
|
|
273
|
+
/** ------------------------------------------------------------------------ */
|
|
274
|
+
/** WAVE */
|
|
275
|
+
/** ------------------------------------------------------------------------ */
|
|
276
|
+
/**
|
|
277
|
+
* Moves TJBot's arm all the way back. If this method doesn't move the arm all the way back, the servo motor stop point defined in TJBot.Servo.ARM_BACK may need to be overridden. Valid servo values are in the range [500, 2300].
|
|
278
|
+
* @throws {TJBotError} if the servo hardware is not initialized
|
|
279
|
+
* @returns {Promise<void>} Resolves when the arm is fully back.
|
|
280
|
+
* @example tj.armBack()
|
|
281
|
+
* @public
|
|
282
|
+
*/
|
|
283
|
+
armBack(): Promise<void>;
|
|
284
|
+
/**
|
|
285
|
+
* Raises TJBot's arm. If this method doesn't move the arm all the way back, the servo motor stop point defined in TJBot.Servo.ARM_UP may need to be overridden. Valid servo values are in the range [500, 2300].
|
|
286
|
+
* @throws {TJBotError} if the servo hardware is not initialized
|
|
287
|
+
* @returns {Promise<void>} Resolves when the arm is fully raised.
|
|
288
|
+
* @example tj.raiseArm()
|
|
289
|
+
* @public
|
|
290
|
+
*/
|
|
291
|
+
raiseArm(): Promise<void>;
|
|
292
|
+
/**
|
|
293
|
+
* Lowers TJBot's arm. If this method doesn't move the arm all the way back, the servo motor stop point defined in TJBot.Servo.ARM_DOWN may need to be overridden. Valid servo values are in the range [500, 2300].
|
|
294
|
+
* @throws {TJBotError} if the servo hardware is not initialized
|
|
295
|
+
* @returns {Promise<void>} Resolves when the arm is fully lowered.
|
|
296
|
+
* @example tj.lowerArm()
|
|
297
|
+
* @public
|
|
298
|
+
*/
|
|
299
|
+
lowerArm(): Promise<void>;
|
|
300
|
+
/**
|
|
301
|
+
* Waves TJBots's arm once.
|
|
302
|
+
* @throws {TJBotError} if the servo hardware is not initialized
|
|
303
|
+
* @returns {Promise<void>} Resolves when the wave is complete.
|
|
304
|
+
* @example tj.wave()
|
|
305
|
+
* @public
|
|
306
|
+
*/
|
|
307
|
+
wave(): Promise<void>;
|
|
308
|
+
}
|
|
309
|
+
/** ------------------------------------------------------------------------ */
|
|
310
|
+
/** MODULE EXPORTS */
|
|
311
|
+
/** ------------------------------------------------------------------------ */
|
|
312
|
+
/**
|
|
313
|
+
* Export TJBot!
|
|
314
|
+
*/
|
|
315
|
+
export { TJBot };
|
|
316
|
+
export default TJBot;
|
|
317
|
+
//# sourceMappingURL=tjbot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tjbot.d.ts","sourceRoot":"","sources":["../src/tjbot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAiD,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG1G,OAAO,EAGH,QAAQ,EAMX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EACH,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACxB,MAAM,mBAAmB,CAAC;AAmB3B;;GAEG;AACH,cAAM,KAAK;IACP;;;OAGG;IACH,MAAM,CAAC,OAAO,SAA8B;IAE5C;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAoB;IAE3C;;;OAGG;IACH,MAAM,CAAC,QAAQ,kBAAY;IAE3B;;OAEG;IACH,MAAM,EAAG,WAAW,CAAC;IAErB;;;OAGG;IACH,QAAQ,EAAG,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,EAAG,iBAAiB,CAAC;IAE9B;;OAEG;IACH,OAAO,CAAC,YAAY,CAAgB;IAEpC;;OAEG;IACH,OAAO,CAAC,YAAY,CAAkB;IAEtC;;OAEG;IACH,OAAO,CAAC,eAAe,CAA8B;IAErD;;OAEG;IACH,OAAO,CAAC,sBAAsB,CAAkB;IAEhD;;;OAGG;IACH,OAAO;IAKP;;;;OAIG;IACH,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