Skip to content

FastAPI server for feeding logic #25

Description

@siddhss5

Context

Part of #19 (ADA Feeding Pipeline). Thin API server that the React app talks to. Replaces rosbridge.

Endpoints

```
GET /api/plate → camera image + food detection overlays
POST /api/select_food → {food_id} → select food for acquisition
POST /api/feed → start full bite cycle (returns immediately, status via WS)
POST /api/stop → abort current motion
GET /api/status → {state, behavior, ft_force, fork_state, bite_count}
WS /api/events → live status updates (state changes, F/T readings)
```

Architecture

  • FastAPI app that holds a reference to the ADA robot + SimContext
  • Runs alongside viser in the same process
  • Calls the same `feed_bite()` function as the viser panel
  • WebSocket pushes state changes to the React app
  • Camera endpoint renders from D415 (ada_mj#5) or returns placeholder

Files

  • New: `src/ada_mj/api.py`
  • Modify: `src/ada_mj/console.py` or `main.py` (start API server)

Depends on: #22 (task), #24 (viser panel for shared state)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions