Skip to content
Snippets Groups Projects
Commit 4eb5d909 authored by Joan Solà Ortega's avatar Joan Solà Ortega Committed by Joan Solà Ortega
Browse files

Fix state blocks of landmark

parent 6fd04e75
No related branches found
No related tags found
No related merge requests found
...@@ -15,9 +15,9 @@ LandmarkBase::LandmarkBase(const LandmarkType & _tp, const std::string& _type, S ...@@ -15,9 +15,9 @@ LandmarkBase::LandmarkBase(const LandmarkType & _tp, const std::string& _type, S
state_block_vec_(4), // allow for 4 state blocks by default. Should be enough in all applications. state_block_vec_(4), // allow for 4 state blocks by default. Should be enough in all applications.
landmark_id_(++landmark_id_count_), landmark_id_(++landmark_id_count_),
type_id_(_tp), type_id_(_tp),
status_(LANDMARK_CANDIDATE), status_(LANDMARK_CANDIDATE)//,
p_ptr_(_p_ptr), // p_ptr_(_p_ptr),
o_ptr_(_o_ptr) // o_ptr_(_o_ptr)
{ {
// //
state_block_vec_[0] = _p_ptr; state_block_vec_[0] = _p_ptr;
...@@ -66,32 +66,32 @@ void LandmarkBase::setStatus(LandmarkStatus _st) ...@@ -66,32 +66,32 @@ void LandmarkBase::setStatus(LandmarkStatus _st)
// State Blocks // State Blocks
if (status_ == LANDMARK_FIXED) if (status_ == LANDMARK_FIXED)
{ {
if (p_ptr_!=nullptr) if (getPPtr()!=nullptr)
{ {
p_ptr_->fix(); getPPtr()->fix();
if (getProblem() != nullptr) if (getProblem() != nullptr)
getProblem()->updateStateBlockPtr(p_ptr_); getProblem()->updateStateBlockPtr(getPPtr());
} }
if (o_ptr_!=nullptr) if (getOPtr()!=nullptr)
{ {
o_ptr_->fix(); getOPtr()->fix();
if (getProblem() != nullptr) if (getProblem() != nullptr)
getProblem()->updateStateBlockPtr(o_ptr_); getProblem()->updateStateBlockPtr(getOPtr());
} }
} }
else if(status_ == LANDMARK_ESTIMATED) else if(status_ == LANDMARK_ESTIMATED)
{ {
if (p_ptr_!=nullptr) if (getPPtr()!=nullptr)
{ {
p_ptr_->unfix(); getPPtr()->unfix();
if (getProblem() != nullptr) if (getProblem() != nullptr)
getProblem()->updateStateBlockPtr(p_ptr_); getProblem()->updateStateBlockPtr(getPPtr());
} }
if (o_ptr_!=nullptr) if (getOPtr()!=nullptr)
{ {
o_ptr_->unfix(); getOPtr()->unfix();
if (getProblem() != nullptr) if (getProblem() != nullptr)
getProblem()->updateStateBlockPtr(o_ptr_); getProblem()->updateStateBlockPtr(getOPtr());
} }
} }
} }
...@@ -128,15 +128,15 @@ YAML::Node LandmarkBase::saveToYaml() const ...@@ -128,15 +128,15 @@ YAML::Node LandmarkBase::saveToYaml() const
YAML::Node node; YAML::Node node;
node["id"] = landmark_id_; node["id"] = landmark_id_;
node["type"] = node_type_; node["type"] = node_type_;
if (p_ptr_ != nullptr) if (getPPtr() != nullptr)
{ {
node["position"] = p_ptr_->getVector(); node["position"] = getPPtr()->getVector();
node["position fixed"] = p_ptr_->isFixed(); node["position fixed"] = getPPtr()->isFixed();
} }
if (o_ptr_ != nullptr) if (getOPtr() != nullptr)
{ {
node["orientation"] = o_ptr_->getVector(); node["orientation"] = getOPtr()->getVector();
node["orientation fixed"] = p_ptr_->isFixed(); node["orientation fixed"] = getOPtr()->isFixed();
} }
return node; return node;
} }
......
...@@ -39,8 +39,8 @@ class LandmarkBase : public NodeBase, public std::enable_shared_from_this<Landma ...@@ -39,8 +39,8 @@ class LandmarkBase : public NodeBase, public std::enable_shared_from_this<Landma
LandmarkType type_id_; ///< type of landmark. (types defined at wolf.h) LandmarkType type_id_; ///< type of landmark. (types defined at wolf.h)
LandmarkStatus status_; ///< status of the landmark. (types defined at wolf.h) LandmarkStatus status_; ///< status of the landmark. (types defined at wolf.h)
TimeStamp stamp_; ///< stamp of the creation of the landmark (and stamp of destruction when status is LANDMARK_OLD) TimeStamp stamp_; ///< stamp of the creation of the landmark (and stamp of destruction when status is LANDMARK_OLD)
StateBlockPtr p_ptr_; ///< Position state block pointer // StateBlockPtr p_ptr_; ///< Position state block pointer
StateBlockPtr o_ptr_; ///< Orientation state block pointer // StateBlockPtr o_ptr_; ///< Orientation state block pointer
Eigen::VectorXs descriptor_; //TODO: agree? JS: No: It is not general enough as descriptor to be in LmkBase. Eigen::VectorXs descriptor_; //TODO: agree? JS: No: It is not general enough as descriptor to be in LmkBase.
public: public:
...@@ -207,22 +207,22 @@ inline void LandmarkBase::setStateBlockPtr(unsigned int _i, StateBlockPtr _sb_pt ...@@ -207,22 +207,22 @@ inline void LandmarkBase::setStateBlockPtr(unsigned int _i, StateBlockPtr _sb_pt
inline StateBlockPtr LandmarkBase::getPPtr() const inline StateBlockPtr LandmarkBase::getPPtr() const
{ {
return p_ptr_; return getStateBlockPtr(0);
} }
inline StateBlockPtr LandmarkBase::getOPtr() const inline StateBlockPtr LandmarkBase::getOPtr() const
{ {
return o_ptr_; return getStateBlockPtr(1);
} }
inline void LandmarkBase::setPPtr(const StateBlockPtr _st_ptr) inline void LandmarkBase::setPPtr(const StateBlockPtr _st_ptr)
{ {
p_ptr_ = _st_ptr; setStateBlockPtr(0, _st_ptr);
} }
inline void LandmarkBase::setOPtr(const StateBlockPtr _st_ptr) inline void LandmarkBase::setOPtr(const StateBlockPtr _st_ptr)
{ {
o_ptr_ = _st_ptr; setStateBlockPtr(1, _st_ptr);
} }
inline void LandmarkBase::setDescriptor(const Eigen::VectorXs& _descriptor) inline void LandmarkBase::setDescriptor(const Eigen::VectorXs& _descriptor)
......
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