diff --git a/include/tudat/astro/orbit_determination/podInputOutputTypes.h b/include/tudat/astro/orbit_determination/podInputOutputTypes.h index bafe6fd1e..544837687 100644 --- a/include/tudat/astro/orbit_determination/podInputOutputTypes.h +++ b/include/tudat/astro/orbit_determination/podInputOutputTypes.h @@ -120,8 +120,12 @@ class CovarianceAnalysisInput { std::cerr << "Warning, function setConstantSingleObservableAndLinkEndsWeights is deprecated, " "weights should preferably be defined at the observation collection level."; - observationCollection_->setConstantWeightPerObservable( observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( - { observationParser( currentObservable ), observationParser( currentLinkEnds ) } ) ), weight ); + std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, double > weightsPerParser; + std::shared_ptr< observation_models::ObservationCollectionParser > multiTypeParser = observationParser( + std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( + { observationParser( currentObservable ), observationParser( currentLinkEnds ) } ) ); + weightsPerParser[ multiTypeParser ] = weight; + observationCollection_->setConstantWeightPerObservable( weightsPerParser ); } //! Set constant vector weight for all observables of given type and link ends @@ -132,8 +136,12 @@ class CovarianceAnalysisInput { std::cerr << "Warning, function setConstantSingleObservableAndLinkEndsVectorWeights is deprecated, " "weights should preferably be defined at the observation collection level."; - observationCollection_->setConstantWeightPerObservable( observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( - { observationParser( currentObservable ), observationParser( currentLinkEnds ) } ) ), weight ); + std::map< std::shared_ptr< observation_models::ObservationCollectionParser >, Eigen::VectorXd > weightsPerParser; + std::shared_ptr< observation_models::ObservationCollectionParser > multiTypeParser = observationParser( + std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( + { observationParser( currentObservable ), observationParser( currentLinkEnds ) } ) ); + weightsPerParser[ multiTypeParser ] = weight; + observationCollection_->setConstantWeightPerObservable( weightsPerParser ); } //! Set constant vector weight for all observables of given type and link ends @@ -144,8 +152,8 @@ class CovarianceAnalysisInput { std::cerr << "Warning, function setTabulatedSingleObservableAndLinkEndsWeights is deprecated, " "weights should preferably be defined at the observation collection level."; - observationCollection_->setTabulatedWeights( observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( - { observationParser( currentObservable ), observationParser( currentLinkEnds ) } ) ), weight ); + observationCollection_->setTabulatedWeights( weight, observationParser( std::vector< std::shared_ptr< observation_models::ObservationCollectionParser > >( + { observationParser( currentObservable ), observationParser( currentLinkEnds ) } ) ) ); } diff --git a/include/tudat/simulation/estimation_setup/observations.h b/include/tudat/simulation/estimation_setup/observations.h index 38c3fe809..c9eb2a636 100644 --- a/include/tudat/simulation/estimation_setup/observations.h +++ b/include/tudat/simulation/estimation_setup/observations.h @@ -119,6 +119,11 @@ class SingleObservationSet return linkEnds_; } + void setLinkEnds( LinkDefinition& linkEnds ) + { + linkEnds_ = linkEnds; + } + std::vector< Eigen::Matrix< ObservationScalarType, Eigen::Dynamic, 1 > > getObservations( ) { return observations_; @@ -830,7 +835,7 @@ class SingleObservationSet const ObservableType observableType_; - const LinkDefinition linkEnds_; + LinkDefinition linkEnds_; std::pair< TimeType, TimeType > timeBounds_; @@ -2139,10 +2144,10 @@ class ObservationCollection } break; } - case link_end_id_parser: + case link_end_string_parser: { - std::shared_ptr< ObservationCollectionLinkEndIdParser > linkEndIdObservationParser = - std::dynamic_pointer_cast< ObservationCollectionLinkEndIdParser >( observationParser ); + std::shared_ptr< ObservationCollectionLinkEndStringParser > linkEndIdObservationParser = + std::dynamic_pointer_cast< ObservationCollectionLinkEndStringParser >( observationParser ); std::vector< std::string > linkEndsNames = linkEndIdObservationParser->getLinkEndNames( ); bool isReferencePoint = linkEndIdObservationParser->isReferencePoint( ); diff --git a/include/tudat/simulation/estimation_setup/observationsProcessing.h b/include/tudat/simulation/estimation_setup/observationsProcessing.h index 94707ade4..d6c3702af 100644 --- a/include/tudat/simulation/estimation_setup/observationsProcessing.h +++ b/include/tudat/simulation/estimation_setup/observationsProcessing.h @@ -254,7 +254,7 @@ enum ObservationParserType empty_parser, observable_type_parser, link_ends_parser, - link_end_id_parser, + link_end_string_parser, time_bounds_parser, ancillary_settings_parser, multi_type_parser @@ -336,22 +336,22 @@ struct ObservationCollectionLinkEndsParser : public ObservationCollectionParser }; -struct ObservationCollectionLinkEndIdParser : public ObservationCollectionParser +struct ObservationCollectionLinkEndStringParser : public ObservationCollectionParser { public: - ObservationCollectionLinkEndIdParser( const std::string linkEndsNames, + ObservationCollectionLinkEndStringParser( const std::string linkEndsNames, const bool isReferencePoint = false, const bool useOppositeCondition = false ) : - ObservationCollectionParser( link_end_id_parser, useOppositeCondition ), linkEndsNames_( std::vector< std::string >( { linkEndsNames } ) ), + ObservationCollectionParser( link_end_string_parser, useOppositeCondition ), linkEndsNames_( std::vector< std::string >( { linkEndsNames } ) ), isReferencePoint_( isReferencePoint ){ } - ObservationCollectionLinkEndIdParser( const std::vector< std::string > linkEndsNames, + ObservationCollectionLinkEndStringParser( const std::vector< std::string > linkEndsNames, const bool isReferencePoint = false, const bool useOppositeCondition = false ) : - ObservationCollectionParser( link_end_id_parser, useOppositeCondition ), linkEndsNames_( linkEndsNames ), isReferencePoint_( isReferencePoint ){ } + ObservationCollectionParser( link_end_string_parser, useOppositeCondition ), linkEndsNames_( linkEndsNames ), isReferencePoint_( isReferencePoint ){ } - virtual ~ObservationCollectionLinkEndIdParser( ){ } + virtual ~ObservationCollectionLinkEndStringParser( ){ } std::vector< std::string > getLinkEndNames( ) const { @@ -473,13 +473,13 @@ inline std::shared_ptr< ObservationCollectionParser > observationParser( const s inline std::shared_ptr< ObservationCollectionParser > observationParser( const std::string bodyName, const bool isReferencePoint = false, const bool useOppositeCondition = false ) { - return std::make_shared< ObservationCollectionLinkEndIdParser >( bodyName, isReferencePoint, useOppositeCondition ); + return std::make_shared< ObservationCollectionLinkEndStringParser >( bodyName, isReferencePoint, useOppositeCondition ); } inline std::shared_ptr< ObservationCollectionParser > observationParser( const std::vector< std::string >& bodyNames, const bool isReferencePoint = false, const bool useOppositeCondition = false ) { - return std::make_shared< ObservationCollectionLinkEndIdParser >( bodyNames, isReferencePoint, useOppositeCondition ); + return std::make_shared< ObservationCollectionLinkEndStringParser >( bodyNames, isReferencePoint, useOppositeCondition ); } inline std::shared_ptr< ObservationCollectionParser > observationParser( const std::pair< double, double >& timeBounds, const bool useOppositeCondition = false )