> For the complete documentation index, see [llms.txt](https://carec.gitbook.io/carec-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://carec.gitbook.io/carec-docs/documentation/architecture.md).

# Architecture

CAREC uses a simulation-first ROS 2 architecture that separates user intent, autonomous planning, safety authorization, and the simulated platform adapter.

```mermaid
flowchart TD
    U["User / caregiver intent"] --> UI["User-intent interface"]
    A["Autonomy / navigation"] --> PV["Proposed velocity"]
    UI --> ARB["Arbitration / shared control"]
    PV --> ARB
    S["Virtual sensors + localization health"] --> SS["Independent safety supervisor"]
    ARB --> SS
    E["Emergency stop / watchdog"] --> SS
    SS --> SV["Safety-approved velocity"]
    SV --> SIM["Simulation platform adapter"]
```

## Architectural principles

* Manual stop and emergency stop outrank autonomy.
* Autonomous planning proposes motion; the safety supervisor authorizes motion.
* Raw planner, AI, or user commands must never bypass the safety supervisor.
* The simulator and any future physical adapter share the same safety-approved motion boundary.
* Interfaces define units, frames, timestamps, freshness, health, and failure behavior.
* Restart, stale data, communication loss, or invalid state must not create uncontrolled motion.
* Logs and deterministic scenarios support replay, regression testing, and evidence.

## Current decision status

ADR-0009 — Stable CAREC ROS Interfaces is **Accepted** as of 2026-09-01 and is the authoritative command/safety interface contract for Issue #20 and subsequent simulation work.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://carec.gitbook.io/carec-docs/documentation/architecture.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
