Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
dipla_worker.cpp File Reference

Keep IPC responsive while one planner owns the survey and retained route. More...

#include "dipla_worker.hpp"
#include "dipla_planner.hpp"
#include "dipla_ipc.h"
#include "../../src/bounded_ini.h"
#include <chrono>
#include <cmath>
#include <condition_variable>
#include <iostream>
#include <mutex>
#include <random>
#include <stdexcept>
#include <thread>
#include <sys/socket.h>
#include <unistd.h>
Include dependency graph for dipla_worker.cpp:

Go to the source code of this file.

Namespaces

namespace  dipla

Functions

int dipla::serve (int descriptor, const std::string &config, const std::string &default_model, const std::string &default_metadata, bool cmaes=false, const CmaesOptions &comparison={}, const NetworkOptions &network_options={}, const ExperimentOptions &experiment={})
 Serve a Diplacam session over an already-connected IPC descriptor.

Detailed Description

Keep IPC responsive while one planner owns the survey and retained route.

Two threads divide the work by ownership, not by algorithm:

  • The calling thread validates packets, admits observations, and replies from small route snapshots. It never reads or mutates the dense GP covariance.
  • The planner thread consumes the bounded FIFO in order, conditions the GP, and computes at most one completed route for each requested chunk token. Credit-aware SHOT separately acknowledges assimilation so its owner can bound new measurements without blocking packet validation or dropping evidence.

Three identities answer different questions. The session token names the requested route chunk; survey_epoch names the continuing GP experiment; generation identifies a completed route within that chunk. An active START changes the chunk without erasing observations. STOP ends the survey, and the next START advances the epoch so its first observation gets a new GP.

Why retain routes?
A waypoint retrieval is not a waypoint arrival. Only the flight controller knows when its path is complete and when to request another chunk. Letting every pose trigger a new route would move the targets while they are followed. Whole-plan replies copy one generation; legacy point replies pin all eight retrieval slots so a single cycle cannot assemble a patchwork of routes.
When adjusting timing or capacity
Accepted measurements are evidence, not replaceable planning suggestions. Queue overflow fails the survey rather than quietly losing evidence, and freshness is measured from receipt, not from the end of expensive processing. Keep those rules intact when changing cadence, queue size, or reply handling.
Warning
This is a trusted local SOCK_SEQPACKET ABI, not the UART protocol. Socket calls and planner cancellation do not provide hard real-time bounds; the owning process must still supervise a stalled or failed worker.
See also
dipla_worker.hpp Public service and descriptor-ownership contract.
dipla_ipc.h Packet layout, fixed-point units, and reply validity rules.

Definition in file dipla_worker.cpp.