Skip to content

Commit b879676

Browse files
committed
docs: AI overview and summary
Uses GenAI to provide architectural diagrams, summarise the key components and classes. Provides a more thorough break down than the existing readthedocs on configuration parameters.
1 parent 42636fd commit b879676

File tree

5 files changed

+1449
-0
lines changed

5 files changed

+1449
-0
lines changed

docs/Architecture.md

Lines changed: 310 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,310 @@
1+
# Stella VSLAM - System Architecture
2+
3+
## High-Level Architecture
4+
5+
```mermaid
6+
graph TB
7+
subgraph "Stella VSLAM System"
8+
subgraph "Core Modules"
9+
TM[Tracking Module]
10+
MM[Mapping Module]
11+
GOM[Global Optimisation Module]
12+
end
13+
14+
subgraph "Data Management"
15+
DB[(Map Database)]
16+
BOW[(BoW Database)]
17+
CAM[(Camera Database)]
18+
end
19+
20+
subgraph "Processing"
21+
FE[Feature Extraction]
22+
CM[Camera Models]
23+
IO[I/O Modules]
24+
end
25+
26+
subgraph "Publishing"
27+
MP[Map Publisher]
28+
FP[Frame Publisher]
29+
end
30+
end
31+
32+
TM --> DB
33+
MM --> DB
34+
GOM --> DB
35+
TM --> BOW
36+
TM --> CAM
37+
FE --> TM
38+
CM --> TM
39+
IO --> DB
40+
MP --> DB
41+
FP --> TM
42+
```
43+
44+
## Multi-Threaded Architecture
45+
46+
```mermaid
47+
graph LR
48+
subgraph "Main Thread"
49+
UI[User Interface]
50+
CF[Camera Feed]
51+
end
52+
53+
subgraph "Tracking Thread"
54+
TF[Frame Tracking]
55+
TI[Initialisation]
56+
TR[Relocalisation]
57+
end
58+
59+
subgraph "Mapping Thread"
60+
KF[Keyframe Insertion]
61+
LM[Local Mapping]
62+
BA[Bundle Adjustment]
63+
end
64+
65+
subgraph "Global Optimisation Thread"
66+
LD[Loop Detection]
67+
LC[Loop Closure]
68+
PGO[Pose Graph Optimisation]
69+
end
70+
71+
UI --> CF
72+
CF --> TF
73+
TF --> KF
74+
KF --> LD
75+
LD --> LC
76+
LC --> PGO
77+
PGO --> TF
78+
```
79+
80+
## Data Flow Architecture
81+
82+
```mermaid
83+
flowchart TD
84+
A[Camera Input] --> B[Frame Creation]
85+
B --> C[Feature Extraction]
86+
C --> D[Tracking Module]
87+
D --> E{Tracking Success?}
88+
E -->|Yes| F[Pose Estimation]
89+
E -->|No| G[Relocalisation]
90+
G --> D
91+
F --> H[Keyframe Decision]
92+
H -->|Yes| I[Keyframe Insertion]
93+
H -->|No| J[Update Motion Model]
94+
I --> K[Local Mapping]
95+
K --> L[Bundle Adjustment]
96+
L --> M[Loop Detection]
97+
M -->|Loop Found| N[Loop Closure]
98+
M -->|No Loop| O[Continue]
99+
N --> P[Global Optimisation]
100+
P --> Q[Map Update]
101+
Q --> R[Pose Refinement]
102+
R --> D
103+
O --> D
104+
J --> D
105+
```
106+
107+
## Component Interaction Diagram
108+
109+
```mermaid
110+
sequenceDiagram
111+
participant User
112+
participant System
113+
participant Tracking
114+
participant Mapping
115+
participant GlobalOpt
116+
participant Database
117+
118+
User->>System: Start SLAM
119+
System->>Tracking: Initialise
120+
System->>Mapping: Start mapping thread
121+
System->>GlobalOpt: Start optimisation thread
122+
123+
loop Frame Processing
124+
User->>System: Feed frame
125+
System->>Tracking: Process frame
126+
Tracking->>Database: Query landmarks
127+
Tracking->>Tracking: Estimate pose
128+
129+
alt New keyframe needed
130+
Tracking->>Mapping: Insert keyframe
131+
Mapping->>Database: Store keyframe
132+
Mapping->>Mapping: Local bundle adjustment
133+
end
134+
135+
alt Loop detected
136+
Mapping->>GlobalOpt: Request loop closure
137+
GlobalOpt->>Database: Optimise pose graph
138+
GlobalOpt->>Tracking: Update poses
139+
end
140+
end
141+
142+
User->>System: Save map
143+
System->>Database: Export map data
144+
```
145+
146+
## Camera Model Architecture
147+
148+
```mermaid
149+
classDiagram
150+
class CameraBase {
151+
<<abstract>>
152+
+project(points_3d)
153+
+unproject(points_2d)
154+
+get_camera_matrix()
155+
}
156+
157+
class PerspectiveCamera {
158+
+fx, fy: focal lengths
159+
+cx, cy: principal point
160+
+distortion coefficients
161+
}
162+
163+
class FisheyeCamera {
164+
+fx, fy: focal lengths
165+
+cx, cy: principal point
166+
+k1, k2, k3, k4: fisheye coefficients
167+
}
168+
169+
class EquirectangularCamera {
170+
+cols, rows: image dimensions
171+
+fps: frame rate
172+
}
173+
174+
class RadialDivisionCamera {
175+
+fx, fy: focal lengths
176+
+cx, cy: principal point
177+
+division coefficients
178+
}
179+
180+
CameraBase <|-- PerspectiveCamera
181+
CameraBase <|-- FisheyeCamera
182+
CameraBase <|-- EquirectangularCamera
183+
CameraBase <|-- RadialDivisionCamera
184+
```
185+
186+
## Database Schema
187+
188+
```mermaid
189+
erDiagram
190+
KEYFRAME {
191+
unsigned_int id PK
192+
Mat44_t pose_cw
193+
timestamp timestamp
194+
vector landmarks
195+
vector observations
196+
}
197+
198+
LANDMARK {
199+
unsigned_int id PK
200+
Vec3_t pos_w
201+
vector observations
202+
bool is_observable
203+
}
204+
205+
OBSERVATION {
206+
unsigned_int keyframe_id FK
207+
unsigned_int landmark_id FK
208+
Vec2_t pos_2d
209+
float scale_level
210+
}
211+
212+
CAMERA {
213+
unsigned_int id PK
214+
string name
215+
string model
216+
json parameters
217+
}
218+
219+
KEYFRAME ||--o{ OBSERVATION : "has"
220+
LANDMARK ||--o{ OBSERVATION : "observed_by"
221+
CAMERA ||--o{ KEYFRAME : "captured_by"
222+
```
223+
224+
## Module Dependencies
225+
226+
```mermaid
227+
graph TD
228+
subgraph "Core System"
229+
SYS[System]
230+
CFG[Config]
231+
end
232+
233+
subgraph "Tracking"
234+
TRK[Tracking Module]
235+
INIT[Initializer]
236+
REL[Relocalizer]
237+
KFI[Keyframe Inserter]
238+
end
239+
240+
subgraph "Mapping"
241+
MAP[Mapping Module]
242+
LMC[Local Map Cleaner]
243+
LMU[Local Map Updater]
244+
end
245+
246+
subgraph "Optimisation"
247+
GOM[Global Optimisation]
248+
LBA[Loop Bundle Adjuster]
249+
LD[Loop Detector]
250+
end
251+
252+
subgraph "Data"
253+
MDB[Map Database]
254+
BDB[BoW Database]
255+
CDB[Camera Database]
256+
end
257+
258+
subgraph "Features"
259+
FE[Feature Extraction]
260+
ORB[ORB Extractor]
261+
end
262+
263+
SYS --> CFG
264+
SYS --> TRK
265+
SYS --> MAP
266+
SYS --> GOM
267+
268+
TRK --> INIT
269+
TRK --> REL
270+
TRK --> KFI
271+
TRK --> MDB
272+
TRK --> BDB
273+
274+
MAP --> LMC
275+
MAP --> LMU
276+
MAP --> MDB
277+
278+
GOM --> LBA
279+
GOM --> LD
280+
GOM --> MDB
281+
282+
TRK --> FE
283+
FE --> ORB
284+
```
285+
286+
## System State Machine
287+
288+
```mermaid
289+
stateDiagram-v2
290+
[*] --> Initialising
291+
Initialising --> Tracking : Initialisation Success
292+
Initialising --> Lost : Initialisation Failed
293+
294+
Tracking --> Tracking : Continue Tracking
295+
Tracking --> Lost : Tracking Failed
296+
Tracking --> Mapping : New Keyframe
297+
298+
Lost --> Tracking : Relocalisation Success
299+
Lost --> Lost : Relocalisation Failed
300+
301+
Mapping --> Tracking : Mapping Complete
302+
Mapping --> GlobalOptimisation : Loop Detected
303+
304+
GlobalOptimisation --> Tracking : Optimisation Complete
305+
306+
Tracking --> [*] : System Shutdown
307+
Lost --> [*] : System Shutdown
308+
Mapping --> [*] : System Shutdown
309+
GlobalOptimisation --> [*] : System Shutdown
310+
```

0 commit comments

Comments
 (0)