File size: 1,312 Bytes
130ae50
 
 
 
 
 
 
 
ba80dbe
130ae50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
 * SO-100 Leader Teleoperator implementation for Node.js
 *
 * Minimal implementation - calibration logic moved to shared/common/calibration.ts
 * This class only handles connection management and basic device operations
 */

import { Teleoperator } from "./teleoperator.js";
import type { TeleoperatorConfig } from "../types/teleoperator-config.js";

export class SO100Leader extends Teleoperator {
  constructor(config: TeleoperatorConfig) {
    super(config);

    // Validate that this is an SO-100 leader config
    if (config.type !== "so100_leader") {
      throw new Error(
        `Invalid teleoperator type: ${config.type}. Expected: so100_leader`
      );
    }
  }

  /**
   * Calibrate the SO-100 leader teleoperator
   * NOTE: Calibration logic has been moved to shared/common/calibration.ts
   * This method is kept for backward compatibility but delegates to the main calibrate.ts
   */
  async calibrate(): Promise<void> {
    throw new Error(
      "Direct device calibration is deprecated. Use the main calibrate.ts orchestrator instead."
    );
  }
}

/**
 * Factory function to create SO-100 leader teleoperator
 * Mirrors Python's make_teleoperator_from_config pattern
 */
export function createSO100Leader(config: TeleoperatorConfig): SO100Leader {
  return new SO100Leader(config);
}