SSAFY 2학기 자율
테이블 (8)
apriltag
- id — int — 기본 키 — NOT NULL — 태그 번호
- pos_x — float — NOT NULL — X 좌표
- pos_y — float — NOT NULL — Y 좌표
- zone — enum — entry | slot | standby
emergency_log
- id — int — 기본 키 — NOT NULL — PK
- robot_id — int — 외래 키 → robot.id — NOT NULL — FK
- level — int — NOT NULL — 1 | 2 | 3
- reason — enum — NOT NULL — sensor_error | pair_disconnected | alignment_failed | apriltag_timeout | battery_low | server_disconnected
- task_id — int — 외래 키 → robot_task.id — FK, 태스크 수행 중 발생 시
- occurred_at — timestamp — NOT NULL
- resolved_at — timestamp — 복구 시각
parking_record
- id — int — 기본 키 — NOT NULL — PK
- slot_id — int — 외래 키 → parking_slot.id — FK, ADD CONSTRAINT FOREIGN KEY
- license_plate — varchar(20) — NOT NULL — 차량 번호
- entry_time — timestamp — NOT NULL — 입차 시각
- exit_time — timestamp — 출차 시각
- entry_status — enum — NOT NULL — waiting | confirmed | rejected
- parking_status — enum — NOT NULL — unassigned | assigned | parked | retrieve_requested | retrieved
parking_slot
- id — int — 기본 키 — NOT NULL — PK
- slot_code — varchar(20) — NOT NULL — 공간 코드(A-01 등)
- status — enum — NOT NULL — available / occupied / reserved
parking_slot_apriltag
- slot_id — int — 외래 키 → parking_slot.id — NOT NULL — PK, FK
- apriltag_id — int — 외래 키 → apriltag.id — NOT NULL — PK, FK
robot
- id — int — 기본 키 — NOT NULL — PK
- robot_code — varchar(50) — NOT NULL — 로봇 식별 코드
- status — enum — NOT NULL — idle | moving | arrived | lifting | lift_complete | lowering | lower_complete | emergency
robot_location_log
- time — timestamp — 기본 키 — NOT NULL — PK, TimescaleDB 기준 컬럼
- robot_id — int — 외래 키 → robot.id — NOT NULL — FK, PK
- apriltag_id — int — 외래 키 → apriltag.id — NOT NULL — 태그 번호
- heading — float — 방향각 theta
robot_task
- id — int — 기본 키 — NOT NULL — PK
- robot_id — int — 외래 키 → robot.id — NOT NULL — FK, ADD CONSTRAINT FOREIGN KEY
- record_id — int — 외래 키 → parking_record.id — NOT NULL — FK, ADD CONSTRAINT FOREIGN KEY
- task_type — enum — NOT NULL — move | lift | lower
- destination — enum — vehicle | slot | standby
- seq — int — NOT NULL — 실행 순서, 재계산 시 기준점
- priority — int — NOT NULL — 높을수록 높은 우선순위, aging으로 증가
- status — enum — NOT NULL — pending | in_progress | done | cancelled
- path — jsonb — 경로 (move일 때만)
- started_at — timestamp
- completed_at — timestamp
- created_at — timestamp — NOT NULL — 서버가 로봇에 업무를 할당한 시간