s6.robotic.serviceΒΆ
Robotic service utilities and FastAPI endpoints.
This module wires s6.robotic.stepper.Axis instances from
configuration (s6.schema.robotic.RoboticConfig) and exposes a set of
operations for motion and waypoint management. A small FastAPI router is
provided to publish these operations over HTTP.
The top-level helpers (e.g., move(), to_waypoint()) implement the
core behavior and can be used directly without running the web service.
- s6.robotic.service.axes() Dict[str, Axis]
Build and cache axis drivers from configuration.
- Returns:
Mapping of axis name to
s6.robotic.stepper.Axisdriver.- Return type:
Dict[str, Axis]
Notes
Positions are loaded from the config on first access and persisted on interpreter exit. Boundaries are set to
[-30, 30]in distance units.
- s6.robotic.service.move(axis: str, offset: int)
Move an axis by a relative distance and persist positions.
- Parameters:
axis (str) β Axis name (e.g.,
"x","y").offset (int) β Relative distance in axis units (e.g., millimeters). Converted to steps via calibration.
- s6.robotic.service.set_waypoint(name: str)
Create or update a named waypoint.
The current positions of all axes are stored under
name.- Parameters:
name (str) β Waypoint identifier. Replaces any existing waypoint with the same name.
- s6.robotic.service.to_waypoint(name: str)
Move axes to a previously saved named waypoint.
- Parameters:
name (str) β Name of an existing
s6.schema.robotic.Waypoint.
- s6.robotic.service.list_waypoints() List[Waypoint]
Return the list of stored waypoints.
- Returns:
See
s6.schema.robotic.Waypointfor the schema.- Return type:
list of Waypoint
- s6.robotic.service.zero()
Zero all axes by moving back to position
0.
- s6.robotic.service.set_brightness(duty_cycle: float)
Set the IR LED duty cycle.
Notes
This function delegates to an
ir_led()provider which is expected to be available in the application runtime. It is left intentionally untyped here since it is an integration point.
- s6.robotic.service.delete_waypoint(name: str) bool
Delete a waypoint by name and persist the change.
- Parameters:
name (str) β Waypoint to remove.
- Returns:
Trueif a waypoint was removed,Falseif none matched.- Return type:
bool
- class s6.robotic.service.MoveRequest(*, axis: str, offset: int)
Bases:
BaseModelRequest body for
POST /robotic/move.- axis: str
- offset: int
- class s6.robotic.service.WaypointNameRequest(*, name: str)
Bases:
BaseModelRequest body containing a waypoint name.
- name: str
- s6.robotic.service.move_endpoint(req: MoveRequest)
- s6.robotic.service.zero_endpoint()
- s6.robotic.service.set_waypoint_endpoint(req: WaypointNameRequest)
- s6.robotic.service.to_waypoint_endpoint(req: WaypointNameRequest)
- s6.robotic.service.list_waypoints_endpoint()
- s6.robotic.service.delete_waypoint_endpoint(name: str)