Loading...
Searching...
No Matches
dipla_camera_backend.c
Go to the documentation of this file.
35extern char **environ; /**< Inherited environment; executable/configuration remain explicit argv. */
47static char config_path[configuration_path_capacity]; /**< Owned configuration path, immutable while a worker is acquired. */
48static int descriptor = -1; /**< One private packet socket; minus one means no process channel. */
49static pid_t child = -1; /**< Sole child reaped by this owner, not by unrelated camera backends. */
50static uint32_t active_session, pending_number; /**< Distinct sortie and observation correlation tokens. */
51static uint32_t admitted_number, assimilated_number; /**< One unassimilated measurement credit, separate from point retrieval. */
54static uint64_t pending_since; /**< Monotonic admission time, not a worker/FC wall-clock timestamp. */
55static bool survey_lost; /**< Worker loss requires STOP before another survey can establish a geographic frame. */
63 return (uint64_t)now.tv_sec * milliseconds_per_second + (uint64_t)now.tv_nsec / nanoseconds_per_millisecond;
87 do { sent = send(descriptor, request, sizeof(*request), MSG_DONTWAIT | MSG_NOSIGNAL); } while (sent < 0 && errno == EINTR);
148 if (!result && channel[0] != worker_fd) result = posix_spawn_file_actions_addclose(&actions, channel[0]);
175 const struct dipla_request request = {.version = DIPLA_IPC_VERSION, .operation = DIPLA_IPC_START, .session = session};
193 const struct dipla_request request = {.version = DIPLA_IPC_VERSION, .operation = DIPLA_IPC_STOP, .session = session};
214 .operation = observation_busy ? DIPLA_IPC_POINT : DIPLA_IPC_CREDIT_SHOT, .session = active_session,
232 * does not wait for assimilation, and credits never become FC camera results. Quality 1000 denotes
264 const bool valid = reply.valid && now && now - pending_since <= DIPLA_CYCLE_TIMEOUT_MS && reply.metric >= (int32_t)DIPLA_WAYPOINT_COUNT &&
char ** environ
static bool poll_result(struct camera_point_result *point)
Drain a bounded reply batch and publish only the active request's result.
Definition dipla_camera_backend.c:234
static bool start(uint32_t session)
Admit a nonzero session and discard correlation from the previous one.
Definition dipla_camera_backend.c:170
static int initialize(void)
Spawn one native planner with a private, close-on-exec packet socket.
Definition dipla_camera_backend.c:135
static void deinit(void)
Close the planner channel, reset session state, and stop the child.
Definition dipla_camera_backend.c:113
static int init(const char *source)
Acquire the worker without opening any optical camera.
Definition dipla_camera_backend.c:283
static uint64_t milliseconds(void)
Read elapsed-time evidence unaffected by changes to civil time.
Definition dipla_camera_backend.c:59
static bool reap_child(unsigned timeout_ms)
Invalidate requests before escalating worker shutdown and reaping it.
Definition dipla_camera_backend.c:95
static int completion_fd(void)
Expose only completion readiness to USHER's existing event poll.
Definition dipla_camera_backend.c:77
static bool transmit(const struct dipla_request *request)
Admit one whole packet without blocking the UART owner.
Definition dipla_camera_backend.c:83
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 void drain(void)
Stop the selected session and reap the worker during owner shutdown.
Definition dipla_camera_backend.c:279
bool dipla_camera_backend_setup(const char *configuration)
Select the worker experiment before acquiring its process.
Definition dipla_camera_backend.c:66
static bool enabled(void)
Report explicit opt-in independently of process or model readiness.
Definition dipla_camera_backend.c:75
struct camera_backend dipla_camera_backend_get(void)
Describe camera slot five without starting work.
Definition dipla_camera_backend.c:285
static bool stop(uint32_t session)
End only the matching session, even if its stop packet cannot be sent.
Definition dipla_camera_backend.c:189
Optional non-image camera adapter for the native Diplacam worker.
Private local worker messages; not a flight-controller wire protocol.
Function table describing one backend's owned camera operations.
Definition camera_backend.h:94
Definition camera_backend.h:50
Repeated correlated point updates from saved photos or non-image work.
Definition camera_backend.h:68
Legacy one-point retrieval from a generation pinned across eight slots.
Definition dipla_ipc.h:59
uint32_t number
Exact observation echo; a retry must not consume another slot.
Definition dipla_ipc.h:66
int32_t agl_mm
Configured physical flight height in millimetres; default 2000.
Definition dipla_ipc.h:75
int32_t alt_mm
Unchanged owner-supplied FC altitude in millimetres, not predicted model Z.
Definition dipla_ipc.h:75
uint32_t session
Exact session echo; prevents accepting a previous sortie's completion.
Definition dipla_ipc.h:66
Pose/control request; session and observation number have separate lifetimes.
Definition dipla_ipc.h:42
One timestamped geographic position for a replay annotation.
Definition ear_heatmap_overlay.c:79
Definition usher_protocol.h:51