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_gp_belief_planner.hpp
Go to the documentation of this file.
1/*
2 * Copyright 2026 OpenUAS
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/* Additional author attribution: Copyright 2026 Akshat Jain */
19
28#pragma once
29
30#include "aigenlib/compat.hpp"
31#include <cstddef>
32#include <functional>
33#include <random>
34#include <vector>
35
36namespace aipp {
38inline constexpr int lookahead_stride = 4;
40inline constexpr int lookahead_measurement_budget = 64;
42inline constexpr int spline_samples_per_segment = 5;
43
50
57struct Grid {
59 double xmin = 0.0;
61 double xmax = 100.0;
63 double ymin = 0.0;
65 double ymax = 100.0;
67 double step = 2.0;
69 int width = 0;
71 int height = 0;
72
84 Grid(double xminimum = 0.0, double xmaximum = 100.0,
85 double yminimum = 0.0, double ymaximum = 100.0, double spacing = 2.0);
90 int size() const;
96 double x(int column) const;
102 double y(int row) const;
109 int nearest_x(double value) const;
116 int nearest_y(double value) const;
117};
118
125
133 double beta = 1.0;
135 double threshold = 0.3;
137 double zmin = 10.0;
139 double zmax = 40.0;
141 double angle_of_view = 60.0;
143 double cost_exponent = 1.0;
145 double step_xy = 20.0;
147 double step_z = 8.0;
149 int horizon = 8;
151 int maxiter = 25;
153 int popsize = 12;
155 int maxfevals = 1000;
157 long seed = 55;
161 bool refine = true;
163 double observation_variance = -1.0;
165 unsigned margin_cells = 2;
167 std::function<bool()> keep_planning;
168};
169
177double fov_radius(double altitude, double angle = 60.0);
185int resolution_block_size(double altitude);
194double noise_model(double altitude, double minimum_altitude = 10.0);
205Matrix initialize_covariance(const Grid& grid, double sigma2, double lengthscale);
217Sensor build_sensor(const Grid& grid, const Point& pose, double angle = 60.0,
218 double observation_variance = -1.0);
233Sensor future_sensor(const Grid& grid, const std::vector<Point>& path,
234 double angle = 60.0, int stride = lookahead_stride,
235 int max_measurements = lookahead_measurement_budget,
236 double observation_variance = -1.0);
244Vector observe(const Sensor& sensor, const Vector& field);
253Vector sample_sensor_noise(const Sensor& sensor, std::mt19937_64& generator);
263std::vector<bool> importance_mask(const Vector& mean, const Matrix& covariance,
264 const PlannerOptions& options);
274double expected_reduction(const Matrix& covariance, const std::vector<bool>& mask,
275 const Sensor& sensor);
286void condition(Matrix& covariance, Vector* mean, const Sensor& sensor, const Vector* measurement);
296Point clip_point(const Grid& grid, const Point& point, const PlannerOptions& options);
305std::vector<Point> lattice(const Grid& grid, const PlannerOptions& options);
317std::vector<Point> spline(const Point& start, const std::vector<Point>& waypoints,
318 int samples_per_segment = spline_samples_per_segment);
332double trajectory_objective(const Grid& grid, const Matrix& covariance,
333 const std::vector<bool>& mask, const Point& start,
334 const std::vector<Point>& raw_waypoints, const PlannerOptions& options);
347std::vector<Point> grid_search(const Grid& grid, const Vector& mean, const Matrix& covariance,
348 const Point& start, const PlannerOptions& options);
362std::vector<Point> refine(const Grid& grid, const Vector& mean, const Matrix& covariance,
363 const Point& start, const std::vector<Point>& initial,
364 const PlannerOptions& options);
376std::vector<Point> plan(const Grid& grid, const Vector& mean, const Matrix& covariance,
377 const Point& start, const PlannerOptions& options);
378
379}
Eigen-style Aigen values and build-selected planner aliases.
VectorXd Vector
Existing planner vector spelling.
Definition compat.hpp:278
Vector3d Point
Existing planner point spelling.
Definition compat.hpp:280
MatrixXd Matrix
Existing planner matrix spelling.
Definition compat.hpp:276
Definition compat.hpp:242
dipla::aigenlib::Sensor Sensor
Sparse block-averaging observation operator.
Definition dipla_gp_belief_planner.hpp:124
double fov_radius(double altitude, double angle)
Compute the ground-plane footprint radius from altitude and full FOV angle.
Definition dipla_gp_belief_planner.cpp:230
constexpr int lookahead_measurement_budget
Innovation-system row budget, independent of worker FIFO capacity.
Definition dipla_gp_belief_planner.hpp:40
std::vector< Point > refine(const Grid &grid, const Vector &mean, const Matrix &covariance, const Point &start, const std::vector< Point > &initial, const PlannerOptions &options)
Refine a greedy route with bounded CMA-ES while retaining its best candidate.
Definition cmaes_optimizer.cpp:55
std::vector< Point > plan(const Grid &grid, const Vector &mean, const Matrix &covariance, const Point &start, const PlannerOptions &options)
Run greedy route selection followed by optional CMA-ES refinement.
Definition cmaes_optimizer.cpp:114
int resolution_block_size(double altitude)
Select the research sensor's altitude-dependent aggregation block size.
Definition dipla_gp_belief_planner.cpp:238
double noise_model(double altitude, double minimum_altitude)
Compute modeled observation variance at an altitude.
Definition dipla_gp_belief_planner.cpp:248
constexpr int spline_samples_per_segment
Default emitted spline samples per control segment.
Definition dipla_gp_belief_planner.hpp:42
std::vector< Point > spline(const Point &start, const std::vector< Point > &waypoints, int samples_per_segment)
Interpolate controls with a natural cubic spline parameterized by distance.
Definition dipla_gp_belief_planner.cpp:573
std::vector< bool > importance_mask(const Vector &mean, const Matrix &covariance, const PlannerOptions &options)
Select cells whose confidence bounds satisfy the utility threshold.
Definition dipla_gp_belief_planner.cpp:417
Matrix initialize_covariance(const Grid &grid, double sigma2, double lengthscale)
Initialize a dense Matérn-3/2 GP covariance matrix.
Definition dipla_gp_belief_planner.cpp:262
constexpr int lookahead_stride
Default route-pose sampling interval for look-ahead scoring.
Definition dipla_gp_belief_planner.hpp:38
math::Point Point
Three-dimensional local east/north/altitude point, in metres.
Definition dipla_gp_belief_planner.hpp:49
Vector sample_sensor_noise(const Sensor &sensor, std::mt19937_64 &generator)
Draw independent zero-mean noise using each sensor row's variance.
Definition dipla_gp_belief_planner.cpp:398
double trajectory_objective(const Grid &grid, const Matrix &covariance, const std::vector< bool > &mask, const Point &start, const std::vector< Point > &raw_waypoints, const PlannerOptions &options)
Score a trajectory by safety violation and distance-normalized information gain.
Definition dipla_gp_belief_planner.cpp:635
math::Matrix Matrix
Dense row-major covariance layout chosen for contiguous row updates.
Definition dipla_gp_belief_planner.hpp:45
double expected_reduction(const Matrix &covariance, const std::vector< bool > &mask, const Sensor &sensor)
Sum expected marginal-variance reduction over important cells.
Definition dipla_gp_belief_planner.cpp:441
Sensor future_sensor(const Grid &grid, const std::vector< Point > &path, double angle, int stride, int max_measurements, double observation_variance)
Approximate future measurements along a path under a bounded budget.
Definition dipla_gp_belief_planner.cpp:335
Sensor build_sensor(const Grid &grid, const Point &pose, double angle, double observation_variance)
Build one block-averaged sensor footprint at a pose.
Definition dipla_gp_belief_planner.cpp:296
math::Vector Vector
Dynamic GP mean, measurement, or per-cell variance vector.
Definition dipla_gp_belief_planner.hpp:47
void condition(Matrix &covariance, Vector *mean, const Sensor &sensor, const Vector *measurement)
Apply a Gaussian linear-observation update in place.
Definition dipla_gp_belief_planner.cpp:473
std::vector< Point > grid_search(const Grid &grid, const Vector &mean, const Matrix &covariance, const Point &start, const PlannerOptions &options)
Greedily select a bounded route by information gain per travel cost.
Definition dipla_gp_belief_planner.cpp:678
std::vector< Point > lattice(const Grid &grid, const PlannerOptions &options)
Generate the deduplicated coarse-to-fine candidate lattice.
Definition dipla_gp_belief_planner.cpp:531
Vector observe(const Sensor &sensor, const Vector &field)
Apply the sensor's block averages to a full-grid field.
Definition dipla_gp_belief_planner.cpp:379
Point clip_point(const Grid &grid, const Point &point, const PlannerOptions &options)
Clamp a candidate to the map safety inset and altitude interval.
Definition dipla_gp_belief_planner.cpp:516
Rectangular, evenly spaced local map grid.
Definition dipla_gp_belief_planner.hpp:57
int nearest_y(double value) const
Find the nearest clamped row; half-cell ties round downward.
Definition dipla_gp_belief_planner.cpp:215
double xmax
Inclusive, grid-aligned upper east bound in metres.
Definition dipla_gp_belief_planner.hpp:61
int nearest_x(double value) const
Find the nearest clamped column; half-cell ties round downward.
Definition dipla_gp_belief_planner.cpp:203
double xmin
Inclusive lower east bound in metres.
Definition dipla_gp_belief_planner.hpp:59
double x(int column) const
Convert a column index to its east coordinate.
Definition dipla_gp_belief_planner.cpp:194
double step
Uniform spacing in metres.
Definition dipla_gp_belief_planner.hpp:67
double ymax
Inclusive, grid-aligned upper north bound in metres.
Definition dipla_gp_belief_planner.hpp:65
double ymin
Inclusive lower north bound in metres.
Definition dipla_gp_belief_planner.hpp:63
int width
Number of columns.
Definition dipla_gp_belief_planner.hpp:69
int size() const
Return the number of grid cells.
Definition dipla_gp_belief_planner.cpp:192
double y(int row) const
Convert a row index to its north coordinate.
Definition dipla_gp_belief_planner.cpp:196
Grid(double xminimum=0.0, double xmaximum=100.0, double yminimum=0.0, double ymaximum=100.0, double spacing=2.0)
Create a grid and align its effective upper bounds.
Definition dipla_gp_belief_planner.cpp:173
int height
Number of rows.
Definition dipla_gp_belief_planner.hpp:71
Search, utility, and optimizer controls for the reference planner.
Definition dipla_gp_belief_planner.hpp:131
bool lower_confidence_bound
Choose lower-confidence-bound versus upper-confidence-bound utility.
Definition dipla_gp_belief_planner.hpp:159
double threshold
Field-value threshold used to define planning importance.
Definition dipla_gp_belief_planner.hpp:135
int maxfevals
Maximum objective evaluations; an incomplete population is not run.
Definition dipla_gp_belief_planner.hpp:155
std::function< bool()> keep_planning
Optional cooperative continue predicate, checked during planning.
Definition dipla_gp_belief_planner.hpp:167
double cost_exponent
Exponent used to penalize travel distance.
Definition dipla_gp_belief_planner.hpp:143
int maxiter
Maximum CMA-ES generations.
Definition dipla_gp_belief_planner.hpp:151
double zmax
Maximum permitted altitude in metres.
Definition dipla_gp_belief_planner.hpp:139
double beta
Confidence multiplier applied to posterior standard deviation.
Definition dipla_gp_belief_planner.hpp:133
bool refine
Run CMA-ES refinement after greedy lattice selection.
Definition dipla_gp_belief_planner.hpp:161
long seed
Reproducible optimizer seed.
Definition dipla_gp_belief_planner.hpp:157
double step_z
Initial CMA-ES standard deviation for altitude.
Definition dipla_gp_belief_planner.hpp:147
double zmin
Minimum permitted altitude in metres.
Definition dipla_gp_belief_planner.hpp:137
int horizon
Greedy waypoint count.
Definition dipla_gp_belief_planner.hpp:149
double angle_of_view
Full sensor field-of-view angle in degrees.
Definition dipla_gp_belief_planner.hpp:141
int popsize
CMA-ES population size and evaluation batch size.
Definition dipla_gp_belief_planner.hpp:153
double observation_variance
Fixed observation variance; negative selects the altitude noise model.
Definition dipla_gp_belief_planner.hpp:163
unsigned margin_cells
Horizontal control inset in grid cells, independent of altitude.
Definition dipla_gp_belief_planner.hpp:165
double step_xy
Initial CMA-ES standard deviation for horizontal coordinates.
Definition dipla_gp_belief_planner.hpp:145
Sparse uniform-averaging measurement operator.
Definition aigenlib.hpp:161