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

isStateBlock..Derived not crashing because of associatedMemBlock

parent 70a8027c
No related branches found
No related tags found
No related merge requests found
...@@ -173,18 +173,22 @@ inline ceres::Solver::Options& SolverCeres::getSolverOptions() ...@@ -173,18 +173,22 @@ inline ceres::Solver::Options& SolverCeres::getSolverOptions()
inline bool SolverCeres::isFactorRegisteredDerived(const FactorBasePtr& fac_ptr) const inline bool SolverCeres::isFactorRegisteredDerived(const FactorBasePtr& fac_ptr) const
{ {
return fac_2_residual_idx_.find(fac_ptr) != fac_2_residual_idx_.end() and return fac_2_residual_idx_.count(fac_ptr) == 1 and
fac_2_costfunction_.find(fac_ptr) != fac_2_costfunction_.end(); fac_2_costfunction_.count(fac_ptr) == 1;
} }
inline bool SolverCeres::isStateBlockRegisteredDerived(const StateBlockPtr& state_ptr) const inline bool SolverCeres::isStateBlockRegisteredDerived(const StateBlockPtr& state_ptr) const
{ {
if (state_blocks_.count(state_ptr) == 0)
return false;
return ceres_problem_->HasParameterBlock(getAssociatedMemBlockPtr(state_ptr)); return ceres_problem_->HasParameterBlock(getAssociatedMemBlockPtr(state_ptr));
} }
inline bool SolverCeres::isStateBlockFixedDerived(const StateBlockPtr& st) inline bool SolverCeres::isStateBlockFixedDerived(const StateBlockPtr& st)
{ {
return ceres_problem_->IsParameterBlockConstant(SolverManager::getAssociatedMemBlockPtr(st)); if (state_blocks_.count(st) == 0)
return false;
return ceres_problem_->IsParameterBlockConstant(getAssociatedMemBlockPtr(st));
}; };
inline bool SolverCeres::hasLocalParametrizationDerived(const StateBlockPtr& st) const inline bool SolverCeres::hasLocalParametrizationDerived(const StateBlockPtr& st) const
......
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