Sessions and state
Start and end a session
Section titled “Start and end a session”Pass the approved robot_type and max_occupied_s to client.start_session. It creates a session and attaches a controller when your account has SDK access. The server assigns a station. For a one-session pilot, pass the assigned request_id as shown in Quickstart. The context asks the station to end the session on exit. Keep the session ID so you can verify the outcome after a timeout. For an existing session, client.attach_session(session_id) opens a controller. Exiting its context closes that connection.
Use session.end(timeout=...) to request shutdown and wait for confirmation. session.stop() and client.stop_session(session_id) return the session record after requesting a stop, before cleanup is confirmed. For an explicit move to the reviewed rest pose, call session.park() and wait for its result.
Read the state
Section titled “Read the state”From the Quickstart Python project, enter your session ID:
uv run python -c 'from bsln.sdk import Client
session_id = input("Session ID: ").strip()with Client() as client: print(client.session(session_id)["state"])'| Member | What it gives you |
|---|---|
session.id, session.state |
The session ID and latest cached lifecycle snapshot. Read client.session(session.id) for the server record. |
session.wait_until_active(timeout=...) |
Wait for the station to accept control before sending motion. |
session.get_joints() |
Measured joint positions keyed by name. Arm joints use radians and grippers use 0 to 1. |
session.get_state(timeout=10.0, max_age_s=1.0) |
Telemetry with requested, target and measured joint dictionaries, plus flags, fault and receive age. Tighten max_age_s for newer feedback. |
session.stats(), session.usage |
SDK connection statistics and the final usage record when available. |
session.report() |
The ended-session report. An active session returns HTTP 409. |
Use client.sessions() for one page and client.iter_sessions() to iterate across pages. A reconnect clears cached telemetry. Read fresh feedback before planning the next action.
Send commands
Section titled “Send commands”See motion and emergency stop, reports and observations or account and station methods.