Loading...
Searching...
No Matches
survey.cpp
Go to the documentation of this file.
73 while (!stopping && std::chrono::duration<double>(Clock::now() - liveStarted).count() < target) {
100static double seconds(Clock::duration duration) { return std::chrono::duration<double>(duration).count(); }
108 auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count() % 1000;
150 require(validThreadIds.load(std::memory_order_relaxed), "OpenCV parallel backend reported invalid thread index");
152 require(hit.load(std::memory_order_relaxed) == 1, "OpenCV parallel backend missed or duplicated stripe work");
176 require(serialOnCaller.load(std::memory_order_relaxed), "Single-thread OpenCV region used worker thread");
189 const auto working = config.outputFormat == "xyz" ? pangea_survey::XyzPlan(config).workingConfig(config) : config;
236 throw std::runtime_error("Self-tests require the private development checkout and BUILD_TESTING=ON");
283 const bool final = finalize || (!config.liveFinalFile.empty() && fs::exists(config.liveFinalFile));
292 (added >= config.liveBatchPhotos || Clock::now() - updated >= std::chrono::seconds(config.liveUpdateSeconds)))) {
314 if (argc == 5 && std::strcmp(argv[3], "--mode") != 0) throw std::runtime_error("Expected --mode");
319 throw std::runtime_error("AI Camera directories use --update-great, --follow-great or --finalize-great");
329 // The live worker has its own lock; taking both prevents offline mapping from competing with capture.
330 const int liveLock = open(liveLockPath.c_str(), O_CREAT | O_RDWR | O_NOFOLLOW | O_CLOEXEC, 0600);
332 throw std::runtime_error("Another Pangea live or survey worker is active; mapping remains optional");
354 (config.captureManifest.empty() ? "none" : pangea_survey::fileDigest(config.captureManifest)) + "\n" +
361 const std::string saved((std::istreambuf_iterator<char>(input)), std::istreambuf_iterator<char>());
374 if (!config.lowMemory) config.sourceCsv = pangea_survey::Orthorectifier::normalizeSources(config.sourceCsv,
377 int result = config.outputFormat == "xyz" ? exportXyzTiles(config, config.sourceCsv, workDirectory, diagnostic) :
Shared logging and operating-system checks for the survey executable.
Mirror stdout and stderr into one session file for a scoped run.
Definition application_runtime.h:96
Hold the per-user GREAT and live-PANGEA locks for one session update.
Definition great_session.h:36
static void selfTest()
Exercise stage progress, monotonic updates, and completion behavior.
Definition map_progress.h:198
Load a fixed-session source set and render its projected tiles/windows.
Definition ortho_map.h:98
static std::filesystem::path normalizeSources(const std::filesystem::path &csv, const std::filesystem::path &directory, const std::function< bool()> &stopped, unsigned workers=1, unsigned memoryMiB=128)
Rectify JPEG sources into working JPEGs and write a new CSV.
Definition ortho_map.cpp:1120
static void selfTest()
Run synthetic orthorectification regression cases.
Definition ortho_map.cpp:1422
static double groundPixel(int zoom, double latitude)
Ground metres per pixel at a latitude after Mercator scale correction.
Definition xyz_tiles.h:71
static int record(const union dc_shot_union *shot)
Retrieve a point and admit a new observation only when its credit is free.
Definition dipla_camera_backend.c:206
static bool range(size_t total, size_t offset, size_t length)
Check a byte span without forming a potentially overflowing end offset.
Definition exifite.c:133
Coordinate append-only, restartable GREAT XYZ survey sessions.
Encode BGRA map pixels and publish JPEGs with optional EXIF.
Own the survey mapper's validated configuration and mode defaults.
Add projection, coverage, and source provenance to map EXIF.
Orchestrate orthophoto rendering, evidence, and final publication.
static int orthorectify(const pangea_survey::MapConfig &config, const fs::path &csv, bool diagnostic=false, pangea_survey::MapProgress *progress=nullptr, double first=0)
Render orthophoto tiles and publish their coverage/provenance manifest.
Definition map_pipeline.h:41
Report monotonic progress, stage timings, and explicit interruption.
Apply and periodically check the survey process's low-memory policy.
Write georeferencing sidecars for rendered Pangea map images.
void require(bool valid, const char *message)
Route a failed precondition to the CLI's diagnostic handler.
Definition camera_lens.cpp:122
MapConfig loadMapConfig(const std::filesystem::path &path, const std::string &modeOverride={})
Load and validate a survey INI plus its capture manifest or source CSV.
Definition map_config.h:128
static bool updateGreatSession(const MapConfig &settings, const fs::path &ini, bool final, bool render=true)
Admit new photos and optionally publish a GREAT preview/final revision.
Definition great_session.h:173
std::string fileDigest(const std::filesystem::path &path, const std::function< bool()> &stopped={})
Hash a file in bounded chunks, optionally honoring cancellation.
Definition map_storage.h:89
std::string greatInputText(const MapConfig &config)
Snapshot the current accepted photo list for one GREAT revision.
Definition great_session.h:108
std::string dataDigest(const void *data, std::size_t size)
Compute a lowercase SHA-256 digest for an in-memory byte range.
Definition map_storage.h:77
void saveWorkingText(const std::filesystem::path &target, const std::string &text)
Save checkpoint text through the durable working-file publisher.
Definition map_storage.h:158
static bool checked(OrtStatus *status, char *error, size_t capacity)
Consume every ORT error object exactly once while copying its diagnostic before release.
Definition onnx_session.c:31
Describe the validated photo set and render projected map windows.
Fully parsed settings shared by orthomap and XYZ export.
Definition map_config.h:41
Derive requested XYZ bounds, map grid, and per-zoom tile ranges.
Definition xyz_tiles.h:119
void checkOutput(const std::filesystem::path &root) const
Reject any existing tile or partial file in the output plan.
Definition xyz_tiles.h:189
MapConfig workingConfig(const MapConfig &original) const
Derive the padded UTM working-grid settings needed for resampling.
Definition xyz_tiles.h:171
static double processCpuSeconds()
Read cumulative CPU time across the mapping process's threads.
Definition survey.cpp:58
static fs::path executablePath()
Resolve the running executable independently of the launch directory.
Definition survey.cpp:91
static bool isStopping()
Check cancellation at a cooperative mapping boundary.
Definition survey.cpp:68
static fs::path defaultIni()
Locate the default configuration alongside the executable.
Definition survey.cpp:96
static void checkInputs(const pangea_survey::MapConfig &config)
Validate a source session and print its output layout offline.
Definition survey.cpp:188
static std::string sessionName()
Create a readable, millisecond-resolution session label.
Definition survey.cpp:103
static double seconds(Clock::duration duration)
Convert a monotonic interval without truncating fractional seconds.
Definition survey.cpp:100
static void signalHandler(int sig)
Record a stop request without performing cleanup in signal context.
Definition survey.cpp:84
Resample the UTM source mosaic into complete 256-pixel XYZ tiles.
static int exportXyzTiles(const pangea_survey::MapConfig &config, const fs::path &csv, const fs::path &workDirectory, bool diagnostic=false)
Render and publish the planned XYZ pyramid, optionally as diagnostics.
Definition xyz_export.h:230