1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
//! Map storage and the operations that read and change it.
//!
//! [`Map`] owns the keyframes, map points, IMU factors and the world epoch;
//! nothing else stores them. Entities live beside it as [`Keyframe`] and
//! [`MapPoint`], and every operation is an inherent `impl Map` block under the
//! private `ops` module, grouped by responsibility:
//!
//! | Group | Examples |
//! |---|---|
//! | `mutation` | `insert_keyframe`, `insert_landmark`, `link_observation`, `apply_insertion`, `merge_map_points` |
//! | `correction` | `apply_pose_graph_correction`, `apply_inertial_alignment`, `apply_ba_update` |
//! | `geometry` | derived landmark geometry and the refresh set each correction owes |
//! | `queries` | `covisible_keyframes`, `covisible_keyframes_min_weight` — thresholds belong to consumers |
//! | `snapshot` | `ba_snapshot` — owned, immutable optimization inputs |
//!
//! ## Invariants
//!
//! A link exists on both sides or neither: a keyframe feature holding landmark
//! `L` implies `L` holds a matching [`LandmarkObservation`], and vice versa.
//! Within one keyframe, a feature holds at most one landmark and a landmark is
//! seen through at most one feature. Conflicts with either rule are refused
//! with a typed error; re-stating a link that already exists is a no-op, not an
//! error.
//!
//! Deletion is logical. `remove_landmark` clears every referencing feature and
//! marks the landmark culled; its slot, observation records and derived
//! geometry stay in place, so readers must check `culled`. Landmark ids are
//! stable indices held inside keyframes, so the vector is never compacted and a
//! retired id is never reused.
//! Unlinking the last observation retires the landmark; unlinking the reference
//! observation promotes the smallest remaining `(keyframe, feature)` in its
//! place.
//!
//! Ids are valid for the current map lifetime only. `clear_active` is a whole-
//! map reset that invalidates every previous id and advances the world epoch;
//! ids are not unique across resets.
//!
//! [`Map::apply_insertion`] validates a whole batch — against the live map and
//! against the request's own claims — before its first write, so a rejected
//! request leaves entities, links, counters, factors and the epoch untouched.
//! That is validation-before-write, not rollback: it does not survive a panic,
//! and the map is never cloned to provide it. Single-operation methods share
//! the same primitives, so the two cannot drift apart.
//!
//! Callers are unaffected by the grouping: the methods stay inherent on `Map`,
//! so `map.keyframes()` and `map::MapPoint` resolve exactly as before. Culling
//! policy lives in [`crate::mapping::culling`], BA selection and solving in
//! [`crate::mapping::bundle_adjustment`], and scheduling in
//! [`crate::mapping::local_mapping`].
pub use ImuFactor;
pub use Keyframe;
pub use ;
pub use ;
pub use ;
/// ORB pyramid scale factor between adjacent levels (matches the kornia-imgproc
/// ORB extractor default `downscale = 1.2`, which equals ORB-SLAM3's default).
pub const ORB_SCALE_FACTOR: f64 = 1.2;
/// Number of ORB pyramid levels (matches `OrbDetector` default `n_scales = 8`).
pub const ORB_N_LEVELS: usize = 8;
/// In-memory map storage for keyframes and persistent map points.
pub