UNPKG

dynamixel

Version:

Node.js library for controlling DYNAMIXEL servo motors via U2D2 interface with Protocol 2.0 support

90 lines (89 loc) 2.64 kB
/** * U2D2 USB to TTL connection handler (ES Module version) * Manages USB communication with DYNAMIXEL devices through U2D2 */ export class U2D2Connection extends EventEmitter<[never]> { /** * List available USB devices * @returns {Array} - Array of USB devices */ static listUSBDevices(): any[]; /** * Get system information * @returns {Object} - System information */ static getSystemInfo(): Object; /** * Perform USB diagnostics * @returns {Object} - Diagnostic results */ static performUSBDiagnostics(): Object; constructor(options?: {}); device: any; interface: any; endpoint: any; timeout: any; isConnected: boolean; receiveBuffer: Buffer<ArrayBuffer>; /** * Find and connect to U2D2 device * @returns {Promise<boolean>} - Success status */ connect(): Promise<boolean>; inEndpoint: any; outEndpoint: any; /** * Disconnect from U2D2 device */ disconnect(): Promise<void>; /** * Start receiving data from the device */ startReceiving(): void; /** * Process received data buffer */ processReceiveBuffer(): void; /** * Send data to the device * @param {Buffer|Array} data - Data to send */ send(data: Buffer | any[]): Promise<any>; /** * Send packet and wait for response * @param {Buffer} packet - Packet to send * @param {number} expectedId - Expected device ID in response * @param {number} timeout - Timeout in milliseconds * @returns {Promise<Buffer>} - Response packet */ sendAndWaitForResponse(packet: Buffer, expectedId?: number, timeout?: number): Promise<Buffer>; /** * Ping a device * @param {number} id - Device ID * @param {number} timeout - Timeout in milliseconds * @returns {Promise<Object>} - Ping response */ ping(id: number, timeout?: number): Promise<Object>; /** * Discover devices on the bus * @param {Object} options - Discovery options * @returns {Promise<Array>} - Array of discovered devices */ discoverDevices(options?: Object): Promise<any[]>; /** * Set baud rate (placeholder - U2D2 handles this automatically) * @param {number} baudRate - Baud rate */ setBaudRate(baudRate: number): void; /** * Get current baud rate * @returns {number} - Current baud rate */ getBaudRate(): number; /** * Get connection status * @returns {boolean} - Connection status */ getConnectionStatus(): boolean; } import { EventEmitter } from 'events';