import { type AutoReconnectingWebsocket } from "@wandelbots/nova-js"; import { type Pose } from "@wandelbots/nova-js/v2"; import { MotionStreamConnection } from "./MotionStreamConnection"; import type { AnyNovaClient } from "./novaCompat"; export type Vector3Simple = [number, number, number]; export type JoggerConnectionOptions = { mode?: JoggerMode; timeout?: number; /** * When an error message is received from the jogging websocket, it * will be passed here. If this handler is not provided, the error will * instead be thrown as an unhandled error. */ onError?: (err: unknown) => void; tcp?: string; orientation?: JoggerOrientation; /** Cell id on the Nova instance. Defaults to "cell". */ cellId?: string; }; export type JoggerMode = "jogging" | "trajectory" | "off"; export type JoggerOrientation = "coordsys" | "tool"; export declare class JoggerConnection { readonly motionStream: MotionStreamConnection; readonly options: JoggerConnectionOptions | undefined; DEFAULT_MODE: JoggerMode; DEFAULT_TCP: string | undefined; NO_TCP: string | undefined; DEFAULT_INIT_TIMEOUT: number; DEFAULT_ORIENTATION: JoggerOrientation; mode: JoggerMode; joggingSocket: AutoReconnectingWebsocket | null; trajectorySocket: AutoReconnectingWebsocket | null; timeout: number; tcp: string | undefined; orientation: JoggerOrientation; onError?: (err: unknown) => void; onBlocked?: () => void; /** * Initialize the jogging connection using jogging endpoint or trajectory endpoint depending on the selected mode. * * @param nova - The Nova client instance * @param motionGroupId - The ID of the motion group to connect to * @param options - Configuration options for the jogger connection * @param options.mode - The jogging mode to initialize: * - "jogging": Continuous jogging mode with persistent websocket for real-time velocity commands * - "trajectory": Incremental jogging mode for fixed-distance motions via trajectory planning * - "off": No jogging enabled, all websockets closed (default) * @param options.timeout - Timeout in milliseconds for websocket initialization (default: 5000ms) * @param options.tcp - TCP frame to use for motions (default: from motion group) * //param options.coordinateSystem - Coordinate system for jogging commands (default: "world"). Please note: Currently not implemented * @param options.orientation - If set to "tool", jogging TcpVelocityRequest will use `use_tool_coordinate_system` option (default: "coordsys") * @param options.onError - Error handler for websocket errors * @returns Promise resolving to initialized JoggerConnection instance */ static open(nova: AnyNovaClient, motionGroupId: string, options?: JoggerConnectionOptions): Promise; constructor(motionStream: MotionStreamConnection, options?: JoggerConnectionOptions | undefined); getDefaultTcp(motionStream: MotionStreamConnection): string | undefined; setOptions(options: Partial): Promise; get motionGroupId(): string; get nova(): import("@wandelbots/nova-js/v2").Nova; get cellId(): string; get numJoints(): number; stop(): Promise; dispose(): Promise; setJoggingMode(mode: JoggerMode, skipReinitializeIfSameMode?: boolean): Promise; initializeJoggingWebsocket(): Promise; /** * Jogging: Start rotation of a single robot joint at the specified velocity */ rotateJoints({ joint, direction, velocityValue, velocityUnit, }: { /** Index of the joint to rotate */ joint: number; /** Direction of rotation ("+" or "-") */ direction: "+" | "-"; /** Speed of the rotation, unit is currently unused, but i wanted it there to raise awareness that not everything here is rad/s*/ velocityValue: number; velocityUnit: "mm/s" | "rad/s"; }): Promise; /** * Jogging: Start the TCP moving along a specified axis at a given velocity */ translateTCP({ axis, direction, velocityMmPerSec, }: { axis: "x" | "y" | "z"; direction: "-" | "+"; velocityMmPerSec: number; }): Promise; /** * Jogging: Start the TCP rotating around a specified axis at a given velocity */ rotateTCP({ axis, direction, velocityRadsPerSec, }: { axis: "x" | "y" | "z"; direction: "-" | "+"; velocityRadsPerSec: number; }): Promise; /** * Trajectory jogging: * * Move the robot by a fixed distance in a single cartesian * axis, either rotating or translating relative to the TCP. * Promise resolves only after the motion has completed. */ runIncrementalCartesianMotion({ currentTcpPose, currentJoints, velocityInRelevantUnits, axis, direction, motion, }: { currentTcpPose: Pose; currentJoints: Vector3Simple; coordSystemId: string; velocityInRelevantUnits: number; axis: "x" | "y" | "z"; direction: "-" | "+"; motion: { type: "rotate"; distanceRads: number; } | { type: "translate"; distanceMm: number; }; }): Promise; } export default JoggerConnection;