FOUND Coverage Report


src/
File: providers/stage-providers.hpp
Date: 2026-03-24 21:41:51
Lines:
33/33
100.0%
Functions:
4/4
100.0%
Branches:
44/44
100.0%

Line Branch Exec Source
1 #ifndef SRC_PROVIDERS_STAGE_PROVIDERS_HPP_
2 #define SRC_PROVIDERS_STAGE_PROVIDERS_HPP_
3
4 #include <memory>
5
6 #include "command-line/parsing/options.hpp"
7
8 #include "common/pipeline/pipelines.hpp"
9
10 #include "calibrate/calibrate.hpp"
11
12 #include "distance/edge.hpp"
13 #include "distance/distance.hpp"
14 #include "distance/vectorize.hpp"
15
16 #include "orbit/orbit.hpp"
17
18 // TODO(nguy8tri): Include statement for Orbit Pipeline
19 // TODO: Fully Implement this when orbit stage is implemented
20
21 #include "common/decimal.hpp"
22
23 namespace found {
24
25 /**
26 * Provides a CalibrationAlgorithm
27 *
28 * @param options The options to derive the calibration algorithm from
29 *
30 * @return A pointer to the CalibrationAlgorithm
31 */
32 4 std::unique_ptr<CalibrationAlgorithm> ProvideCalibrationAlgorithm([[maybe_unused]] CalibrationOptions &&options) {
33
1/1
✓ Branch 2 taken 4 times.
4 return std::make_unique<LOSTCalibrationAlgorithm>();
34 }
35
36 /**
37 * Provides an EdgeDetectionAlgorithm
38 *
39 * @param options The options to derive the edge detection algorithm from
40 *
41 * @return std::unique_ptr<EdgeDetectionAlgorithm> The edge detection algorithm
42 */
43 6 std::unique_ptr<EdgeDetectionAlgorithm> ProvideEdgeDetectionAlgorithm(DistanceOptions &&options) {
44 6 return std::make_unique<SimpleEdgeDetectionAlgorithm>(options.SEDAThreshold,
45 6 options.SEDABorderLen,
46
1/1
✓ Branch 2 taken 6 times.
12 options.SEDAOffset);
47 }
48
49 /**
50 * Provides a DistanceDeterminationAlgorithm
51 *
52 * @param options The options to derive the distance determination algorithm from
53 *
54 * @return std::unique_ptr<DistanceDeterminationAlgorithm> The distance determination algorithm
55 */
56 7 std::unique_ptr<DistanceDeterminationAlgorithm> ProvideDistanceDeterminationAlgorithm(DistanceOptions &&options) {
57
2/2
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 2 times.
7 if (options.distanceAlgo == SDDA) {
58
1/1
✓ Branch 2 taken 5 times.
20 return std::make_unique<SphericalDistanceDeterminationAlgorithm>(options.radius,
59 10 Camera(options.focalLength,
60 options.pixelSize,
61 options.image.width,
62 10 options.image.height));
63
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 } else if (options.distanceAlgo == ISDDA) {
64
1/1
✓ Branch 1 taken 1 times.
3 return std::make_unique<IterativeSphericalDistanceDeterminationAlgorithm>(options.radius,
65 2 Camera(options.focalLength,
66 options.pixelSize,
67 options.image.width,
68 options.image.height),
69 1 options.ISDDAMinIters,
70 1 options.ISDDAMaxRefresh,
71 1 options.ISDDADistRatio,
72 1 options.ISDDADiscimRatio,
73 1 options.ISDDAPdfOrd,
74 2 options.ISDDARadLossOrd);
75 } else {
76
9/9
✓ Branch 3 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 20 taken 1 times.
✓ Branch 23 taken 1 times.
✓ Branch 26 taken 1 times.
✓ Branch 29 taken 1 times.
✓ Branch 32 taken 1 times.
3 LOG_ERROR("Unrecognized distance algorithm: " << options.distanceAlgo);
77
2/2
✓ Branch 3 taken 1 times.
✓ Branch 6 taken 1 times.
1 throw std::runtime_error("Unrecognized distance algorithm: " + options.distanceAlgo);
78 }
79 }
80
81 /**
82 * Provides a VectorGenerationAlgorithm
83 *
84 * @param options The options to derive the vector generation algorithm from
85 *
86 * @return std::unique_ptr<VectorGenerationAlgorithm> The vector generation algorithm
87 */
88 7 std::unique_ptr<VectorGenerationAlgorithm> ProvideVectorGenerationAlgorithm(DistanceOptions &&options) {
89
1/1
✓ Branch 2 taken 7 times.
7 Quaternion referenceOrientation = SphericalToQuaternion(options.refOrientation);
90
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 5 times.
7 if (options.calibrationData.header.version != emptyDFVer) {
91
8/8
✓ Branch 3 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 20 taken 2 times.
✓ Branch 23 taken 2 times.
✓ Branch 26 taken 2 times.
✓ Branch 29 taken 2 times.
6 LOG_INFO("Using DataFile for calibration information");
92
1/1
✓ Branch 1 taken 2 times.
4 return std::make_unique<LOSTVectorGenerationAlgorithm>(options.calibrationData.relative_attitude,
93 4 referenceOrientation);
94 } else {
95
1/1
✓ Branch 2 taken 5 times.
5 Quaternion relativeOrientation = SphericalToQuaternion(options.relOrientation);
96
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
5 if (options.refAsOrientation) {
97
8/8
✓ Branch 3 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 16 taken 3 times.
✓ Branch 20 taken 3 times.
✓ Branch 23 taken 3 times.
✓ Branch 26 taken 3 times.
✓ Branch 29 taken 3 times.
9 LOG_INFO("Using provided reference orientation for calibration information");
98
1/1
✓ Branch 2 taken 3 times.
3 return std::make_unique<LOSTVectorGenerationAlgorithm>(referenceOrientation);
99 }
100
1/1
✓ Branch 2 taken 2 times.
2 return std::make_unique<LOSTVectorGenerationAlgorithm>(relativeOrientation, referenceOrientation);
101 }
102 }
103
104 // TODO: Uncomment when orbit stage is implemented
105 /**
106 * Provides an OrbitPropagationAlgorithm
107 *
108 * @param options The options to derive the orbit propagation algorithm from
109 *
110 * @return std::unique_ptr<OrbitPropagationAlgorithm> The orbit propagation algorithm
111 */
112 // std::unique_ptr<OrbitPropagationAlgorithm> ProvideOrbitPropagationAlgorithm(OrbitOptions &&options) {
113 // return std::make_unique<ApproximateOrbitPropagationAlgorithm>(options.totalTime,
114 // options.dt,
115 // options.radius,
116 // options.mu);
117 // }
118
119 } // namespace found
120
121 #endif // SRC_PROVIDERS_STAGE_PROVIDERS_HPP_
122