Files
Zos/Skills/@be/node_modules/jibo-expression-client/lib/dts/Expression.d.ts

171 lines
7.6 KiB
TypeScript

import { ClientRemoteObject, RemoteClient } from 'jibo-client-framework';
import { Event } from 'jibo-typed-events';
import { AnimationInstance } from './AnimationInstance';
import { AnimationOptions, AcquireOptions, AttentionMode, CenterOptions, CleanupOptions, IndexRobotResult, AwaitFaceOptions, KinematicFeatures } from 'jibo-common-types';
import { AttentionHandle } from './handles/AttentionHandle';
import { AcquireHandle } from './handles/AcquireHandle';
import { AwaitFaceHandle } from './handles/AwaitFaceHandle';
import { DOFSets, DOFSet } from 'animation-utilities';
/**
* @description
* Jibo's Expression Client
* @namespace jibo.expression
*/
declare class Expression extends ClientRemoteObject {
protected client: RemoteClient;
/**
* @interface ExpressionEvents
* @description Typed Events for expression module (`jibo.expression.events`)
* @prop {Event<DOFEventData>} dofs
* @prop {Event<KinematicFeatures>} kinematics
*/
/**
* Results returned when await face is resolved.
* @interface DOFEventData
* @prop {number[]} timestamp
* @prop {Object} dofValues Associative array of dof names to values.
* @prop {Object} metadata Any metadata associated with display values.
*/
/**
* A set of event emitters that capture high frequency updates from the expression service
* @type {ExpressionEvents}
* @name jibo.expression#events
*/
events: {
dofs: Event<{
timestamp: [number, number];
dofValues: any;
metadata: any;
}>;
kinematics: Event<KinematicFeatures>;
};
/**
* A convienent assortment of DOF sets for playing animations.
* @type {DOFSets}
* @name jibo.expression#dofs
*/
dofs: DOFSets;
/**
* The most current `KinematicFeatures` received by the expression client.
* @type {KinematicFeatures}
* @name jibo.expression#features
*/
features: KinematicFeatures;
constructor(client: RemoteClient);
init(jibo: any): Promise<void>;
/**
* Creates an animation object on the expression server. If no `cacheName` is added, this animation will
* persist on the server forever. Returns a `Promise` that resolves to an `AnimationInstance`.
* @param {AnimationOptions} options Options to specify.
* @returns {Promise<AnimationInstance>} Resolves to an `AnimationInstance`.
* @method jibo.expression#createAnimation
*/
createAnimation(options: AnimationOptions<DOFSet>): Promise<AnimationInstance>;
/**
* Creates and immediately plays an animation on the expression server.
* Returns a `Promise` that resolves to an `AnimationInstance`.
* Event handlers for `stopped`, `cancelled`, `rejected`, and other animation events must be registered to the
* `AnimationInstance` immediately (in-stack) upon promise resolution, or else they may be missed.
* @param {AnimationOptions} options Options to specify.
* @param {string} [requestor='Behavior'] The system making the animation request.
* @returns {Promise<AnimationInstance>} Resolves to an `AnimationInstance`.
* @method jibo.expression#createAndPlayAnimation
*/
createAndPlayAnimation(options: AnimationOptions<DOFSet>, requestor?: string): Promise<AnimationInstance>;
/**
* Destroys caches saved in the expression service.
* @param {(string|string[])} cacheNames A cache name or array of cacheNames to destroy.
* @returns {Promise<void>}
* @method jibo.expression#destroyCaches
*/
destroyCaches(cacheNames: string | string[]): Promise<void>;
/**
* @description Move Jibo's face to look at a target.
* @method jibo.expression#acquireTarget
* @param {AcquireOptions} options Options to specify.
* @returns {Promise<AcquireHandle>}
*/
acquireTarget(options: AcquireOptions): Promise<AcquireHandle>;
/**
* Sets the mode of attention.
* @param {AttentionMode} mode Mode to set.
* @returns {Promise<void>}
* @method jibo.expression#setAttentionMode
*/
setAttentionMode(mode: AttentionMode): Promise<void>;
/**
* Sets the mode governing the attention system's behavior for a bounded time period.
* Returns a promise to an `AttentionHandle` which MUST have `release()` called on it when
* the caller is finished with the mode.
*
* Modes are maintained in a stack: the most recent call to `pushMode` will always win, and when
* a handle is released, it will drop down to mode of the highest non-released mode.
*
* Mode stack is fully cleared when `setMode` is called, and that mode becomes the base mode
* for when a stack is fully released.
*
* @method jibo.expression#pushAttentionMode
* @param {AttentionMode} mode - The new attention system mode: `IDLE`, `ENGAGED`, `SPEAKING`, `OFF`, etc.
* @return {Promise<AttentionHandle>} The handle for this mode request. MUST call `release()` on this handle when finished.
*/
pushAttentionMode(mode: AttentionMode): Promise<AttentionHandle>;
/**
* Gets the current mode of the attention system.
* @method jibo.expression#getAttentionMode
* @returns {AttentionMode} The current attention system mode.
*/
getAttentionMode(): Promise<AttentionMode>;
/**
* Sets the color of the LED.
* @param {number[]} color An array or RGB values with range of `[0,1]`.
* @method jibo.expression#setLEDColor
* @returns {Promise<void>}
*/
setLEDColor(color: [number, number, number]): Promise<void>;
/**
* Asynchronously waits for a face to appear.
* Returns a promise that resolves to a cancelable handle with a promise that will resolve when a face is detected or timeout is reached.
* Faces that are already in view "count" - so, the command may resolve quickly if people are already present.
* @method jibo.expression#awaitFace
* @param {AwaitFaceOptions} options - Options to specify.
* @return {Promise<AwaitFaceHandle>} A promise that resolves to a cancelable command handle.
*/
awaitFace(options?: AwaitFaceOptions): Promise<AwaitFaceHandle>;
/**
* Centers the robot in an upright position.
* @param {CenterOptions} [options] Options to specify.
* @method jibo.expression#centerRobot
* @returns {Promise<void>} Resolves when done centering.
*/
centerRobot(options?: CenterOptions<DOFSet>): Promise<void>;
/**
* Cleans up the currently animated state, centering the robot and releasing ownership for the next use site.
* @param {CleanupOptions} [options] Cleanup options.
* @method jibo.expression#cleanup
* @returns {Promise<void>} Resolves when the cleanup command is sent to the expression system.
*/
cleanup(options?: CleanupOptions<DOFSet>): Promise<void>;
/**
* Fully indexes the robot.
* @returns {Promise<IndexRobotResult>} Resolves when done indexing.
* @method jibo.expression#indexRobot
*/
indexRobot(): Promise<IndexRobotResult>;
setSkillRoot(root: string): Promise<void>;
/**
* Makes Jibo perform a procedural blink.
* @returns {Promise<void>} Resolves when the expression system receives the blink command.
* @method jibo.expression#blink
*/
blink(): Promise<void>;
/**
* Allow or disallow the expression service to move into a final pose when shutting down.
*/
doCenterRobotOnDisconnect(allow: boolean): Promise<void>;
private sendEmotionState();
private onDofEvent(timestamp, dofValues, metadata);
private onKinematicEvent(features);
private applyVec(to, from);
}
export default Expression;