Skip to content

Commit

Permalink
Pipeline Implementation (#7)
Browse files Browse the repository at this point in the history
* Added return to main

* Squashed commit of the following:

commit 86a843f
Author: Tri Nguyen <[email protected]>
Date:   Sat Mar 25 17:24:22 2023 -0700

    Update README to viewable version

commit 00a9764
Merge: bc566cb 8eaa5cf
Author: Tri Nguyen <[email protected]>
Date:   Sat Mar 25 16:37:50 2023 -0700

    Merge pull request #2 from UWCubeSat/interface

    Testing Suite Setup

* Squashed commit of the following:

commit 7b3c7e1
Author: Tri Nguyen <[email protected]>
Date:   Fri Sep 13 10:51:58 2024 -0700

    Refractoring Changes

commit 86a843f
Author: Tri Nguyen <[email protected]>
Date:   Sat Mar 25 17:24:22 2023 -0700

    Update README to viewable version

commit 00a9764
Merge: bc566cb 8eaa5cf
Author: Tri Nguyen <[email protected]>
Date:   Sat Mar 25 16:37:50 2023 -0700

    Merge pull request #2 from UWCubeSat/interface

    Testing Suite Setup

* Merging from refractor

* Pipeline Implementation

* Made initial test and edits to pipeline.*

* Use constants more

* Squashed commit of the following:

commit f370c67
Author: Tri Nguyen <[email protected]>
Date:   Sat Sep 21 16:21:59 2024 -0700

    Refractor v2 (#6)

commit 0a466d3
Author: Tri Nguyen <[email protected]>
Date:   Sun Sep 15 19:42:02 2024 -0700

    Refractor Code Base for Implementation (#5)

    Merge from pipeline, refractoring changes

    PR: #5

commit 86a843f
Author: Tri Nguyen <[email protected]>
Date:   Sat Mar 25 17:24:22 2023 -0700

    Update README to viewable version

commit 00a9764
Merge: bc566cb 8eaa5cf
Author: Tri Nguyen <[email protected]>
Date:   Sat Mar 25 16:37:50 2023 -0700

    Merge pull request #2 from UWCubeSat/interface

    Testing Suite Setup

* Removed catch framework

* Fixed minor issues

* Documentation and Quality Changes

* pending tests

* pipeline tests 100% coverage, all functions work

* Squashed commit of the following:

commit 1d2c89b
Author: Tri Nguyen <[email protected]>
Date:   Sat Oct 5 17:19:22 2024 -0700

    Example Test bugs

commit adece2b
Author: Tri Nguyen <[email protected]>
Date:   Sat Oct 5 17:11:03 2024 -0700

    Stage extension for all stages

* Revert to C++11

* Resolving Changes

---------

Co-authored-by: Tri Nguyen <[email protected]>
  • Loading branch information
heeu0 and nguy8tri authored Oct 14, 2024
1 parent f370c67 commit 3863509
Show file tree
Hide file tree
Showing 19 changed files with 558 additions and 90 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ test_message:
$(COVERAGE_TARGET): $(TEST_SETUP_TARGET) $(TEST_TARGET)
$(call PRINT_TARGET_HEADER, $(COVERAGE_TARGET))
valgrind ./$(TEST_BIN)
gcovr || python3 -m gcovr || $(PASS_ON_COVERAGE_FAIL)
gcovr || $(PASS_ON_COVERAGE_FAIL)

# The stylecheck target for tests
$(GOOGLE_STYLECHECK_TEST_TARGET): $(TEST_FILES)
$(call PRINT_TARGET_HEADER, $(GOOGLE_STYLECHECK_TEST_TARGET))
cpplint $(TEST_FILES) || python3 -m cpplint $(TEST_FILES)
cpplint $(TEST_FILES)

# The pre-processed artifacts target (private)
private: $(COMPILE_SETUP_TARGET) $(TEST_SETUP_TARGET) private_message $(PRIVATE_SRC) $(PRIVATE_TEST)
Expand Down
4 changes: 2 additions & 2 deletions doxygen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ rm -rf Doxyfile.bak
doxygen 2> stderr.log

# Extract warnings from stderr file
warnings=$(grep "warning" stderr.log)
warnings=$(cat stderr.log)

# Cleanup the stderr file
rm stderr.log

# Check for warnings/errors in the log file
if [ -n "$warnings" ]; then
printf "\nDoxygen found errors and warnings while generating documentation:\n"
echo $warnings
echo "$warnings"
printf "\n"
exit 1
else
Expand Down
14 changes: 6 additions & 8 deletions gcovr.cfg
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
exclude = build/*
exclude = test/*
exclude = src/main.cpp
# exclude = src/command-line/*
# exclude = src/distance/*
# exclude = src/model/*
# exclude = src/spatial/*
# exclude = src/style/*
# fail-under-line = 85
# fail-under-branch = 85
exclude = src/spatial/*
exclude-throw-branches = yes
fail-under-line = 85
fail-under-branch = 85
html-details = yes
html-medium-threshold = 70
html-high-threshold = 85
output = build/documentation/coverage/index.html
html-theme=github.green
html = build/documentation/coverage/index.html
delete-gcov-files = yes
print-summary = yes
6 changes: 1 addition & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ for PACKAGE in $PACKAGES; do
execute_cmd $CMD
done

# Attempt to install gcovr
CMD="$INSTALL gcovr || true"
execute_cmd $CMD

# Install doxygen
CMD="$INSTALL doxygen || ( \
$INSTALL bison && \
Expand All @@ -100,7 +96,7 @@ CMD="$INSTALL doxygen || ( \
execute_cmd $CMD

# Python packages to install
PYTHON_PACKAGES="cpplint gcovr"
PYTHON_PACKAGES="cpplint==1.6.1 gcovr==7.2"

# Install each package and echo the command
for PACKAGE in $PYTHON_PACKAGES; do
Expand Down
19 changes: 4 additions & 15 deletions src/distance/distance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,20 @@
#define DISTANCE_H

#include "style/style.hpp"
#include "pipeline/pipeline.hpp"

namespace found {

/**
* The DistanceDeterminationAlgorithm class houses the Distance Determination Algorithm. This
* algorithm calculates the distance from Earth based on the pixels of Earth's Edge found in the image.
*/
class DistanceDeterminationAlgorithm {
class DistanceDeterminationAlgorithm : public Stage<Points, distFromEarth> {
public:
// Constructs this
DistanceDeterminationAlgorithm() = default;
// Destroys this
virtual ~DistanceDeterminationAlgorithm();

/**
* Computes the distance of the satellite from Earth based on an image of Earth
*
* @param image The image of Earth, represented as a character array with values from 0-255
* that represents the black/white color of each pixel
* @param p The Points that we find on Earth's horizon with respect to the image coordinate
* system
*
* @return The distance of the satellite from Earth
*/
virtual distFromEarth Run(char* image, Points &p /*More go here*/) = 0;
};

/**
Expand All @@ -48,7 +37,7 @@ class SphericalDistanceDeterminationAlgorithm : public DistanceDeterminationAlgo
/**
* Place documentation here. Press enter to automatically make a new line
* */
distFromEarth Run(char* image, Points &p/*More go here*/) override;
distFromEarth Run(const Points &p) override;
private:
// Fields specific to this algorithm, and helper methods
};
Expand All @@ -72,7 +61,7 @@ class EllipticDistanceDeterminationAlgorithm : public DistanceDeterminationAlgor
/**
* Place documentation here. Press enter to automatically make a new line
* */
distFromEarth Run(char* image, Points &p/*More go here*/) override;
distFromEarth Run(const Points &p) override;
private:
// Fields specific to this algorithm, and helper methods
};
Expand Down
18 changes: 4 additions & 14 deletions src/distance/edge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,15 @@
#define EDGE_H

#include "style/style.hpp"
#include "pipeline/pipeline.hpp"

namespace found {

/**
* The EdgeDetection Algorithm class houses the Edge Detection Algorithm. This algorithm uses
* a picture of Earth and finds all points on the horizon within the picture.
*/
class EdgeDetectionAlgorithm {
public:
/**
* Finds all points on Earth's horizon as seen in an image
*
* @param image The image of Earth, represented as a character array with values from 0-255
* that represents the black/white color of each pixel
*
* @return A Points object that holds all points found in the image
*/
virtual Points Run(unsigned char* image/*parameters all algorithms will need (Override this plz)*/) = 0;
};
class EdgeDetectionAlgorithm : public Stage<Image, Points> {};

/**
* The SimpleEdgeDetection Algorithm class houses the Edge Detection Algorithm. This algorithm uses
Expand All @@ -42,7 +32,7 @@ class SimpleEdgeDetectionAlgorithm : public EdgeDetectionAlgorithm {
/**
* Place documentation here. Press enter to automatically make a new line
* */
Points Run(unsigned char* image/*parameters all algorithms will need (Override this plz)*/) override;
Points Run(const Image &image/*parameters all algorithms will need (Override this plz)*/) override;
private:
// useful fields specific to this algorithm and helper methods
};
Expand All @@ -67,7 +57,7 @@ class LoCEdgeDetectionAlgorithm : public EdgeDetectionAlgorithm {
/**
* Place documentation here. Press enter to automatically make a new line
* */
Points Run(unsigned char* image/*parameters all algorithms will need (Override this plz)*/) override;
Points Run(const Image &image/*parameters all algorithms will need (Override this plz)*/) override;
private:
// useful fields specific to this algorithm and helper methods
};
Expand Down
19 changes: 6 additions & 13 deletions src/distance/vectorize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "spatial/attitude-utils.hpp"
#include "style/style.hpp"
#include "pipeline/pipeline.hpp"

namespace found {

Expand All @@ -11,20 +12,12 @@ namespace found {
* finds the position from Earth with respect to its center with a 3D Vector (Vec3).
*
*/
class VectorGenerationAlgorithm {
class VectorGenerationAlgorithm : public Stage<distFromEarth, PositionVector> {
public:
// Constructs this
VectorGenerationAlgorithm() = default;
// Destroys this
virtual ~VectorGenerationAlgorithm();

/**
* Finds the vector of the satellite with respect to Earth's center
*
* @param x_E The distance from Earth
*
* @return A PositionVector that represents the 3D Vector of the satellite relative to
* Earth's center
*/
virtual PositionVector Run(distFromEarth x_E /*Params common to this type*/) = 0;
};

/**
Expand Down Expand Up @@ -54,7 +47,7 @@ class LOSTVectorGenerationAlgorithm : public VectorGenerationAlgorithm {
* @return A PositionVector that represents the 3D Vector of the satellite relative to
* Earth's center
*/
PositionVector Run(distFromEarth x_E /*Params to override the base class one*/) override;
PositionVector Run(const distFromEarth &x_E /*Params to override the base class one*/) override;

private:
// Fields specific to this algorithm go here, and helper methods
Expand Down Expand Up @@ -83,7 +76,7 @@ class FeatureDetectionVectorGenerationAlgorithm : public VectorGenerationAlgorit
/**
* Place documentation here. Press enter to automatically make a new line
* */
PositionVector Run(distFromEarth x_E /*Params to override the base class one*/) override;
PositionVector Run(const distFromEarth &x_E /*Params to override the base class one*/) override;
private:
// Fields specific to this algorithm go here, and helper methods
};
Expand Down
3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int FoundMain(int argc, char **argv) {
while ((option = getopt_long(argc, argv, "", long_options, &index)) != -1) {
switch (option) {
#define FOUND_CLI_OPTION(name, type, prop, defaultVal, converter, defaultArg) \
case static_cast<int>(DatabaseCliOption::prop) : \
case static_cast<int>(DatabaseCliOption::prop) : \
if (defaultArg == 0) { \
options.prop = converter; \
} else { \
Expand Down Expand Up @@ -98,4 +98,5 @@ int FoundMain(int argc, char **argv) {
*/
int main(int argc, char **argv) {
found::FoundMain(argc, argv);
return 0;
}
17 changes: 4 additions & 13 deletions src/model/kinematic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "style/style.hpp"
#include "spatial/attitude-utils.hpp"
#include "pipeline/pipeline.hpp"

namespace found {

Expand All @@ -13,20 +14,10 @@ namespace found {
* position of the satellite at any time
*
*/
class KinematicProfilingAlgorithm {
class KinematicProfilingAlgorithm : public Stage<OrbitParams, KinematicPrediction> {
public:
// Destroys this
virtual ~KinematicProfilingAlgorithm();

/**
* Derives the kinematic profile of the satellite
*
* @param orbit The projected path of the satellite
*
* @return A KinematicPrediction that describes the kinematic profile of the satellite
*
*/
virtual KinematicPrediction Run(OrbitParams &orbit /*Params common to this type*/) = 0;
};

/**
Expand All @@ -52,7 +43,7 @@ class EulerianKinematicProfilingAlgorithm : public KinematicProfilingAlgorithm {
/**
* Place documentation here. Press enter to automatically make a new line
* */
KinematicPrediction Run(OrbitParams &orbit /*Params to override the base class one*/) override;
KinematicPrediction Run(const OrbitParams &orbit /*Params to override the base class one*/) override;
private:
// Fields specific to this algorithm go here, and helper methods
};
Expand Down Expand Up @@ -80,7 +71,7 @@ class KeplerKinematicProfilingAlgorithm : public KinematicProfilingAlgorithm {
/**
* Place documentation here. Press enter to automatically make a new line
* */
KinematicPrediction Run(OrbitParams &orbit /*Params to override the base class one*/) override;
KinematicPrediction Run(const OrbitParams &orbit /*Params to override the base class one*/) override;
private:
// Fields specific to this algorithm go here, and helper methods
};
Expand Down
18 changes: 4 additions & 14 deletions src/model/orbit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "spatial/attitude-utils.hpp"
#include "style/style.hpp"
#include "pipeline/pipeline.hpp"

namespace found {

Expand All @@ -13,21 +14,10 @@ namespace found {
* algorithm finds the orbit path of the satellite from known position vectors relative to Earth
*
*/
class OrbitDeterminationAlgorithm {
class OrbitDeterminationAlgorithm : public Stage<std::vector<Vec3>, OrbitParams> {
public:
// Destroys this
virtual ~OrbitDeterminationAlgorithm();

/**
* Finds orbit parameters based off of given positional vectors
*
* @param positions A list describing known points along satellite path
*
* @return An OrbitParams, which describes the characteristics of the orbital path
*
* @note See style.hpp for more detailed documentation of OrbitParams
*/
virtual OrbitParams Run(std::vector<Vec3> &positions /*Params common to this type*/) = 0;
};

/**
Expand All @@ -51,7 +41,7 @@ class EllipticalOrbitDerminationAlgorithm : public OrbitDeterminationAlgorithm {
/**
* Place documentation here. Press enter to automatically make a new line
* */
OrbitParams Run(std::vector<Vec3> &positions /*Params to override the base class one*/) override;
OrbitParams Run(const std::vector<Vec3> &positions /*Params to override the base class one*/) override;
private:
// Fields specific to this algorithm go here, and helper methods
};
Expand All @@ -77,7 +67,7 @@ class PrecessionOrbitDeterminationAlgorithm : public OrbitDeterminationAlgorithm
/**
* Place documentation here. Press enter to automatically make a new line
* */
OrbitParams Run(std::vector<Vec3> &positions /*Params to override the base class one*/) override;
OrbitParams Run(const std::vector<Vec3> &positions /*Params to override the base class one*/) override;
private:
// Fields specific to this algorithm go here, and helper methods
};
Expand Down
Loading

0 comments on commit 3863509

Please sign in to comment.