Loading...
Searching...
No Matches
coverage_scheduler.c
Go to the documentation of this file.
52 || camera->cx >= camera->width || !isfinite(camera->cy) || camera->cy < 0 || camera->cy >= camera->height
53 || !isfinite(camera->mount_roll_deg) || !isfinite(camera->mount_pitch_deg) || !isfinite(camera->mount_yaw_deg)
54 || fabs(camera->mount_roll_deg) > 180 || fabs(camera->mount_pitch_deg) > 180 || fabs(camera->mount_yaw_deg) > 180
69 struct coverage_footprint projected = {.uncertainty_m = pose->uncertainty_m + (east * east + north * north) / (2 * earth_radius)};
88bool coverage_project_pixel(const struct coverage_camera *camera, const struct coverage_pose *pose,
94 !coverage_project(camera, pose, pose->latitude_deg, pose->longitude_deg, &footprint)) return false;
99 const struct coverage_point projected = {pose->agl_m * ray[1] / ray[2], pose->agl_m * ray[0] / ray[2]};
120static bool bounds(const struct coverage_state *state, const struct coverage_candidate *candidate,
137 if (!isfinite(turn) || fabs(turn) < 1e-9 || (winding != 0 && turn * winding <= 0)) return false;
149 || right < left || top < bottom || (right - left + 1) * (top - bottom + 1) > COVERAGE_SCAN_LIMIT)
156static bool contains_cell(const struct coverage_state *state, const struct coverage_candidate *candidate,
179static double gain_after(const struct coverage_state *state, const struct coverage_candidate *candidate,
191 if (same_camera && contains_cell(state, previous, &previous_box, column, row) && previous->quality > saved)
199double coverage_gain(const struct coverage_state *state, const struct coverage_candidate *candidate)
218int coverage_choose(const struct coverage_state *state, const struct coverage_candidate *candidates,
229 const uint64_t start = candidates[first].ready_us > now_us ? candidates[first].ready_us : now_us;
252bool coverage_wholly_saved(const struct coverage_state *state, const struct coverage_candidate *candidate)
261 || (box.right - box.left + 1 + 2 * margin) * (box.top - box.bottom + 1 + 2 * margin) > COVERAGE_SCAN_LIMIT) return
265 if (state->saved[candidate->camera_id - 1][row * COVERAGE_SIDE + column] < candidate->quality) return false;
269double coverage_overlap(const struct coverage_state *state, const struct coverage_candidate *first,
double coverage_gain(const struct coverage_state *state, const struct coverage_candidate *candidate)
Score additional detail in conservatively contained cells without mutation.
Definition coverage_scheduler.c:199
static void rotate(double vector[3], double roll_deg, double pitch_deg, double yaw_deg)
Apply Rz*Ry*Rx in place, matching the mount/body order used by PANGEA.
Definition coverage_scheduler.c:34
static double gain_after(const struct coverage_state *state, const struct coverage_candidate *candidate, const struct coverage_candidate *previous)
Score a second view against a hypothetical first, without committing either.
Definition coverage_scheduler.c:179
bool coverage_commit(struct coverage_state *state, const struct coverage_candidate *candidate)
Credit a successfully saved observation, retaining the best detail per cell.
Definition coverage_scheduler.c:204
bool coverage_init(struct coverage_state *state, double east, double north, double cell_m)
Clear the ledger and set its fixed spatial domain.
Definition coverage_scheduler.c:105
bool coverage_project(const struct coverage_camera *camera, const struct coverage_pose *pose, double origin_latitude_deg, double origin_longitude_deg, struct coverage_footprint *footprint)
Project delivered-image corners onto a local flat ground plane.
Definition coverage_scheduler.c:46
int coverage_choose(const struct coverage_state *state, const struct coverage_candidate *candidates, size_t count, uint64_t now_us, uint64_t service_us)
Choose the first observation of the best feasible one- or two-shot plan.
Definition coverage_scheduler.c:218
bool coverage_wholly_saved(const struct coverage_state *state, const struct coverage_candidate *candidate)
Check whether skipping this observation is geometrically conservative.
Definition coverage_scheduler.c:252
static bool bounds(const struct coverage_state *state, const struct coverage_candidate *candidate, struct coverage_bounds *box)
Reject unusable polygons before converting coordinates or scanning cells.
Definition coverage_scheduler.c:120
bool coverage_project_pixel(const struct coverage_camera *camera, const struct coverage_pose *pose, double column, double row, struct coverage_point *offset)
Project an image pixel onto the same ground plane as the coverage footprint.
Definition coverage_scheduler.c:88
double coverage_overlap(const struct coverage_state *state, const struct coverage_candidate *first, const struct coverage_candidate *second)
Estimate conservative overlap for deciding whether a delay is acceptable.
Definition coverage_scheduler.c:269
static bool contains_cell(const struct coverage_state *state, const struct coverage_candidate *candidate, const struct coverage_bounds *box, int column, int row)
Require the whole cell, not merely its centre, inside every polygon edge.
Definition coverage_scheduler.c:156
Fixed-memory geometric coverage accounting, independent of camera I/O.
static bool start(uint32_t session)
Admit a nonzero session and discard correlation from the previous one.
Definition dipla_camera_backend.c:170
Validated inclusive grid bounds and polygon winding for half-plane tests.
Definition coverage_scheduler.c:31
Measured pinhole calibration for the delivered image, including its mount.
Definition coverage_scheduler.h:41
One feasible observation; deadlines constrain acquisition start, not saving.
Definition coverage_scheduler.h:84
uint64_t ready_us
Earliest acquisition start; all candidates must share a monotonic time domain.
Definition coverage_scheduler.h:86
Convex ground quadrilateral with a conservative boundary margin.
Definition coverage_scheduler.h:79
Local ground coordinates in metres, east and north of the projection origin.
Definition coverage_scheduler.h:73
double north
Metres north of the shared local geographic reference.
Definition coverage_scheduler.h:73
Pose estimate and its positional margin for a single observation.
Definition coverage_scheduler.h:59
double latitude_deg
Observation latitude in geographic degrees, not FC fixed-point units.
Definition coverage_scheduler.h:60
Fixed coverage ledger; zero cells are unknown, not necessarily unphotographed.
Definition coverage_scheduler.h:93
uint8_t saved[COVERAGE_CAMERAS][COVERAGE_SIDE *COVERAGE_SIDE]
Definition coverage_scheduler.h:95
double origin_north
Lower north grid edge in metres relative to the projection origin.
Definition coverage_scheduler.h:94
double origin_east
Lower east grid edge in metres relative to the projection origin.
Definition coverage_scheduler.h:94