Initialize Instance

WARNING

Due to unstable communication and other reasons, errors may occur. In most cases, you need to use the error handling mechanism to catch errors and prevent abnormal exits.

Import SDK

lebai_sdk = require('lebai_sdk')

Initialize SDK

lebai_sdk.init()

SDK Version

version = lebai_sdk.version()

Get the SDK version number

  • Returns
    • version Version number

Device Discovery

WARNING

This feature is based on mDNS technology and is not supported by the JavaScript SDK for Web frontend development

devices = lebai_sdk.discover_devices(time)

Continuously discover nearby devices during the duration, after the duration ends, return the name, IP, and MAC address of all nearby devices.

  • Parameters

    • time Duration
  • Returns[{"name", "ip", "mac"}]

    • name Device name
    • ip IP address
    • mac MAC address

Connect Device

lebai = lebai_sdk.connect(ip, simu)

Connect to LEBAI robot arm through IP addressing

  • Parameters

    • ip IP address of LEBAI robot arm
    • simu Whether to connect in simulation mode. Optional, default is real machine mode
  • Returns

    • lebai Robot arm instance, subsequent methods to control the robot arm need to use this instance

Get Connection Status

connected = lebai:is_connected()
  • Returns
    • connected Whether in connected state

Wait for Disconnection

disconnect_reason = lebai:wait_disconnect()

Block and wait for device disconnection. Commonly used for reconnection after device disconnection

  • Returns
    • disconnect_reason Reason for device disconnection
Example Program
disconnect_reason = lebai:wait_disconnect()
print(disconnect_reason)
lebai = lebai_sdk.connect("192.168.2.3", false)