diff --git a/documentation/pipeline.man b/documentation/pipeline.man index 63697aa3..ce9091b1 100644 --- a/documentation/pipeline.man +++ b/documentation/pipeline.man @@ -11,7 +11,7 @@ pipeline \- builds a pipeline of the star identification process .br \fBpipeline\fP --generate[=\fInum-images\fP] [--horizontal-res \fIres\fP] [--vertical-res \fIres\fP] [--horizontal-fov \fIdegrees\fP] [--ref-brightness \fImag\fP] [--spread-stddev \fIstddev\fP] [--noise-stddev \fIstddev\fP] [--boresight-right-asc \fIascension\fP] [--boresight-dec \fIdeclination\fP] [--boresight-roll \fIroll\fP] [--centroid-algo \fIalgorithm\fP [--centroid-dummy-stars \fInum-stars\fP]] [--centroid-mag-filter \fImin-mag\fP] -[--database \fIfilename\fP] [--star-id-algo \fIalgo\fP (--gv-tolerance \fIdegrees\fP | --py-tolerance \fIdegrees\fP --false-stars \fInum\fP --max-mismatch-prob \fIprobability\fP)] [--attitude-algo \fIalgo\fP] [--plot \fIoutput-path\fB] +[--database \fIfilename\fP] [--star-id-algo \fIalgo\fP (--gv-tolerance \fIdegrees\fP | --py-tolerance \fIdegrees\fP --false-stars \fInum\fP --max-mismatch-prob \fIprobability\fP | --prev-attitude \fIattitude\fP --uncertainty \fIradius\fP)] [--attitude-algo \fIalgo\fP] [--plot \fIoutput-path\fB] .SH DESCRIPTION @@ -69,6 +69,14 @@ used in some star id algorithms, to \fItolerance\fP degrees. Defaults to 0.04 de \fB--max-mismatch-prob\fP \fIprobability\fP \fIprobability\fP is the maximum allowable probability of an incorrect star identification, for star id algorithms which support it. Defaults to 0.001. +.TP +\fB--prev-attitude\fP \fIattitude\fP +\fIattitude\fP is the known previous attitude for tracking mode. Should give ra, dec, and roll as a comma-separated list: "ra,dec,roll." + +.TP +\fB--uncertainty\fP \fIradius\fP +For tracking mode. \fIradius\fP gives the boundary for how much the field of view could have rotated. + .TP \fB--attitude-algo\fP \fIalgo\fP Runs the \fIalgo\fP algorithm for the attitude stage of the pipeline. Current options are "dqm" (Davenport Q) and "triad". Defaults to dqm. diff --git a/src/io.cpp b/src/io.cpp index 56be1dfa..d778264e 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -695,6 +695,24 @@ Pipeline SetPipeline(const PipelineOptions &values) { result.starIdAlgorithm = std::unique_ptr(new GeometricVotingStarIdAlgorithm(DegToRad(values.angularTolerance))); } else if (values.idAlgo == "py") { result.starIdAlgorithm = std::unique_ptr(new PyramidStarIdAlgorithm(DegToRad(values.angularTolerance), values.estimatedNumFalseStars, values.maxMismatchProb, 1000)); + } else if (values.idAlgo == "tracking") { + result.starIdAlgorithm = std::unique_ptr(new TrackingModeStarIdAlgorithm()); + + // convert user inputted string ra,dec,roll to individual floats + std::vector attInputs; + std::stringstream ss (values.prevAttitudeString); + std::string item; + while (std::getline (ss, item, ',')) { + attInputs.push_back(stof(item)); + } + + // convert ra, dec, and roll to quaternion attitude + Quaternion q = SphericalToQuaternion(attInputs[0], attInputs[1], attInputs[2]); + Attitude a = Attitude(q); + + // set prev attitude part of pipeline + PrevAttitude prev(a, values.uncertainty); + result.prevAttitude = prev; } else if (values.idAlgo != "") { std::cout << "Illegal id algorithm." << std::endl; exit(1); @@ -757,7 +775,7 @@ PipelineOutput Pipeline::Go(const PipelineInput &input) { if (starIdAlgorithm && database && inputStars && input.InputCamera()) { // TODO: don't copy the vector! result.starIds = std::unique_ptr(new std::vector( - starIdAlgorithm->Go(database.get(), *inputStars, result.catalog, *input.InputCamera()))); + starIdAlgorithm->Go(database.get(), *inputStars, result.catalog, *input.InputCamera(), prevAttitude))); inputStarIds = result.starIds.get(); } @@ -773,7 +791,6 @@ PipelineOutput Pipeline::Go(const PipelineInput &input) { std::vector Pipeline::Go(const PipelineInputList &inputs) { std::vector result; - for (const std::unique_ptr &input : inputs) { result.push_back(Go(*input)); } diff --git a/src/io.hpp b/src/io.hpp index 7e468ff5..3d480e2e 100644 --- a/src/io.hpp +++ b/src/io.hpp @@ -191,6 +191,7 @@ class Pipeline { std::unique_ptr starIdAlgorithm; std::unique_ptr attitudeEstimationAlgorithm; std::unique_ptr database; + PrevAttitude prevAttitude; }; Pipeline SetPipeline(const PipelineOptions &values); diff --git a/src/pipeline-options.hpp b/src/pipeline-options.hpp index a8e74a00..eb65afed 100644 --- a/src/pipeline-options.hpp +++ b/src/pipeline-options.hpp @@ -24,6 +24,8 @@ LOST_CLI_OPTION("centroid-dummy-stars" , int , centroidDummyNumStars LOST_CLI_OPTION("centroid-mag-filter" , float , centroidMagFilter , -1 , atof(optarg) , 5) LOST_CLI_OPTION("database" , std::string, databasePath , "" , optarg , kNoDefaultArgument) LOST_CLI_OPTION("star-id-algo" , std::string, idAlgo , "" , optarg , "pyramid") +LOST_CLI_OPTION("prev-attitude" , std::string, prevAttitudeString , "" , optarg , kNoDefaultArgument) +LOST_CLI_OPTION("uncertainty " , float , uncertainty , -1 , atof(optarg) , 5) LOST_CLI_OPTION("angular-tolerance" , float , angularTolerance , .04 , atof(optarg) , kNoDefaultArgument) LOST_CLI_OPTION("false-stars-estimate" , int , estimatedNumFalseStars , 500 , atoi(optarg) , kNoDefaultArgument) LOST_CLI_OPTION("max-mismatch-probability" , float , maxMismatchProb , .001, atof(optarg) , kNoDefaultArgument) diff --git a/src/star-id.cpp b/src/star-id.cpp index e4b0246e..53a628ac 100644 --- a/src/star-id.cpp +++ b/src/star-id.cpp @@ -10,7 +10,7 @@ namespace lost { StarIdentifiers DummyStarIdAlgorithm::Go( - const unsigned char *database, const Stars &stars, const Catalog &catalog, const Camera &camera) const { + const unsigned char *database, const Stars &stars, const Catalog &catalog, const Camera &camera, const PrevAttitude &prevAttitude) const { StarIdentifiers result; @@ -22,7 +22,7 @@ StarIdentifiers DummyStarIdAlgorithm::Go( } StarIdentifiers GeometricVotingStarIdAlgorithm::Go( - const unsigned char *database, const Stars &stars, const Catalog &catalog, const Camera &camera) const { + const unsigned char *database, const Stars &stars, const Catalog &catalog, const Camera &camera, const PrevAttitude &prevAttitude) const { StarIdentifiers identified; MultiDatabase multiDatabase(database); @@ -285,7 +285,7 @@ void PyramidIdentifyRemainingStars(StarIdentifiers *identifiers, } StarIdentifiers PyramidStarIdAlgorithm::Go( - const unsigned char *database, const Stars &stars, const Catalog &catalog, const Camera &camera) const { + const unsigned char *database, const Stars &stars, const Catalog &catalog, const Camera &camera, const PrevAttitude &prevAttitude) const { StarIdentifiers identified; MultiDatabase multiDatabase(database); @@ -504,7 +504,7 @@ StarIdentifiers PyramidStarIdAlgorithm::Go( } StarIdentifiers TrackingModeStarIdAlgorithm::Go( - const unsigned char *database, const Stars &stars, const Catalog &catalog, const Camera &camera) const { + const unsigned char *database, const Stars &stars, const Catalog &catalog, const Camera &camera, const PrevAttitude &prevAttitude) const { StarIdentifiers identified; MultiDatabase multiDatabase(database); diff --git a/src/star-id.hpp b/src/star-id.hpp index d91dcae6..f62cc400 100644 --- a/src/star-id.hpp +++ b/src/star-id.hpp @@ -12,18 +12,18 @@ namespace lost { class StarIdAlgorithm { public: virtual StarIdentifiers Go( - const unsigned char *database, const Stars &, const Catalog &, const Camera &) const = 0; + const unsigned char *database, const Stars &, const Catalog &, const Camera &, const PrevAttitude &) const = 0; virtual ~StarIdAlgorithm() { }; }; class DummyStarIdAlgorithm final : public StarIdAlgorithm { public: - StarIdentifiers Go(const unsigned char *database, const Stars &, const Catalog &, const Camera &) const; + StarIdentifiers Go(const unsigned char *database, const Stars &, const Catalog &, const Camera &, const PrevAttitude &) const; }; class GeometricVotingStarIdAlgorithm : public StarIdAlgorithm { public: - StarIdentifiers Go(const unsigned char *database, const Stars &, const Catalog &, const Camera &) const; + StarIdentifiers Go(const unsigned char *database, const Stars &, const Catalog &, const Camera &, const PrevAttitude &) const; GeometricVotingStarIdAlgorithm(float tolerance): tolerance(tolerance) { }; private: float tolerance; @@ -31,7 +31,7 @@ class GeometricVotingStarIdAlgorithm : public StarIdAlgorithm { class PyramidStarIdAlgorithm final : public StarIdAlgorithm { public: - StarIdentifiers Go(const unsigned char *database, const Stars &, const Catalog &, const Camera &) const; + StarIdentifiers Go(const unsigned char *database, const Stars &, const Catalog &, const Camera &, const PrevAttitude &) const; /** * @param tolerance Angular tolerance in distances (measurement error) * @param numFalseStars an estimate of the number of false stars in the whole celestial sphere @@ -53,7 +53,7 @@ class PyramidStarIdAlgorithm final : public StarIdAlgorithm { class TrackingModeStarIdAlgorithm final : public StarIdAlgorithm { public: - StarIdentifiers Go(const unsigned char *database, const Stars &, const Catalog &, const Camera &) const; + StarIdentifiers Go(const unsigned char *database, const Stars &, const Catalog &, const Camera &, const PrevAttitude &) const; }; diff --git a/src/star-utils.hpp b/src/star-utils.hpp index 587dfe71..98203452 100644 --- a/src/star-utils.hpp +++ b/src/star-utils.hpp @@ -65,6 +65,8 @@ class PrevAttitude { public: PrevAttitude(Attitude prev, float uncertainty) : prev(prev), uncertainty(uncertainty) { }; + PrevAttitude() + : PrevAttitude(Attitude(), -1.0f) { }; Attitude prev; float uncertainty;