export type Timestamp = import("google-protobuf/google/protobuf/timestamp_pb").Timestamp; export type LeaseProto = import("../../src/bosdyn/api/lease_pb").Lease; export type Robot = import("../bosdyn-client/robot").Robot; export type TimeSyncEndpoint = import("../bosdyn-client/time_sync").TimeSyncEndpoint; /** * @typedef {import('google-protobuf/google/protobuf/timestamp_pb').Timestamp} Timestamp * @typedef {import('../../src/bosdyn/api/lease_pb').Lease} LeaseProto */ /** * @typedef {import('../bosdyn-client/robot').Robot} Robot */ /** * @typedef {import('../bosdyn-client/time_sync').TimeSyncEndpoint} TimeSyncEndpoint */ /** * Client for Choreography Service. * @extends {BaseClient} */ export class ChoreographyClient extends BaseClient { static defaultServiceName: string; static licenseName: string; static serviceType: string; constructor(); /** * The timesync endpoint used to synchronize the client with the robot's time. * This is an instance of `TimeSyncEndpoint` that is initialized from the BaseClient. * * It is set by calling `updateFrom(other)` and retrieving the endpoint from the `timeSync` * property of another client instance. * If this client has not been updated or the time synchronization fails, the endpoint will * remain `null`. * * @type {?TimeSyncEndpoint} * @private */ private _timesyncEndpoint; /** * @param {Robot} other */ updateFrom(other: Robot): Promise; /** * Timesync endpoint for the robot * @type {TimeSyncEndpoint} * @throws {NoTimeSyncError} */ get timesyncEndpoint(): TimeSyncEndpoint; /** * Get a list of the different choreography sequence moves and associated parameters. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ listAllMoves(args?: Object): Promise; /** * Get a list of all sequences currently known about by the robot. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ listAllSequences(args?: Object): Promise; /** * Upload the choreography sequence to the robot. * @param {choreographySequencePb.ChoreographySequence} choreographySeq The dance sequence to be * sent and stored on the robot. * @param {boolean} nonStrictParsing If true, the robot will fix any correctable errors within * the choreography and allow users to run the dance. If false, if there are errors * the robot will reject the choreography when attempting to run the dance. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ uploadChoreography(choreographySeq: choreographySequencePb.ChoreographySequence, nonStrictParsing?: boolean, args?: Object): Promise; /** * @deprecated Misspelled: use uploadChoreography(). */ uploadChoregraphy(choreographySeq: any, nonStrictParsing: boolean | undefined, args: any): Promise; /** * Upload the animation proto to the robot to be used as a move in choreography sequences. * @param {choreographySequencePb.Animation} animation The animated move protobuf message. This * can be generated by converting a `cha` file using the animationFileToProto helpers. * @param {string} generatedId The ID hash generated for the animation based on the serialization * of the protobuf message. This can be left empty, and the robot will re-parse and * validate the message. This will be filled out automatically when using the AnimationUploadHelper. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ uploadAnimatedMove(animation: choreographySequencePb.Animation, generatedId?: string, args?: Object): Promise; /** * Get the dance related status information for a robot and the local time for which it was valid. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise<{ status: choreographySequencePb.ChoreographyStatusResponse, clientTime: number }>} */ getChoreographyStatus(args?: Object): Promise<{ status: choreographySequencePb.ChoreographyStatusResponse; clientTime: number; }>; /** * Turn the choreography log from the proto into an animation `cha` file type. * @param {string} name Name that the `cha` file will be saved as. * @param {string} fpath Location where the new `cha` file will be saved. * @param {boolean} hasArm True if the robot has an arm, false if the robot doesn't have an arm. * When False arm motion won't be added to the `cha` file. * @param {...(string|string[])} args String(s), array of strings, or a mix of string(s) and list(s) that are the * options to be included in the `cha` file. (ex. 'truncatable') * @returns {Promise} The filename of the new animation `cha` file, once it is written. */ choreographyLogToAnimationFile(name: string, fpath: string, hasArm: boolean, ...args: (string | string[])[]): Promise; /** * Provide a time to execute the choreography sequence instead the value passed in by * executeChoreography. Useful for when multiple robots are performing a synced * performance, and all robots should begin dancing at the same time. * @param {number} overrideClientStartTime The time (in seconds) that the dance should start. This time * should be provided in the local clock's timeframe and the client will convert it * to the required robot's clock timeframe. * @param {number} timeDifference The acceptable time difference in seconds between an ExecuteChoreographyRequest * start time and the override time where the overrideClientStartTime will be used instead of the start time * specified by the ExecuteChoreographyRequest. If not set will default to 20s. Maximum timeDifference is * 2 minutes. * @param {number} validityTime How far in the future, in seconds from the current time, can the * overrideClientStartTime be. If not set will default to 60s. Maximum validity_time is 5 minutes. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ choreographyTimeAdjust(overrideClientStartTime: number, timeDifference?: number, validityTime?: number, args?: Object): Promise; /** * Execute the current choreography sequence loaded on the robot by name. * @param {string} choreographyName The name of the uploaded choreography to run. The robot * only stores a single choreography at a time, so this name should match the last * uploaded choreography. * @param {number} clientStartTime The time (in seconds) that the dance should start. This time * should be provided in the local clock's timeframe and the client will convert it * to the required robot's clock timeframe. * @param {number} choreographyStartingSlice Which slice to start the dance at when the start * time is reached. By default, it will start with the first slice. * @param {LeaseProto|null} lease A specific lease to use for the request. If nothing is * provided, the client will append the next lease sequence in this field by default. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ executeChoreography(choreographyName: string, clientStartTime: number, choreographyStartingSlice: number, lease?: LeaseProto | null, args?: Object): Promise; /** * Sends commands to interact with individual choreography moves. * @param {choreographySequencePb.MoveCommand[]} commandList The commands. Each command interacts * with a single individual move. * @param {number} clientEndTime The time (in seconds) that the command stops being valid. This time * should be provided in the local clock's timeframe and the client will convert it * to the required robot's clock timeframe. * @param {LeaseProto|null} lease A specific lease to use for the request. If nothing is * provided, the client will append the next lease sequence in this field by default. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ choreographyCommand(commandList: choreographySequencePb.MoveCommand[], clientEndTime: number, lease?: LeaseProto | null, args?: Object): Promise; /** * Tell the robot its legs are a non-standard size to help avoid self-collision. Typically used for robots that are * wearing costumes. * Configuration will be permanently stored (persisting through reboot) until cleared by sending an empty request. * @param {choreographySequencePb.LegSize|number[]} frontLeftSize New leg configuration dimensions for the front * left leg. Either * a LegSize message or a list of 4 floats. If null, all config values are set to zero. * @param {choreographySequencePb.LegSize|number[]} frontRightSize Same as frontLeftSize, but for the front right leg. * @param {choreographySequencePb.LegSize|number[]} hindLeftSize Same as frontLeftSize, but for the hind left leg. * @param {choreographySequencePb.LegSize|number[]} hindRightSize Same as frontLeftSize, but for the hind right leg. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ legSizeConfiguration(frontLeftSize?: choreographySequencePb.LegSize | number[], frontRightSize?: choreographySequencePb.LegSize | number[], hindLeftSize?: choreographySequencePb.LegSize | number[], hindRightSize?: choreographySequencePb.LegSize | number[], args?: Object): Promise; /** * Read the current leg size configuration from the robot. On a robot with the default leg size configuration the * values for each leg's LegSize will be: * distance_inward = 0.02 m * distance_outward = 0.02 m * distance_forward = 0.035 m * distance_backward = 0.035 m * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ legSizeConfigurationState(args?: Object): Promise; /** * Start (or continue) a manually recorded robot state log. * @param {number} durationSecs The duration of the recording request in seconds. This will * apply from when the StartRecording rpc is received. * @param {number} [continueSessionId=0] If provided, the RPC will continue the recording * session associated with that ID. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ startRecordingState(durationSecs: number, continueSessionId?: number, args?: Object): Promise; /** * Stop recording a manual choreography log. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ stopRecordingState(args?: Object): Promise; /** * Get a sequence currently known by the robot, response includes the full * ChoreographySequence with the given name and any Animations used in the sequence. * @param {string} seqName the name of the sequence to return. * @param {boolean} returnAnimationNamesOnly If True, skip returning a list of the complete * Animation protos required by the sequence and leave the 'animated_moves' field of * the response empty. (The repeated string field, 'animationNames' for the list * of the names of required animations will still be returned). * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ getChoreographySequence(seqName: string, returnAnimationNamesOnly?: boolean, args?: Object): Promise; /** * Get an animation currently known by the robot, response includes the full * Animation proto with the given name. * @param {string} name the name of the animation to return. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ getAnimation(name: string, args?: Object): Promise; /** * Save an uploaded sequence to the robot. Saved sequences are * automatically uploaded to the robot when it boots. * @param {string} seqName Name of the sequence to be added to the selection of retained sequences * @param {string[]} labels List of labels to add to the sequence when it is being saved * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ saveSequence(seqName: string, labels?: string[], args?: Object): Promise; /** * Delete a sequence from temporary robot memory and delete any copies of the sequence saved to disk. * @param {string} seqName Name of the sequence to delete. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ deleteSequence(seqName: string, args?: Object): Promise; /** * Modifies a sequence's ChoreographyInfo field to remove or add any labels attached to the sequence. * @param {string} seqName Name of the sequence to be modified * @param {string[]} addLabels Labels to be added to the sequence's metadata * @param {string[]} removeLabels Labels to be removed from the sequence's metadata * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ modifyChoreographyInfo(seqName: string, addLabels?: string[], removeLabels?: string[], args?: Object): Promise; /** * Completely clears all choreography files that are saved on the robot, including animation proto files. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ clearAllSequenceFiles(args?: Object): Promise; /** * Download the manual or automatically collected logs for choreography robot state. * @param {choreographySequencePb.DownloadRobotStateLogRequest.LogType} logType Type of log, either manual or the * automatically generated log for the latest choreography. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise<{ * initialStatus: choreographySequencePb.DownloadRobotStateLogResponse.Status, * choreographyLog: choreographySequencePb.ChoreographyStateLog * }>} */ downloadRobotStateLog(logType: choreographySequencePb.DownloadRobotStateLogRequest.LogType, args?: Object): Promise<{ initialStatus: choreographySequencePb.DownloadRobotStateLogResponse.Status; choreographyLog: choreographySequencePb.ChoreographyStateLog; }>; /** * Generate the ChoreographyTimeAdjustRequest rpc with the timestamp converted into robot time. */ buildChoreographyTimeAdjustRequest(overrideClientStartTime: any, timeDifference: any, validityTime: any): choreographySequencePb.ChoreographyTimeAdjustRequest; /** * Generate the ExecuteChoreographyRequest rpc with the timestamp converted into robot time. */ buildExecuteChoreographyRequest(choreographyName: any, clientStartTime: any, choreographyStartingSlice: any, lease?: null): choreographySequencePb.ExecuteChoreographyRequest; buildChoreographyCommandRequest(commandList: any, clientEndTime: any, lease?: null): choreographySequencePb.ChoreographyCommandRequest; /** * Generate a StartRecordingStateRequest proto. */ buildStartRecordingStateRequest(durationSeconds?: null, continueSessionId?: number): choreographySequencePb.StartRecordingStateRequest; buildSaveSequenceRequest(sequenceName: any, labels?: any[]): choreographySequencePb.SaveSequenceRequest; buildModifyChoreographyInfoRequest(sequenceName: any, addLabels?: any[], removeLabels?: any[]): choreographySequencePb.ModifyChoreographyInfoRequest; /** * Build and return a LegSize message from provided dimensions. */ buildLegSize(distInward?: number, distOutward?: number, distForward?: number, distBackward?: number): choreographySequencePb.LegSize; /** * Build a LegSizeConfigurationRequest. */ buildLegSizeConfigurationRequest(frontLeftSize?: null, frontRightSide?: null, hindLeftSize?: null, hindRightSize?: null): choreographySequencePb.LegSizeConfigurationRequest; _updateTimestampFilter(timestamp: any, timesyncEndpoint: any): import("google-protobuf/google/protobuf/timestamp_pb").Timestamp; } /** * Helper class to reduce re-uploading animations to a robot multiple times. * This class will generate a hash (unique ID built from the animation protobuf * message's contents) for each animation proto, and include this hash when initially * uploading animations. It will track the animations sent to the robot and the hashes, and * only sends RPCs to upload an animation when the incoming animation proto is different * from the one on robot. * * It initializes the set of known animations on robot already by using the ListAllMoves * RPC and reading the existing animation names and hashes. * * The hash function is generated using a library which guarantees consistency, even when * restarting the program. As well, the hash is built from the serialized protobuf, and * proto guarantees that within the language that the serialized message will be consistent. */ export class AnimationUploadHelper { static ANIMATION_MOVE_PREFIX: string; /** * @param {Robot} robot The robot to upload animations to. */ constructor(robot: Robot); /** * A robot instance to upload animations to. * @type {Robot} */ robot: Robot; /** * An object that stored animation name to generated id * @type {Object} */ animationNameToGeneratedId: { [x: string]: string; }; /** * Determine which animations are already uploaded on robot. */ initialize(): Promise; /** @type {ChoreographyClient} */ choreographyClient: ChoreographyClient | undefined; /** * Uploads the animation to robot if the animation protobuf has changed. * * This will only send an UploadAnimatedMove RPC if the incoming animation * has a new hash that differs from the current hash for this animation on robot, which * indicates that the animation protobuf has changed since the last one uploaded to robot. * @param {choreographySequencePb.Animation} animation Animation to maybe upload. * @param {Object} [args] Extra arguments for controlling RPC details. * @returns {Promise} */ uploadAnimatedMove(animation: choreographySequencePb.Animation, args?: Object): Promise; /** * Serialize an Animation protobuf message and create a hash from the binary string. * * NOTE: Protobuf's serialization will not be consistent across protobuf versions or * even just different languages serializing the same protobuf message. This means that for a * single protobuf message, there could be multiple different serializations. This is ok for the * use-case of the AnimationUploadHelper since the ids are only used for a specific * "session" of Choreographer and the robot's boot session. These are not meant to be the same * for forever and ever due to the potential inconsistencies mentioned, and should not be used * with that expectation. * * Further, if a single animation proto does not generate the same ID for one "session", then * it will just be re-uploaded and processed by the robot again. * @param {choreographySequencePb.Animation} animationProto Animation to generate a hash for. * @returns {string} */ generateAnimationId(animationProto: choreographySequencePb.Animation): string; } /** The uploaded choreography is invalid and unable to be performed. */ export class InvalidUploadedChoreographyError extends ResponseError { } /** A problem occurred when issuing the robot command containing the dance. */ export class RobotCommandIssuesError extends ResponseError { } /** Incorrect or invalid leases for the choreography service. Check the lease use results. */ export class LeaseError extends ResponseError { } /** The uploaded animation file is invalid and cannot be used in choreography sequences. */ export class AnimationValidationFailedError extends ResponseError { } /** The animation being uploaded was rejected because the robot was actively dancing. */ export class AnimationRejectedDanceActiveError extends ResponseError { } /** The choreography service has no logged robot state data. */ export class NoRecordedInformation extends ResponseError { } /** The recording request contains an unknown recording session ID. */ export class UnknownRecordingSessionId extends ResponseError { } /** The recording buffer is full and the current manual log will be truncated. */ export class RecordingBufferFull extends ResponseError { } /** The recording buffer filled up, the returned log will be truncated (not used, like in Python). */ export class IncompleteData extends ResponseError { } /** * Read a choreography sequence file into a protobuf ChoreographySequence message. * @param {string} filePath The file containing binary data * @returns {choreographySequencePb.ChoreographySequence} */ export function loadChoreographySequenceFromBinaryFile(filePath: string): choreographySequencePb.ChoreographySequence; /** * Read a choreography sequence txt file (the protobuf text format) into a protobuf ChoreographySequence message. * @param {string} filePath * @returns {choreographySequencePb.ChoreographySequence} * @throws {Error} The file is not found. * @throws {textFormat.ParseError} The file is not the text of a ChoreographySequence. */ export function loadChoreographySequenceFromTxtFile(filePath: string): choreographySequencePb.ChoreographySequence; /** * Saves a choreography sequence to a file. * @param {string} filePath The path to save the file * @param {string} fileName The file name * @param {choreographySequencePb.ChoreographySequence} choreography The choreography sequence to save */ export function saveChoreographySequenceToFile(filePath: string, fileName: string, choreography: choreographySequencePb.ChoreographySequence): void; import { ChoreographyServiceClient } from "../../src/bosdyn/api/spot/choreography_service_grpc_pb"; import { BaseClient } from "../bosdyn-client/common"; import choreographySequencePb = require("../../src/bosdyn/api/spot/choreography_sequence_pb"); import { ResponseError } from "../bosdyn-client/exceptions";