Teleop API

Teleop API

⚠️ Not yet released: in-development v1.5.0-SNAPSHOT capability; interface and protocol may change. Do not use in production before the official release.

New in v1.5.0. Classes live under com.agibot.aiem.sdk.teleop / com.agibot.aiem.sdk. See the Teleop guide for the flow.

Class diagram

text
AgentSdk
  ├── registerTeleop(TeleopRequest)               // binds LinkskyClient
  └── unregisterTeleop(String teleopId)

TeleopRequest
  ├── constructor(AgentSdk, agentId, teleopId)
  ├── enter(AgentParam param, TeleopEnterCallback cb, long timeoutMs) → String eventId
  ├── startAudio(AgentParam param)                                    → String eventId
  ├── appendAudioDelta(String eventId, String audioDeltaBase64)
  ├── appendAudioDelta(String eventId, String audioDeltaBase64, double gain)
  ├── doneAudio(String eventId)
  ├── keepalive(TeleopKeepaliveCallback cb, long timeoutMs)           → String eventId
  └── exit(TeleopExitCallback cb, long timeoutMs)                     → String eventId

TeleopEnterCallback (abstract)
  └── onEnterAck(String teleopId, String eventId, int code, String msg)

TeleopKeepaliveCallback (abstract)
  └── onKeepaliveAck(String teleopId, String eventId, int code, String msg)

TeleopExitCallback (abstract)
  └── onExitAck(String teleopId, String eventId, int code, String msg)

IdGenerator
  └── generateTeleopId()  → "teleop_<21 random chars>"

AgentSdk (new methods)

MethodNotes
void registerTeleop(TeleopRequest request)Binds the request to this SDK's LinkskyClient and inserts it into the global AgentSdkTeleopMgr. Must be called before request.enter(...).
void unregisterTeleop(String teleopId)Removes the request from the index. Call after exit, or when abandoning the session, so cleanup does not wait for the 7200 s sweeper.

TeleopRequest

java
public TeleopRequest(AgentSdk agentSdk, String agentId, String teleopId)
  • agentId: target robot's agentId (issued by the LinkSoul open platform).
  • teleopId: session id — typically produced by IdGenerator.generateTeleopId(). Constant for the lifetime of a teleop session.
MethodSemantics
String enter(AgentParam param, TeleopEnterCallback cb, long timeoutMs)Open the teleop session. param may be null. timeoutMs < 50 is clamped to 50 (currently a placeholder — no timeout callback yet). Returns this message's eventId.
String startAudio(AgentParam param)Fire-and-forget audio-segment start. param may be null; common keys: role ("male" / "female"), threshold (-14 ~ 14). Returns the eventId you must reuse for subsequent appendAudioDelta / doneAudio.
void appendAudioDelta(String eventId, String audioDeltaBase64)Fire-and-forget audio delta. audioDeltaBase64 is a base64 string; sample rate / encoding match the passive audioData path. Equivalent to gain = 1.0.
void appendAudioDelta(String eventId, String audioDeltaBase64, double gain)Audio delta with gain. gain is an amplification factor, default 1.0, valid range (0, 10]; gain <= 0 is normalized to 1.0, gain > 10 is clamped to 10.0. Sent on the message's gain field and applied server-side.
void doneAudio(String eventId)Fire-and-forget audio-segment end. You may startAudio again to open a new segment.
String keepalive(TeleopKeepaliveCallback cb, long timeoutMs)Robot online probe. Fire-and-forget request whose result is delivered via onKeepaliveAck; code == 0 = robot online, code == -1 = robot offline. Recommend calling every 10 seconds during the session. timeoutMs handled the same way as enter. Returns this message's eventId.
String exit(TeleopExitCallback cb, long timeoutMs)Close the session. Timeout handling identical to enter.
long getUpdateTs()Last-send timestamp (ms). Idle > 7200 s gets swept.

Ack codes

codeMeaning
0Success (gateway-level business ack)
-1Server rejected; msg carries errorMsg
1000Local failure: SDK's LinkskyClient was closed at send time. The callback is invoked synchronously on the caller thread; stop pushing audio.

TeleopEnterCallback / TeleopKeepaliveCallback / TeleopExitCallback

Abstract classes — subclass and override onEnterAck / onKeepaliveAck / onExitAck:

java
TeleopEnterCallback cb = new TeleopEnterCallback() {
    @Override
    public void onEnterAck(String teleopId, String eventId, int code, String msg) {
        // code == 0 success; -1 server reject; 1000 local closed
    }
};

TeleopKeepaliveCallback keepaliveCb = new TeleopKeepaliveCallback() {
    @Override
    public void onKeepaliveAck(String teleopId, String eventId, int code, String msg) {
        // code == 0 robot online; -1 robot offline (msg carries errorMsg); 1000 local closed
    }
};

All three expose agentId (SDK-injected) and timeout (the clamped value from enter / keepalive / exit) via Lombok @Getter/@Setter.

IdGenerator.generateTeleopId()

Returns "teleop_<21 SecureRandom chars>". Distinct from other prefixes (flow_, event_, item_, pull_, signal_).

Event types

See the AGENTSDK_TELEOP_* block in Enums.