s6.robotic.clientΒΆ

Client for the Robotic REST API.

Thin HTTP client with a background worker thread to serialize commands to the robotic service (s6.robotic.service). This allows callers to enqueue motion and waypoint operations without blocking the UI loop.

Examples

>>> client = RoboticClient("http://localhost:8000")
>>> client.move("x", 1.5)  # distance in axis units (e.g., mm)
>>> client.set_waypoint("inspect")
>>> client.to_waypoint("home")
>>> client.list_waypoints()
[{"name": "home", "positions": {"x": 0, "y": 0}}]
class s6.robotic.client.RoboticClient(base_url: str)

Bases: object

Non-blocking client for robotic motion and waypoint commands.

Parameters:

base_url (str) – Base URL of the server (e.g., "http://localhost:8000"). A trailing slash is stripped.

Notes

All public methods enqueue tasks onto a background worker thread which executes requests sequentially. Use enqueue() to schedule custom callables.

move(axis: str, offset: float)

Enqueue a relative move for an axis.

Parameters:
  • axis (str) – Axis name (e.g., "x", "y").

  • offset (float) – Relative distance to move in the axis’s distance units (e.g., millimeters). See s6.robotic.stepper for conversion.

zero()

Enqueue homing to zero for all axes.

set_waypoint(name: str)

Enqueue saving a named waypoint from current positions.

Parameters:

name (str) – Waypoint identifier. Overwrites if it already exists.

to_waypoint(name: str)

Enqueue moving all axes to a named waypoint.

Parameters:

name (str) – Name of an existing waypoint.

list_waypoints()

Fetch the list of stored waypoints.

Returns:

Each item has keys name and positions. For the Pydantic model, see s6.schema.robotic.Waypoint.

Return type:

list of dict

delete_waypoint(name: str)

Enqueue deletion of a named waypoint.

Parameters:

name (str) – Waypoint name to remove.

enqueue(func)

Schedule a callable on the background worker.

The callable is executed sequentially with previously enqueued tasks.