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:
objectNon-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.stepperfor 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
nameandpositions. For the Pydantic model, sees6.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.