UNPKG

@wandelbots/wandelbots-js-react-components

Version:

React UI toolkit for building applications on top of the Wandelbots platform

113 lines 5.02 kB
import { type AutoReconnectingWebsocket } from "@wandelbots/nova-js"; import type { NovaClient, Pose } from "@wandelbots/nova-js/v2"; import { MotionStreamConnection } from "./MotionStreamConnection"; 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; }; export type JoggerMode = "jogging" | "trajectory" | "off"; export type JoggerOrientation = "coordsys" | "tool"; export declare class JoggerConnection { readonly motionStream: MotionStreamConnection; readonly options: JoggerConnectionOptions | undefined; ENDPOINT_JOGGING: string; ENDPOINT_TRAJECTORY: string; DEFAULT_MODE: JoggerMode; DEFAULT_TCP: string; DEFAULT_INIT_TIMEOUT: number; DEFAULT_ORIENTATION: JoggerOrientation; mode: JoggerMode; joggingSocket: AutoReconnectingWebsocket | null; trajectorySocket: AutoReconnectingWebsocket | null; timeout: number; tcp: string; 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: NovaClient, motionGroupId: string, options?: JoggerConnectionOptions): Promise<JoggerConnection>; constructor(motionStream: MotionStreamConnection, options?: JoggerConnectionOptions | undefined); setOptions(options: Partial<JoggerConnectionOptions>): Promise<void>; get motionGroupId(): string; get nova(): NovaClient; get numJoints(): number; stop(): Promise<void>; dispose(): Promise<void[]>; setJoggingMode(mode: JoggerMode, skipReinitializeIfSameMode?: boolean): Promise<void>; initializeJoggingWebsocket(): Promise<void>; /** * Jogging: Start rotation of a single robot joint at the specified velocity */ rotateJoints({ joint, direction, velocityRadsPerSec, }: { /** Index of the joint to rotate */ joint: number; /** Direction of rotation ("+" or "-") */ direction: "+" | "-"; /** Speed of the rotation in radians per second */ velocityRadsPerSec: number; }): Promise<void>; /** * 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<void>; /** * 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<void>; /** * 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<void>; } //# sourceMappingURL=JoggerConnection.d.ts.map