docs: add docs to CB
Pretty much every class and method should have documentation now. ref: N25B-295
This commit is contained in:
@@ -17,6 +17,16 @@ router = APIRouter()
|
||||
|
||||
@router.post("/command", status_code=202)
|
||||
async def receive_command(command: SpeechCommand, request: Request):
|
||||
"""
|
||||
Send a direct speech command to the robot.
|
||||
|
||||
Publishes the command to the internal 'command' topic. The
|
||||
:class:`~control_backend.agents.actuation.robot_speech_agent.RobotSpeechAgent`
|
||||
will forward this to the robot.
|
||||
|
||||
:param command: The speech command payload.
|
||||
:param request: The FastAPI request object.
|
||||
"""
|
||||
# Validate and retrieve data.
|
||||
SpeechCommand.model_validate(command)
|
||||
topic = b"command"
|
||||
@@ -29,12 +39,22 @@ async def receive_command(command: SpeechCommand, request: Request):
|
||||
|
||||
@router.get("/ping_check")
|
||||
async def ping(request: Request):
|
||||
"""
|
||||
Simple HTTP ping endpoint to check if the backend is reachable.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@router.get("/ping_stream")
|
||||
async def ping_stream(request: Request):
|
||||
"""Stream live updates whenever the device state changes."""
|
||||
"""
|
||||
SSE endpoint for monitoring the Robot Interface connection status.
|
||||
|
||||
Subscribes to the internal 'ping' topic (published by the RI Communication Agent)
|
||||
and yields status updates to the client.
|
||||
|
||||
:return: A StreamingResponse of connection status events.
|
||||
"""
|
||||
|
||||
async def event_stream():
|
||||
# Set up internal socket to receive ping updates
|
||||
|
||||
Reference in New Issue
Block a user