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

Removed getCovariance functions that do not return bool

parent d68a2ad2
No related branches found
No related tags found
1 merge request!263Removing getCovariance returning MatrixXs
...@@ -113,7 +113,6 @@ class FrameBase : public NodeBase, public std::enable_shared_from_this<FrameBase ...@@ -113,7 +113,6 @@ class FrameBase : public NodeBase, public std::enable_shared_from_this<FrameBase
void getState(Eigen::VectorXs& _state) const; void getState(Eigen::VectorXs& _state) const;
unsigned int getSize() const; unsigned int getSize() const;
bool getCovariance(Eigen::MatrixXs& _cov) const; bool getCovariance(Eigen::MatrixXs& _cov) const;
Eigen::MatrixXs getCovariance() const;
// Wolf tree access --------------------------------------------------- // Wolf tree access ---------------------------------------------------
public: public:
......
...@@ -72,7 +72,6 @@ class LandmarkBase : public NodeBase, public std::enable_shared_from_this<Landma ...@@ -72,7 +72,6 @@ class LandmarkBase : public NodeBase, public std::enable_shared_from_this<Landma
Eigen::VectorXs getState() const; Eigen::VectorXs getState() const;
void getState(Eigen::VectorXs& _state) const; void getState(Eigen::VectorXs& _state) const;
bool getCovariance(Eigen::MatrixXs& _cov) const; bool getCovariance(Eigen::MatrixXs& _cov) const;
Eigen::MatrixXs getCovariance() const;
protected: protected:
virtual void removeStateBlocks(); virtual void removeStateBlocks();
......
...@@ -236,10 +236,8 @@ class Problem : public std::enable_shared_from_this<Problem> ...@@ -236,10 +236,8 @@ class Problem : public std::enable_shared_from_this<Problem>
bool getCovarianceBlock(std::map<StateBlockPtr, unsigned int> _sb_2_idx, Eigen::MatrixXs& _cov); bool getCovarianceBlock(std::map<StateBlockPtr, unsigned int> _sb_2_idx, Eigen::MatrixXs& _cov);
bool getCovarianceBlock(StateBlockPtr _state, Eigen::MatrixXs& _cov, const int _row_and_col = 0); bool getCovarianceBlock(StateBlockPtr _state, Eigen::MatrixXs& _cov, const int _row_and_col = 0);
bool getFrameCovariance(FrameBaseConstPtr _frame_ptr, Eigen::MatrixXs& _covariance); bool getFrameCovariance(FrameBaseConstPtr _frame_ptr, Eigen::MatrixXs& _covariance);
Eigen::MatrixXs getFrameCovariance(FrameBaseConstPtr _frame_ptr); bool getLastKeyFrameCovariance(Eigen::MatrixXs& _covariance);
Eigen::MatrixXs getLastKeyFrameCovariance();
bool getLandmarkCovariance(LandmarkBaseConstPtr _landmark_ptr, Eigen::MatrixXs& _covariance); bool getLandmarkCovariance(LandmarkBaseConstPtr _landmark_ptr, Eigen::MatrixXs& _covariance);
Eigen::MatrixXs getLandmarkCovariance(LandmarkBaseConstPtr _landmark_ptr);
// Solver management ---------------------------------------- // Solver management ----------------------------------------
......
...@@ -221,11 +221,6 @@ bool FrameBase::getCovariance(Eigen::MatrixXs& _cov) const ...@@ -221,11 +221,6 @@ bool FrameBase::getCovariance(Eigen::MatrixXs& _cov) const
return getProblem()->getFrameCovariance(shared_from_this(), _cov); return getProblem()->getFrameCovariance(shared_from_this(), _cov);
} }
Eigen::MatrixXs FrameBase::getCovariance() const
{
return getProblem()->getFrameCovariance(shared_from_this());
}
FrameBasePtr FrameBase::getPreviousFrame() const FrameBasePtr FrameBase::getPreviousFrame() const
{ {
//std::cout << "finding previous frame of " << this->frame_id_ << std::endl; //std::cout << "finding previous frame of " << this->frame_id_ << std::endl;
......
...@@ -94,11 +94,6 @@ void LandmarkBase::registerNewStateBlocks() ...@@ -94,11 +94,6 @@ void LandmarkBase::registerNewStateBlocks()
} }
} }
Eigen::MatrixXs LandmarkBase::getCovariance() const
{
return getProblem()->getLandmarkCovariance(shared_from_this());
}
bool LandmarkBase::getCovariance(Eigen::MatrixXs& _cov) const bool LandmarkBase::getCovariance(Eigen::MatrixXs& _cov) const
{ {
return getProblem()->getLandmarkCovariance(shared_from_this(), _cov); return getProblem()->getLandmarkCovariance(shared_from_this(), _cov);
......
...@@ -564,6 +564,16 @@ bool Problem::getFrameCovariance(FrameBaseConstPtr _frame_ptr, Eigen::MatrixXs& ...@@ -564,6 +564,16 @@ bool Problem::getFrameCovariance(FrameBaseConstPtr _frame_ptr, Eigen::MatrixXs&
const auto& state_bloc_vec = _frame_ptr->getStateBlockVec(); const auto& state_bloc_vec = _frame_ptr->getStateBlockVec();
// computing size
SizeEigen sz = 0;
for (const auto& sb : state_bloc_vec)
if (sb)
sz += sb->getSize();
// resizing
_covariance = Eigen::MatrixXs(sz, sz);
// filling covariance
for (const auto& sb_i : state_bloc_vec) for (const auto& sb_i : state_bloc_vec)
{ {
if (sb_i) if (sb_i)
...@@ -583,23 +593,10 @@ bool Problem::getFrameCovariance(FrameBaseConstPtr _frame_ptr, Eigen::MatrixXs& ...@@ -583,23 +593,10 @@ bool Problem::getFrameCovariance(FrameBaseConstPtr _frame_ptr, Eigen::MatrixXs&
return success; return success;
} }
Eigen::MatrixXs Problem::getFrameCovariance(FrameBaseConstPtr _frame_ptr) bool Problem::getLastKeyFrameCovariance(Eigen::MatrixXs& cov)
{
SizeEigen sz = 0;
for (const auto& sb : _frame_ptr->getStateBlockVec())
if (sb)
sz += sb->getSize();
Eigen::MatrixXs covariance(sz, sz);
getFrameCovariance(_frame_ptr, covariance);
return covariance;
}
Eigen::MatrixXs Problem::getLastKeyFrameCovariance()
{ {
FrameBasePtr frm = getLastKeyFrame(); FrameBasePtr frm = getLastKeyFrame();
return getFrameCovariance(frm); return getFrameCovariance(frm, cov);
} }
bool Problem::getLandmarkCovariance(LandmarkBaseConstPtr _landmark_ptr, Eigen::MatrixXs& _covariance) bool Problem::getLandmarkCovariance(LandmarkBaseConstPtr _landmark_ptr, Eigen::MatrixXs& _covariance)
...@@ -609,6 +606,17 @@ bool Problem::getLandmarkCovariance(LandmarkBaseConstPtr _landmark_ptr, Eigen::M ...@@ -609,6 +606,17 @@ bool Problem::getLandmarkCovariance(LandmarkBaseConstPtr _landmark_ptr, Eigen::M
const auto& state_bloc_vec = _landmark_ptr->getStateBlockVec(); const auto& state_bloc_vec = _landmark_ptr->getStateBlockVec();
// computing size
SizeEigen sz = 0;
for (const auto& sb : state_bloc_vec)
if (sb)
sz += sb->getSize();
// resizing
_covariance = Eigen::MatrixXs(sz, sz);
// filling covariance
for (const auto& sb_i : state_bloc_vec) for (const auto& sb_i : state_bloc_vec)
{ {
if (sb_i) if (sb_i)
...@@ -628,19 +636,6 @@ bool Problem::getLandmarkCovariance(LandmarkBaseConstPtr _landmark_ptr, Eigen::M ...@@ -628,19 +636,6 @@ bool Problem::getLandmarkCovariance(LandmarkBaseConstPtr _landmark_ptr, Eigen::M
return success; return success;
} }
Eigen::MatrixXs Problem::getLandmarkCovariance(LandmarkBaseConstPtr _landmark_ptr)
{
SizeEigen sz = 0;
for (const auto& sb : _landmark_ptr->getStateBlockVec())
if (sb)
sz += sb->getSize();
Eigen::MatrixXs covariance(sz, sz);
getLandmarkCovariance(_landmark_ptr, covariance);
return covariance;
}
MapBasePtr Problem::getMap() MapBasePtr Problem::getMap()
{ {
return map_ptr_; return map_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