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

factor redirect output of derived factor evaluation

parent 8fbc4072
No related branches found
No related tags found
1 merge request!448Draft: Resolve "Implementation of new nodes creation"
Pipeline #20816 failed
This commit is part of merge request !448. Comments created here will be created in the context of that merge request.
......@@ -58,7 +58,11 @@ inline CostFunctionWrapper::~CostFunctionWrapper() {}
inline bool CostFunctionWrapper::Evaluate(const double* const* parameters, double* residuals, double** jacobians) const
{
return factor_ptr_->evaluate(parameters, residuals, jacobians);
auto res = factor_ptr_->evaluate(parameters, residuals, jacobians);
WOLF_ERROR_COND(not res, "Error evaluating factor ", factor_ptr_->getType(), ": ", factor_ptr_->id());
return res;
}
inline FactorBasePtr CostFunctionWrapper::getFactor() const
......
......@@ -47,7 +47,7 @@ class FactorAnalytic : public FactorBase
/** Returns the residual vector and a vector of Jacobian matrix corresponding to each state block evaluated in the
*point provided in _states_ptr
**/
void evaluate(const std::vector<const double*>& _states_ptr,
bool evaluate(const std::vector<const double*>& _states_ptr,
Eigen::VectorXd& _residual,
std::vector<Eigen::MatrixXd>& _jacobians) const override;
......
This diff is collapsed.
......@@ -169,7 +169,7 @@ class FactorBase : public NodeBase, public std::enable_shared_from_this<FactorBa
/** Returns a vector of Jacobian matrix corresponding to each state block evaluated in the point provided in
*_states_ptr and the residual vector
**/
virtual void evaluate(const std::vector<const double*>& _states_ptr,
virtual bool evaluate(const std::vector<const double*>& _states_ptr,
Eigen::VectorXd& _residual,
std::vector<Eigen::MatrixXd>& _jacobians) const = 0;
......
......@@ -75,7 +75,7 @@ bool FactorAnalytic::evaluate(double const* const* parameters, double* residuals
return true;
};
void FactorAnalytic::evaluate(const std::vector<const double*>& _states_ptr,
bool FactorAnalytic::evaluate(const std::vector<const double*>& _states_ptr,
Eigen::VectorXd& residual_,
std::vector<Eigen::MatrixXd>& jacobians_) const
{
......@@ -92,6 +92,8 @@ void FactorAnalytic::evaluate(const std::vector<const double*>& _states_ptr,
// compute jacobians
jacobians_.resize(state_block_sizes_.size());
evaluateJacobians(state_blocks_map_, jacobians_, std::vector<bool>(state_block_sizes_.size(), true));
return true;
};
} // namespace wolf
......@@ -51,10 +51,11 @@ class FactorDummy : public FactorBase
return true;
}
void evaluate(const std::vector<const double*>& _states_ptr,
bool evaluate(const std::vector<const double*>& _states_ptr,
Eigen::VectorXd& _residual,
std::vector<Eigen::MatrixXd>& _jacobians) const override
{
return true;
}
unsigned int getSize() const override
......
......@@ -48,9 +48,12 @@ class FactorFeatureDummy : public FactorBase
/** Returns a residual vector and a vector of Jacobian matrix corresponding to each state block evaluated in the
*point provided in _states_ptr
**/
void evaluate(const std::vector<const double*>& _states_ptr,
bool evaluate(const std::vector<const double*>& _states_ptr,
Eigen::VectorXd& residual_,
std::vector<Eigen::MatrixXd>& jacobians_) const override{};
std::vector<Eigen::MatrixXd>& jacobians_) const override
{
return true;
};
public:
static FactorBasePtr create(const FeatureBasePtr& _feature_ptr,
......
......@@ -46,9 +46,12 @@ class FactorLandmarkDummy : public FactorBase
/** Returns a residual vector and a vector of Jacobian matrix corresponding to each state block evaluated in the
*point provided in _states_ptr
**/
void evaluate(const std::vector<const double*>& _states_ptr,
bool evaluate(const std::vector<const double*>& _states_ptr,
Eigen::VectorXd& residual_,
std::vector<Eigen::MatrixXd>& jacobians_) const override{};
std::vector<Eigen::MatrixXd>& jacobians_) const override
{
return true;
};
public:
static FactorBasePtr create(const FeatureBasePtr& _feature_ptr,
......
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