Skip to content
Snippets Groups Projects
Commit d7a9b7e0 authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

[skip ci] wip

parent 608e2380
No related branches found
No related tags found
1 merge request!448Draft: Resolve "Implementation of new nodes creation"
Pipeline #12127 skipped
Showing
with 201 additions and 74 deletions
...@@ -171,6 +171,7 @@ SET(HDRS_MAP ...@@ -171,6 +171,7 @@ SET(HDRS_MAP
) )
SET(HDRS_PROBLEM SET(HDRS_PROBLEM
include/${PROJECT_NAME}/problem/problem.h include/${PROJECT_NAME}/problem/problem.h
# include/${PROJECT_NAME}/problem/prior_problem.h
) )
SET(HDRS_PROCESSOR SET(HDRS_PROCESSOR
include/${PROJECT_NAME}/processor/factory_processor.h include/${PROJECT_NAME}/processor/factory_processor.h
...@@ -191,6 +192,7 @@ SET(HDRS_PROCESSOR ...@@ -191,6 +192,7 @@ SET(HDRS_PROCESSOR
) )
SET(HDRS_SENSOR SET(HDRS_SENSOR
include/${PROJECT_NAME}/sensor/factory_sensor.h include/${PROJECT_NAME}/sensor/factory_sensor.h
include/${PROJECT_NAME}/sensor/prior_sensor.h
include/${PROJECT_NAME}/sensor/sensor_base.h include/${PROJECT_NAME}/sensor/sensor_base.h
include/${PROJECT_NAME}/sensor/sensor_diff_drive.h include/${PROJECT_NAME}/sensor/sensor_diff_drive.h
include/${PROJECT_NAME}/sensor/sensor_motion_model.h include/${PROJECT_NAME}/sensor/sensor_motion_model.h
...@@ -280,6 +282,7 @@ SET(SRCS_MAP ...@@ -280,6 +282,7 @@ SET(SRCS_MAP
src/map/map_base.cpp src/map/map_base.cpp
) )
SET(SRCS_PROBLEM SET(SRCS_PROBLEM
# src/problem/prior_problem.cpp
src/problem/problem.cpp src/problem/problem.cpp
) )
SET(SRCS_PROCESSOR SET(SRCS_PROCESSOR
...@@ -299,6 +302,7 @@ SET(SRCS_PROCESSOR ...@@ -299,6 +302,7 @@ SET(SRCS_PROCESSOR
src/processor/track_matrix.cpp src/processor/track_matrix.cpp
) )
SET(SRCS_SENSOR SET(SRCS_SENSOR
src/sensor/prior_sensor.cpp
src/sensor/sensor_base.cpp src/sensor/sensor_base.cpp
src/sensor/sensor_diff_drive.cpp src/sensor/sensor_diff_drive.cpp
src/sensor/sensor_motion_model.cpp src/sensor/sensor_motion_model.cpp
......
...@@ -130,8 +130,8 @@ int main() ...@@ -130,8 +130,8 @@ int main()
// sensor odometer 2d // sensor odometer 2d
ParamsSensorOdomPtr intrinsics_odo = std::make_shared<ParamsSensorOdom>(); ParamsSensorOdomPtr intrinsics_odo = std::make_shared<ParamsSensorOdom>();
Priors priors_odo = {{'P',Prior("P", Vector2d::Zero())}, PriorSensorMap priors_odo = {{'P',PriorSensor("P", Vector2d::Zero())},
{'O',Prior("O", Vector1d::Zero())}}; {'O',PriorSensor("O", Vector1d::Zero())}};
SensorBasePtr sensor_odo = problem->installSensor("SensorOdom", "sensor odo", intrinsics_odo, priors_odo); SensorBasePtr sensor_odo = problem->installSensor("SensorOdom", "sensor odo", intrinsics_odo, priors_odo);
// processor odometer 2d // processor odometer 2d
...@@ -147,8 +147,8 @@ int main() ...@@ -147,8 +147,8 @@ int main()
// sensor Range and Bearing // sensor Range and Bearing
ParamsSensorRangeBearingPtr intrinsics_rb = std::make_shared<ParamsSensorRangeBearing>(); ParamsSensorRangeBearingPtr intrinsics_rb = std::make_shared<ParamsSensorRangeBearing>();
Priors priors_rb = {{'P',Prior("P", Vector2d(1,1))}, PriorSensorMap priors_rb = {{'P',PriorSensor("P", Vector2d(1,1))},
{'O',Prior("O", Vector1d::Zero())}}; {'O',PriorSensor("O", Vector1d::Zero())}};
intrinsics_rb->noise_range_metres_std = 0.1; intrinsics_rb->noise_range_metres_std = 0.1;
intrinsics_rb->noise_bearing_degrees_std = 1.0; intrinsics_rb->noise_bearing_degrees_std = 1.0;
SensorBasePtr sensor_rb = problem->installSensor("SensorRangeBearing", "sensor RB", intrinsics_rb, priors_rb); SensorBasePtr sensor_rb = problem->installSensor("SensorRangeBearing", "sensor RB", intrinsics_rb, priors_rb);
......
...@@ -27,7 +27,7 @@ WOLF_PTR_TYPEDEFS(SensorRangeBearing); ...@@ -27,7 +27,7 @@ WOLF_PTR_TYPEDEFS(SensorRangeBearing);
SensorRangeBearing::SensorRangeBearing(const SizeEigen& _dim, SensorRangeBearing::SensorRangeBearing(const SizeEigen& _dim,
ParamsSensorRangeBearingPtr _params, ParamsSensorRangeBearingPtr _params,
const Priors& _priors) : const PriorSensorMap& _priors) :
SensorBase("SensorRangeBearing", _dim, _params, _priors), SensorBase("SensorRangeBearing", _dim, _params, _priors),
params_rb_(_params) params_rb_(_params)
{ {
......
...@@ -58,7 +58,7 @@ class SensorRangeBearing : public SensorBase ...@@ -58,7 +58,7 @@ class SensorRangeBearing : public SensorBase
public: public:
SensorRangeBearing(const SizeEigen& _dim, SensorRangeBearing(const SizeEigen& _dim,
ParamsSensorRangeBearingPtr _params, ParamsSensorRangeBearingPtr _params,
const Priors& _priors); const PriorSensorMap& _priors);
WOLF_SENSOR_CREATE(SensorRangeBearing, ParamsSensorRangeBearing); WOLF_SENSOR_CREATE(SensorRangeBearing, ParamsSensorRangeBearing);
~SensorRangeBearing() override; ~SensorRangeBearing() override;
......
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Solà Ortega (jsola@iri.upc.edu)
// All rights reserved.
//
// This file is part of WOLF
// WOLF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#pragma once
#include "core/state_block/prior.h"
namespace wolf
{
class PriorProblem : public Prior
{
protected:
double time_tolerance_; // time tolerance of the first frame
public:
PriorProblem() = default;
PriorProblem(const std::string& _type,
const Eigen::VectorXd& _state,
const double& _time_tolerance,
const std::string& _mode = "fix",
const Eigen::VectorXd& _noise_std = Eigen::VectorXd(0));
PriorProblem(const YAML::Node& _n);
virtual ~PriorProblem() = default;
double getTimeTolerance() const;
using Prior::check;
std::string print() const override;
};
typedef std::unordered_map<char, PriorProblem> StdMapPriorProblem;
class PriorProblemMap : public StdMapPriorProblem
{
public:
using StdMapPriorProblem::StdMapPriorProblem;
PriorProblemMap(const YAML::Node& _n);
virtual ~PriorProblemMap() = default;
};
inline double PriorProblem::getTimeTolerance() const { return time_tolerance_; }
} // namespace wolf
\ No newline at end of file
...@@ -57,14 +57,6 @@ enum Notification ...@@ -57,14 +57,6 @@ enum Notification
REMOVE REMOVE
}; };
struct PriorOptions
{
std::string mode = "";
VectorComposite state;
MatrixComposite cov;
};
WOLF_STRUCT_PTR_TYPEDEFS(PriorOptions);
/** \brief Wolf problem node element in the Wolf Tree /** \brief Wolf problem node element in the Wolf Tree
*/ */
class Problem : public std::enable_shared_from_this<Problem> class Problem : public std::enable_shared_from_this<Problem>
...@@ -87,7 +79,8 @@ class Problem : public std::enable_shared_from_this<Problem> ...@@ -87,7 +79,8 @@ class Problem : public std::enable_shared_from_this<Problem>
mutable std::mutex mut_notifications_; mutable std::mutex mut_notifications_;
mutable std::mutex mut_covariances_; mutable std::mutex mut_covariances_;
StateStructure frame_structure_; StateStructure frame_structure_;
PriorOptionsPtr prior_options_; PriorMap prior_options_;
bool prior_applied_;
std::atomic_bool transformed_; std::atomic_bool transformed_;
VectorComposite transformation_; VectorComposite transformation_;
...@@ -196,10 +189,8 @@ class Problem : public std::enable_shared_from_this<Problem> ...@@ -196,10 +189,8 @@ class Problem : public std::enable_shared_from_this<Problem>
TrajectoryBasePtr getTrajectory(); TrajectoryBasePtr getTrajectory();
// Prior // Prior
bool isPriorSet() const; bool isPriorApplied() const;
void setPriorOptions(const std::string& _mode, void setPriorOptions(const PriorMap& priors);
const VectorComposite& _state = VectorComposite(),
const VectorComposite& _cov = VectorComposite());
FrameBasePtr applyPriorOptions(const TimeStamp& _ts); FrameBasePtr applyPriorOptions(const TimeStamp& _ts);
FrameBasePtr setPriorFactor(const VectorComposite &_state, FrameBasePtr setPriorFactor(const VectorComposite &_state,
const VectorComposite &_sigma, const VectorComposite &_sigma,
...@@ -443,9 +434,9 @@ inline TreeManagerBasePtr Problem::getTreeManager() ...@@ -443,9 +434,9 @@ inline TreeManagerBasePtr Problem::getTreeManager()
return tree_manager_; return tree_manager_;
} }
inline bool Problem::isPriorSet() const inline bool Problem::isPriorApplied() const
{ {
return prior_options_ == nullptr; return prior_applied_;
} }
inline std::map<int,MotionProviderConstPtr> Problem::getMotionProviderMap() const inline std::map<int,MotionProviderConstPtr> Problem::getMotionProviderMap() const
......
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Solà Ortega (jsola@iri.upc.edu)
// All rights reserved.
//
// This file is part of WOLF
// WOLF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#pragma once
#include "core/state_block/prior.h"
namespace wolf
{
class PriorSensor : public Prior
{
protected:
bool dynamic_; // State dynamic
Eigen::VectorXd drift_std_; // OPTIONAL std of the state drift [in units/sqrt(s)] diagonal elements (ONLY IF if dynamic)
public:
PriorSensor() = default;
PriorSensor(const std::string& _type,
const Eigen::VectorXd& _state,
const std::string& _mode = "fix",
const Eigen::VectorXd& _noise_std = Eigen::VectorXd(0),
bool _dynamic = false,
const Eigen::VectorXd& _drift_std = Eigen::VectorXd(0));
PriorSensor(const YAML::Node& _n);
virtual ~PriorSensor() = default;
bool isDynamic() const;
const Eigen::VectorXd& getDriftStd() const;
void check() const override;
std::string print() const override;
};
typedef std::unordered_map<char, PriorSensor> StdMapPriorSensor;
class PriorSensorMap : public StdMapPriorSensor
{
public:
using StdMapPriorSensor::StdMapPriorSensor;
PriorSensorMap(const YAML::Node& _n);
virtual ~PriorSensorMap() = default;
};
inline bool PriorSensor::isDynamic() const { return dynamic_; }
inline const Eigen::VectorXd& PriorSensor::getDriftStd() const { return drift_std_; }
} // namespace wolf
\ No newline at end of file
...@@ -31,7 +31,7 @@ class ParamsServer; ...@@ -31,7 +31,7 @@ class ParamsServer;
//Wolf includes //Wolf includes
#include "core/common/wolf.h" #include "core/common/wolf.h"
#include "core/state_block/prior.h" #include "core/sensor/prior_sensor.h"
#include "core/common/node_base.h" #include "core/common/node_base.h"
#include "core/common/time_stamp.h" #include "core/common/time_stamp.h"
#include "core/common/params_base.h" #include "core/common/params_base.h"
...@@ -54,7 +54,7 @@ namespace wolf { ...@@ -54,7 +54,7 @@ namespace wolf {
* SensorClass(const std::string& _unique_name, * SensorClass(const std::string& _unique_name,
* SizeEigen _dim, * SizeEigen _dim,
* ParamsSensorClassPtr _params, * ParamsSensorClassPtr _params,
* const Priors& _priors) * const PriorSensorMap& _priors)
* *
* Also, there should be the schema file 'SensorClass.schema' containing the specifications * Also, there should be the schema file 'SensorClass.schema' containing the specifications
* of the user input yaml file. * of the user input yaml file.
...@@ -64,7 +64,7 @@ static SensorBasePtr create(const YAML::Node& _input_node) ...@@ -64,7 +64,7 @@ static SensorBasePtr create(const YAML::Node& _input_node)
{ \ { \
auto params = std::make_shared<ParamsSensorClass>(_input_node); \ auto params = std::make_shared<ParamsSensorClass>(_input_node); \
\ \
auto priors = Priors(_input_node["states"]); \ auto priors = PriorSensorMap(_input_node["states"]); \
\ \
return std::make_shared<SensorClass>(params, priors); \ return std::make_shared<SensorClass>(params, priors); \
} \ } \
...@@ -80,7 +80,7 @@ static SensorBasePtr create(const std::string& _schema, ...@@ -80,7 +80,7 @@ static SensorBasePtr create(const std::string& _schema,
} \ } \
auto params = std::make_shared<ParamsSensorClass>(server.getNode()); \ auto params = std::make_shared<ParamsSensorClass>(server.getNode()); \
\ \
auto priors = Priors(server.getNode()["states"]); \ auto priors = PriorSensorMap(server.getNode()["states"]); \
\ \
return std::make_shared<SensorClass>(params, priors); \ return std::make_shared<SensorClass>(params, priors); \
} \ } \
...@@ -125,7 +125,7 @@ class SensorBase : public NodeBase, public HasStateBlocks, public std::enable_sh ...@@ -125,7 +125,7 @@ class SensorBase : public NodeBase, public HasStateBlocks, public std::enable_sh
std::map<char, bool> state_block_dynamic_; // mark dynamic state blocks std::map<char, bool> state_block_dynamic_; // mark dynamic state blocks
std::map<char, FeatureBasePtr> params_prior_map_; // Priors (value and covariance) of extrinsic & intrinsic state blocks (by key in state_block_map_) std::map<char, FeatureBasePtr> features_prior_map_; // Priors (value and covariance) of extrinsic & intrinsic state blocks (by key in state_block_map_)
CaptureBasePtr last_capture_; // last capture of the sensor (in the WOLF tree) CaptureBasePtr last_capture_; // last capture of the sensor (in the WOLF tree)
...@@ -135,7 +135,7 @@ class SensorBase : public NodeBase, public HasStateBlocks, public std::enable_sh ...@@ -135,7 +135,7 @@ class SensorBase : public NodeBase, public HasStateBlocks, public std::enable_sh
int dim_; ///< Dimension compatibility of the sensor: 2: 2D, 3: 3D, -1: both int dim_; ///< Dimension compatibility of the sensor: 2: 2D, 3: 3D, -1: both
void setProblem(ProblemPtr _problem) override final; void setProblem(ProblemPtr _problem) override final;
virtual void loadPriors(const Priors& _priors); virtual void loadPriors(const PriorSensorMap& _priors);
public: public:
...@@ -151,7 +151,7 @@ class SensorBase : public NodeBase, public HasStateBlocks, public std::enable_sh ...@@ -151,7 +151,7 @@ class SensorBase : public NodeBase, public HasStateBlocks, public std::enable_sh
SensorBase(const std::string& _type, SensorBase(const std::string& _type,
const int& _dim, const int& _dim,
ParamsSensorBasePtr _params, ParamsSensorBasePtr _params,
const Priors& _priors); const PriorSensorMap& _priors);
~SensorBase() override; ~SensorBase() override;
...@@ -333,7 +333,7 @@ inline CaptureBasePtr SensorBase::getLastCapture() ...@@ -333,7 +333,7 @@ inline CaptureBasePtr SensorBase::getLastCapture()
inline StateBlockPtr SensorBase::addStateBlock(const char& _key, const StateBlockPtr& _sb_ptr, const bool _dynamic) inline StateBlockPtr SensorBase::addStateBlock(const char& _key, const StateBlockPtr& _sb_ptr, const bool _dynamic)
{ {
assert((params_prior_map_.find(_key) == params_prior_map_.end() || _sb_ptr == nullptr) && "overwriting a state block that has an absolute factor"); assert((features_prior_map_.find(_key) == features_prior_map_.end() || _sb_ptr == nullptr) && "overwriting a state block that has an absolute factor");
HasStateBlocks::addStateBlock(_key, _sb_ptr, getProblem()); HasStateBlocks::addStateBlock(_key, _sb_ptr, getProblem());
setStateBlockDynamic(_key, _dynamic); setStateBlockDynamic(_key, _dynamic);
return _sb_ptr; return _sb_ptr;
...@@ -400,29 +400,29 @@ inline void SensorBase::addPriorIntrinsics(const Eigen::VectorXd& _x, const Eige ...@@ -400,29 +400,29 @@ inline void SensorBase::addPriorIntrinsics(const Eigen::VectorXd& _x, const Eige
inline std::map<char, FeatureBaseConstPtr> SensorBase::getPriorFeatures() const inline std::map<char, FeatureBaseConstPtr> SensorBase::getPriorFeatures() const
{ {
std::map<char, FeatureBaseConstPtr> map_const; std::map<char, FeatureBaseConstPtr> map_const;
for (auto&& pair : params_prior_map_) for (auto&& pair : features_prior_map_)
map_const[pair.first] = pair.second; map_const[pair.first] = pair.second;
return map_const; return map_const;
} }
inline std::map<char, FeatureBasePtr> SensorBase::getPriorFeatures() inline std::map<char, FeatureBasePtr> SensorBase::getPriorFeatures()
{ {
return params_prior_map_; return features_prior_map_;
} }
inline FeatureBaseConstPtr SensorBase::getPriorFeature(char key) const inline FeatureBaseConstPtr SensorBase::getPriorFeature(char key) const
{ {
if (params_prior_map_.count(key) == 0) if (features_prior_map_.count(key) == 0)
return nullptr; return nullptr;
return params_prior_map_.at(key); return features_prior_map_.at(key);
} }
inline FeatureBasePtr SensorBase::getPriorFeature(char key) inline FeatureBasePtr SensorBase::getPriorFeature(char key)
{ {
if (params_prior_map_.count(key) == 0) if (features_prior_map_.count(key) == 0)
return nullptr; return nullptr;
return params_prior_map_.at(key); return features_prior_map_.at(key);
} }
} // namespace wolf } // namespace wolf
\ No newline at end of file
...@@ -55,7 +55,7 @@ class SensorDiffDrive : public SensorBase ...@@ -55,7 +55,7 @@ class SensorDiffDrive : public SensorBase
{ {
public: public:
SensorDiffDrive(ParamsSensorDiffDrivePtr _params, SensorDiffDrive(ParamsSensorDiffDrivePtr _params,
const Priors& _priors); const PriorSensorMap& _priors);
WOLF_SENSOR_CREATE(SensorDiffDrive, ParamsSensorDiffDrive); WOLF_SENSOR_CREATE(SensorDiffDrive, ParamsSensorDiffDrive);
~SensorDiffDrive() override = default; ~SensorDiffDrive() override = default;
......
...@@ -32,7 +32,7 @@ class SensorMotionModel : public SensorBase ...@@ -32,7 +32,7 @@ class SensorMotionModel : public SensorBase
{ {
public: public:
SensorMotionModel(ParamsSensorBasePtr _params, SensorMotionModel(ParamsSensorBasePtr _params,
const Priors& _priors); const PriorSensorMap& _priors);
WOLF_SENSOR_CREATE(SensorMotionModel, ParamsSensorBase); WOLF_SENSOR_CREATE(SensorMotionModel, ParamsSensorBase);
......
...@@ -68,7 +68,7 @@ class SensorOdom : public SensorBase ...@@ -68,7 +68,7 @@ class SensorOdom : public SensorBase
public: public:
SensorOdom(ParamsSensorOdomPtr _params, SensorOdom(ParamsSensorOdomPtr _params,
const Priors& _priors) : const PriorSensorMap& _priors) :
SensorBase("SensorOdom"+toString(DIM)+"d", SensorBase("SensorOdom"+toString(DIM)+"d",
DIM, DIM,
_params, _params,
......
...@@ -57,7 +57,7 @@ class SensorPose : public SensorBase ...@@ -57,7 +57,7 @@ class SensorPose : public SensorBase
public: public:
SensorPose(ParamsSensorPosePtr _params, SensorPose(ParamsSensorPosePtr _params,
const Priors& _priors) : const PriorSensorMap& _priors) :
SensorBase("SensorPose"+toString(DIM)+"d", SensorBase("SensorPose"+toString(DIM)+"d",
DIM, DIM,
_params, _params,
......
...@@ -31,24 +31,20 @@ namespace wolf ...@@ -31,24 +31,20 @@ namespace wolf
class Prior class Prior
{ {
private: protected:
std::string type_; // State type std::string type_; // State type
Eigen::VectorXd state_; // state values Eigen::VectorXd state_; // state values
std::string mode_; // Prior mode. Can be 'initial_guess', 'fix' or 'factor' std::string mode_; // Prior mode. Can be 'initial_guess', 'fix' or 'factor'
Eigen::VectorXd noise_std_; // factor noise std, sqrt of the diagonal of the covariance mtrix (ONLY IF mode == 'factor') Eigen::VectorXd noise_std_; // factor noise std, sqrt of the diagonal of the covariance mtrix (ONLY IF mode == 'factor')
bool dynamic_; // State dynamic
Eigen::VectorXd drift_std_; // OPTIONAL std of the state drift [in units/sqrt(s)] diagonal elements (ONLY IF if dynamic)
public: public:
Prior() = default; Prior() = delete;
Prior(const std::string& _type, Prior(const std::string& _type,
const Eigen::VectorXd& _state, const Eigen::VectorXd& _state,
const std::string& _mode = "fix", const std::string& _mode = "fix",
const Eigen::VectorXd& _noise_std = Eigen::VectorXd(0), const Eigen::VectorXd& _noise_std = Eigen::VectorXd(0));
bool _dynamic = false,
const Eigen::VectorXd& _drift_std = Eigen::VectorXd(0));
Prior(const YAML::Node& prior_node); Prior(const YAML::Node& _n);
virtual ~Prior() = default; virtual ~Prior() = default;
...@@ -56,26 +52,26 @@ class Prior ...@@ -56,26 +52,26 @@ class Prior
const std::string& getMode() const; const std::string& getMode() const;
const Eigen::VectorXd& getState() const; const Eigen::VectorXd& getState() const;
const Eigen::VectorXd& getNoiseStd() const; const Eigen::VectorXd& getNoiseStd() const;
bool isDynamic() const;
bool isFixed() const; bool isFixed() const;
bool isInitialGuess() const; bool isInitialGuess() const;
bool isFactor() const; bool isFactor() const;
const Eigen::VectorXd& getDriftStd() const;
void check() const; virtual void check() const;
virtual std::string print() const final; virtual std::string print() const;
}; };
typedef std::unordered_map<char, Prior> PriorMap; typedef std::unordered_map<char, Prior> StdMapPrior;
class Priors : public PriorMap class PriorMap : public StdMapPrior
{ {
public: public:
using PriorMap::PriorMap; using StdMapPrior::StdMapPrior;
Priors(const YAML::Node& priors_node); PriorMap(const YAML::Node& _n);
virtual ~Priors() = default; virtual ~PriorMap() = default;
VectorComposite getState() const;
}; };
inline const std::string& Prior::getType() const { return type_; } inline const std::string& Prior::getType() const { return type_; }
...@@ -86,14 +82,10 @@ inline const Eigen::VectorXd& Prior::getState() const { return state_; } ...@@ -86,14 +82,10 @@ inline const Eigen::VectorXd& Prior::getState() const { return state_; }
inline const Eigen::VectorXd& Prior::getNoiseStd() const { return noise_std_; } inline const Eigen::VectorXd& Prior::getNoiseStd() const { return noise_std_; }
inline bool Prior::isDynamic() const { return dynamic_; }
inline bool Prior::isFixed() const { return mode_ == "fix"; } inline bool Prior::isFixed() const { return mode_ == "fix"; }
inline bool Prior::isInitialGuess() const { return mode_ == "initial_guess"; } inline bool Prior::isInitialGuess() const { return mode_ == "initial_guess"; }
inline bool Prior::isFactor() const { return mode_ == "factor"; } inline bool Prior::isFactor() const { return mode_ == "factor"; }
inline const Eigen::VectorXd& Prior::getDriftStd() const { return drift_std_; }
} // namespace wolf } // namespace wolf
\ No newline at end of file
...@@ -14,20 +14,9 @@ mode: ...@@ -14,20 +14,9 @@ mode:
mandatory: true mandatory: true
options: ["fix", "factor", "initial_guess"] options: ["fix", "factor", "initial_guess"]
doc: The prior mode can be 'factor' to add an absolute factor (requires 'noise_std'), 'fix' to set the values constant or 'initial_guess' to just set the values doc: The prior mode can be 'factor' to add an absolute factor (requires 'noise_std'), 'fix' to set the values constant or 'initial_guess' to just set the values
dynamic:
type: bool
yaml_type: scalar
mandatory: true
doc: If the state is dynamic, i.e. it changes along time.
noise_std: noise_std:
type: VectorXd type: VectorXd
yaml_type: scalar yaml_type: scalar
mandatory: false mandatory: false
default: [] default: []
doc: A vector containing the stdev values of the noise of the factor, i.e. the sqrt of the diagonal elements of the covariance matrix. doc: A vector containing the stdev values of the noise of the factor, i.e. the sqrt of the diagonal elements of the covariance matrix.
drift_std: \ No newline at end of file
type: VectorXd
yaml_type: scalar
mandatory: false
default: []
doc: A vector containing the stdev values of the noise of the drift factor (only if dynamic==true), i.e. the sqrt of the diagonal elements of the covariance matrix.
\ No newline at end of file
File moved
File moved
File moved
File moved
follow: Problem.schema
problem:
prior:
P:
follow: PriorP2d.schema
O:
follow: PriorO2d.schema
\ No newline at end of file
follow: Problem.schema
problem:
prior:
P:
follow: PriorP3d.schema
O:
follow: PriorO3d.schema
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment