FOUND Coverage Report


src/
File: providers/stage-providers.hpp
Date: 2025-11-20 21:57:26
Lines:
35/35
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 #include <utility>
6
7 #include "command-line/parsing/options.hpp"
8
9 #include "common/pipeline/pipelines.hpp"
10
11 #include "calibrate/calibrate.hpp"
12
13 #include "distance/edge.hpp"
14 #include "distance/distance.hpp"
15 #include "distance/vectorize.hpp"
16
17 #include "orbit/orbit.hpp"
18
19 // TODO(nguy8tri): Include statement for Orbit Pipeline
20 // TODO: Fully Implement this when orbit stage is implemented
21
22 #include "common/decimal.hpp"
23
24 namespace found {
25
26 /**
27 * Provides a CalibrationAlgorithm
28 *
29 * @param options The options to derive the calibration algorithm from
30 *
31 * @return A pointer to the CalibrationAlgorithm
32 */
33 4 inline std::unique_ptr<CalibrationAlgorithm> ProvideCalibrationAlgorithm(
34 [[maybe_unused]] CalibrationOptions &&options) {
35
1/1
✓ Branch 2 taken 4 times.
4 return std::make_unique<LOSTCalibrationAlgorithm>();
36 }
37
38 /**
39 * Provides an EdgeDetectionAlgorithm
40 *
41 * @param options The options to derive the edge detection algorithm from
42 *
43 * @return std::unique_ptr<EdgeDetectionAlgorithm> The edge detection algorithm
44 */
45 9 inline std::unique_ptr<EdgeDetectionAlgorithm> ProvideEdgeDetectionAlgorithm(const DistanceOptions &options) {
46 9 return std::make_unique<SimpleEdgeDetectionAlgorithm>(options.SEDAThreshold,
47 9 options.SEDABorderLen,
48
1/1
✓ Branch 2 taken 9 times.
18 options.SEDAOffset);
49 }
50
51 /**
52 * Provides a DistanceDeterminationAlgorithm
53 *
54 * @param options The options to derive the distance determination algorithm from
55 *
56 * @return std::unique_ptr<DistanceDeterminationAlgorithm> The distance determination algorithm
57 */
58 9 inline std::unique_ptr<DistanceDeterminationAlgorithm> ProvideDistanceDeterminationAlgorithm(
59 const DistanceOptions &options) {
60
2/2
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 2 times.
9 if (options.distanceAlgo == SDDA) {
61
1/1
✓ Branch 2 taken 7 times.
21 return std::make_unique<SphericalDistanceDeterminationAlgorithm>(options.radius, Camera(options.focalLength,
62 21 options.pixelSize, options.image.width, 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 1 Camera(options.focalLength,
66 1 options.pixelSize,
67 1 options.image.width,
68 1 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 8 inline std::unique_ptr<VectorGenerationAlgorithm> ProvideVectorGenerationAlgorithm(const DistanceOptions &options) {
89
1/1
✓ Branch 2 taken 8 times.
8 Quaternion referenceOrientation = SphericalToQuaternion(options.refOrientation);
90
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
8 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 6 times.
6 Quaternion relativeOrientation = SphericalToQuaternion(options.relOrientation);
96
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
6 if (options.refAsOrientation) {
97
8/8
✓ Branch 3 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 16 taken 5 times.
✓ Branch 20 taken 5 times.
✓ Branch 23 taken 5 times.
✓ Branch 26 taken 5 times.
✓ Branch 29 taken 5 times.
15 LOG_INFO("Using provided reference orientation for calibration information");
98
1/1
✓ Branch 2 taken 5 times.
5 return std::make_unique<LOSTVectorGenerationAlgorithm>(referenceOrientation);
99 }
100
1/1
✓ Branch 2 taken 1 times.
1 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