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

identation and documentation

parent 89fa4afb
No related branches found
No related tags found
1 merge request!274Resolve "Emplace API inconsistent with ProcessorTrackerFeature/Landmark functions"
...@@ -20,8 +20,8 @@ namespace wolf { ...@@ -20,8 +20,8 @@ namespace wolf {
*/ */
typedef enum typedef enum
{ {
FAC_INACTIVE = 0, ///< Factor established with a frame (odometry). FAC_INACTIVE = 0, ///< Inactive factor, it is not included in the SLAM problem.
FAC_ACTIVE = 1 ///< Factor established with absolute reference. FAC_ACTIVE = 1 ///< Normal active factor, playing its role in the solution.
} FactorStatus; } FactorStatus;
/** \brief Enumeration of jacobian computation method /** \brief Enumeration of jacobian computation method
...@@ -45,23 +45,27 @@ class FactorBase : public NodeBase, public std::enable_shared_from_this<FactorBa ...@@ -45,23 +45,27 @@ class FactorBase : public NodeBase, public std::enable_shared_from_this<FactorBa
protected: protected:
unsigned int factor_id_; unsigned int factor_id_;
FactorStatus status_; ///< status of factor (types defined at wolf.h) FactorStatus status_; ///< status of factor
bool apply_loss_function_; ///< flag for applying loss function to this factor bool apply_loss_function_; ///< flag for applying loss function to this factor
FrameBaseWPtr frame_other_ptr_; ///< FrameBase pointer (for category FAC_FRAME) FrameBaseWPtr frame_other_ptr_; ///< FrameBase pointer
CaptureBaseWPtr capture_other_ptr_; ///< CaptureBase pointer CaptureBaseWPtr capture_other_ptr_; ///< CaptureBase pointer
FeatureBaseWPtr feature_other_ptr_; ///< FeatureBase pointer (for category FAC_FEATURE) FeatureBaseWPtr feature_other_ptr_; ///< FeatureBase pointer
LandmarkBaseWPtr landmark_other_ptr_; ///< LandmarkBase pointer (for category FAC_LANDMARK) LandmarkBaseWPtr landmark_other_ptr_; ///< LandmarkBase pointer
ProcessorBaseWPtr processor_ptr_; ///< ProcessorBase pointer ProcessorBaseWPtr processor_ptr_; ///< ProcessorBase pointer
public: public:
/** \brief Constructor of category FAC_ABSOLUTE /** \brief Constructor not involving nodes of other frames, only feature, capture and/or frame of this factor
**/ **/
FactorBase(const std::string& _tp, FactorBase(const std::string& _tp,
bool _apply_loss_function = false, bool _apply_loss_function = false,
FactorStatus _status = FAC_ACTIVE); FactorStatus _status = FAC_ACTIVE);
/** \brief Constructor valid for all categories (FRAME, CAPTURE; FEATURE, LANDMARK) /** \brief Default constructor.
*
* IMPORTANT: "other" means "of another branch of the wolf tree".
* You should only provide a non-nullptr in frame/capture/feature_other_ptr in case of a frame/capture/feature involved in this factor
* that does not located in the same branch.
**/ **/
FactorBase(const std::string& _tp, FactorBase(const std::string& _tp,
const FrameBasePtr& _frame_other_ptr, const FrameBasePtr& _frame_other_ptr,
...@@ -134,10 +138,6 @@ class FactorBase : public NodeBase, public std::enable_shared_from_this<FactorBa ...@@ -134,10 +138,6 @@ class FactorBase : public NodeBase, public std::enable_shared_from_this<FactorBa
*/ */
bool getApplyLossFunction(); bool getApplyLossFunction();
/** \brief Gets the apply loss function flag
*/
//void setApplyLossFunction(const bool _apply);
/** \brief Returns a pointer to the frame constrained to /** \brief Returns a pointer to the frame constrained to
**/ **/
FrameBasePtr getFrameOther() const { return frame_other_ptr_.lock(); } FrameBasePtr getFrameOther() const { return frame_other_ptr_.lock(); }
...@@ -161,12 +161,6 @@ class FactorBase : public NodeBase, public std::enable_shared_from_this<FactorBa ...@@ -161,12 +161,6 @@ class FactorBase : public NodeBase, public std::enable_shared_from_this<FactorBa
*/ */
ProcessorBasePtr getProcessor() const; ProcessorBasePtr getProcessor() const;
/**
* @brief setProcessor
* @param _processor_ptr
*/
void setProcessor(const ProcessorBasePtr& _processor_ptr);
void link(FeatureBasePtr ftr); void link(FeatureBasePtr ftr);
virtual void setProblem(ProblemPtr) final; virtual void setProblem(ProblemPtr) final;
template<typename classType, typename... T> template<typename classType, typename... T>
...@@ -175,6 +169,12 @@ class FactorBase : public NodeBase, public std::enable_shared_from_this<FactorBa ...@@ -175,6 +169,12 @@ class FactorBase : public NodeBase, public std::enable_shared_from_this<FactorBa
private: private:
void setFeature(const FeatureBasePtr _ft_ptr){feature_ptr_ = _ft_ptr;} void setFeature(const FeatureBasePtr _ft_ptr){feature_ptr_ = _ft_ptr;}
/**
* @brief setProcessor
* @param _processor_ptr
*/
void setProcessor(const ProcessorBasePtr& _processor_ptr);
}; };
} }
......
...@@ -119,7 +119,10 @@ class ProcessorTrackerFeature : public ProcessorTracker ...@@ -119,7 +119,10 @@ class ProcessorTrackerFeature : public ProcessorTracker
* \param _features_out returned list of features found in \b _capture * \param _features_out returned list of features found in \b _capture
* \param _feature_correspondences returned map of correspondences: _feature_correspondences[feature_out_ptr] = feature_in_ptr * \param _feature_correspondences returned map of correspondences: _feature_correspondences[feature_out_ptr] = feature_in_ptr
* *
* IMPORTANT: The features in _features_out should be emplaced. It means, they have to be already linked to the _capture * IMPORTANT: The features in _features_out should be emplaced. Don't use `make_shared`, use `FeatureBase::emplace` instead.
* Then, they will be already linked to the _capture.
* If you detect all the features at once in preprocess(), you should either emplace them (`FeatureBase::emplace()`) and remove the not returned features in _features_out (`FeatureBase::remove()`),
* or create them (`make_shared()`) and link all the returned features in _features_out (`FeatureBase::link(_capture)`).
* *
* \return the number of features tracked * \return the number of features tracked
*/ */
...@@ -163,7 +166,10 @@ class ProcessorTrackerFeature : public ProcessorTracker ...@@ -163,7 +166,10 @@ class ProcessorTrackerFeature : public ProcessorTracker
* *
* This function detects Features that do not correspond to known Features/Landmarks in the system. * This function detects Features that do not correspond to known Features/Landmarks in the system.
* *
* IMPORTANT: The features in _features_out should be emplaced. It means, they have to be already linked to the _capture * IMPORTANT: The features in _features_out should be emplaced. Don't use `make_shared`, use `FeatureBase::emplace` instead.
* Then, they will be already linked to the _capture.
* If you detect all the features at once in preprocess(), you should either emplace them (`FeatureBase::emplace()`) and remove the not returned features in _features_out (`FeatureBase::remove()`),
* or create them (`make_shared()`) and link all the returned features in _features_out (`FeatureBase::link(_capture)`).
* *
* The function is called in ProcessorTrackerFeature::processNew() to set the member new_features_last_, * The function is called in ProcessorTrackerFeature::processNew() to set the member new_features_last_,
* the list of newly detected features of the capture last_ptr_. * the list of newly detected features of the capture last_ptr_.
......
...@@ -51,7 +51,8 @@ class ProcessorTrackerFeatureDummy : public ProcessorTrackerFeature ...@@ -51,7 +51,8 @@ class ProcessorTrackerFeatureDummy : public ProcessorTrackerFeature
* \param _features_out returned list of features found in \b _capture * \param _features_out returned list of features found in \b _capture
* \param _feature_correspondences returned map of correspondences: _feature_correspondences[feature_out_ptr] = feature_in_ptr * \param _feature_correspondences returned map of correspondences: _feature_correspondences[feature_out_ptr] = feature_in_ptr
* *
* IMPORTANT: The features in _features_out should be emplaced. It means, they have to be already linked to the _capture * IMPORTANT: The features in _features_out should be emplaced. Don't use `make_shared`, use `FeatureBase::emplace` instead.
* Then, they will be already linked to the _capture.
* *
* \return the number of features tracked * \return the number of features tracked
*/ */
...@@ -84,7 +85,8 @@ class ProcessorTrackerFeatureDummy : public ProcessorTrackerFeature ...@@ -84,7 +85,8 @@ class ProcessorTrackerFeatureDummy : public ProcessorTrackerFeature
* *
* This function detects Features that do not correspond to known Features/Landmarks in the system. * This function detects Features that do not correspond to known Features/Landmarks in the system.
* *
* IMPORTANT: The features in _features_out should be emplaced. It means, they have to be already linked to the _capture * IMPORTANT: The features in _features_out should be emplaced. Don't use `make_shared`, use `FeatureBase::emplace` instead.
* Then, they will be already linked to the _capture.
* *
* The function is called in ProcessorTrackerFeature::processNew() to set the member new_features_last_, * The function is called in ProcessorTrackerFeature::processNew() to set the member new_features_last_,
* the list of newly detected features of the capture last_ptr_. * the list of newly detected features of the capture last_ptr_.
......
...@@ -110,7 +110,10 @@ class ProcessorTrackerLandmark : public ProcessorTracker ...@@ -110,7 +110,10 @@ class ProcessorTrackerLandmark : public ProcessorTracker
* \param _features_out returned list of features found in \b _capture corresponding to a landmark of _landmarks_in * \param _features_out returned list of features found in \b _capture corresponding to a landmark of _landmarks_in
* \param _feature_landmark_correspondences returned map of landmark correspondences: _feature_landmark_correspondences[_feature_out_ptr] = landmark_in_ptr * \param _feature_landmark_correspondences returned map of landmark correspondences: _feature_landmark_correspondences[_feature_out_ptr] = landmark_in_ptr
* *
* IMPORTANT: The features in _features_out should be emplaced. It means, they have to be already linked to the _capture * IMPORTANT: The features in _features_out should be emplaced. Don't use `make_shared`, use `FeatureBase::emplace` instead.
* Then, they will be already linked to the _capture.
* If you detect all the features at once in `preprocess()`, you should either emplace them (`FeatureBase::emplace()`) and remove the not returned features in _features_out (`FeatureBase::remove()`),
* or create them (`make_shared()`) and link all the returned features in _features_out (`FeatureBase::link(_capture)`).
* *
* \return the number of landmarks found * \return the number of landmarks found
*/ */
...@@ -145,7 +148,10 @@ class ProcessorTrackerLandmark : public ProcessorTracker ...@@ -145,7 +148,10 @@ class ProcessorTrackerLandmark : public ProcessorTracker
* *
* This function detects Features that do not correspond to known Features/Landmarks in the system. * This function detects Features that do not correspond to known Features/Landmarks in the system.
* *
* IMPORTANT: The features in _features_out should be emplaced. It means, they have to be already linked to the _capture * IMPORTANT: The features in _features_out should be emplaced. Don't use `make_shared`, use `FeatureBase::emplace` instead.
* Then, they will be already linked to the _capture.
* If you detect all the features at once in `preprocess()`, you should either emplace them (`FeatureBase::emplace()`) and remove the not returned features in _features_out (`FeatureBase::remove()`),
* or create them (`make_shared()`) and link all the returned features in _features_out (`FeatureBase::link(_capture)`).
* *
* The function is called in ProcessorTrackerLandmark::processNew() to set the member new_features_last_, * The function is called in ProcessorTrackerLandmark::processNew() to set the member new_features_last_,
* the list of newly detected features of the capture last_ptr_. * the list of newly detected features of the capture last_ptr_.
......
...@@ -46,7 +46,8 @@ class ProcessorTrackerLandmarkDummy : public ProcessorTrackerLandmark ...@@ -46,7 +46,8 @@ class ProcessorTrackerLandmarkDummy : public ProcessorTrackerLandmark
* \param _features_out returned list of features found in \b _capture corresponding to a landmark of _landmarks_in * \param _features_out returned list of features found in \b _capture corresponding to a landmark of _landmarks_in
* \param _feature_landmark_correspondences returned map of landmark correspondences: _feature_landmark_correspondences[_feature_out_ptr] = landmark_in_ptr * \param _feature_landmark_correspondences returned map of landmark correspondences: _feature_landmark_correspondences[_feature_out_ptr] = landmark_in_ptr
* *
* IMPORTANT: The features in _features_out should be emplaced. It means, they have to be already linked to the _capture * IMPORTANT: The features in _features_out should be emplaced. Don't use `make_shared`, use `FeatureBase::emplace` instead.
* Then, they will be already linked to the _capture.
* *
* \return the number of landmarks found * \return the number of landmarks found
*/ */
...@@ -72,7 +73,8 @@ class ProcessorTrackerLandmarkDummy : public ProcessorTrackerLandmark ...@@ -72,7 +73,8 @@ class ProcessorTrackerLandmarkDummy : public ProcessorTrackerLandmark
* *
* This function detects Features that do not correspond to known Features/Landmarks in the system. * This function detects Features that do not correspond to known Features/Landmarks in the system.
* *
* IMPORTANT: The features in _features_out should be emplaced. It means, they have to be already linked to the _capture * IMPORTANT: The features in _features_out should be emplaced. Don't use `make_shared`, use `FeatureBase::emplace` instead.
* Then, they will be already linked to the _capture.
* *
* The function is called in ProcessorTrackerLandmark::processNew() to set the member new_features_last_, * The function is called in ProcessorTrackerLandmark::processNew() to set the member new_features_last_,
* the list of newly detected features of the capture last_ptr_. * the list of newly detected features of the capture last_ptr_.
......
...@@ -7,8 +7,8 @@ namespace wolf { ...@@ -7,8 +7,8 @@ namespace wolf {
unsigned int FactorBase::factor_id_count_ = 0; unsigned int FactorBase::factor_id_count_ = 0;
FactorBase::FactorBase(const std::string& _tp, FactorBase::FactorBase(const std::string& _tp,
bool _apply_loss_function, bool _apply_loss_function,
FactorStatus _status) : FactorStatus _status) :
NodeBase("FACTOR", _tp), NodeBase("FACTOR", _tp),
feature_ptr_(), // nullptr feature_ptr_(), // nullptr
factor_id_(++factor_id_count_), factor_id_(++factor_id_count_),
...@@ -23,12 +23,13 @@ FactorBase::FactorBase(const std::string& _tp, ...@@ -23,12 +23,13 @@ FactorBase::FactorBase(const std::string& _tp,
} }
FactorBase::FactorBase(const std::string& _tp, FactorBase::FactorBase(const std::string& _tp,
const FrameBasePtr& _frame_other_ptr, const FrameBasePtr& _frame_other_ptr,
const CaptureBasePtr& _capture_other_ptr, const CaptureBasePtr& _capture_other_ptr,
const FeatureBasePtr& _feature_other_ptr, const FeatureBasePtr& _feature_other_ptr,
const LandmarkBasePtr& _landmark_other_ptr, const LandmarkBasePtr& _landmark_other_ptr,
const ProcessorBasePtr& _processor_ptr, const ProcessorBasePtr& _processor_ptr,
bool _apply_loss_function, FactorStatus _status) : bool _apply_loss_function,
FactorStatus _status) :
NodeBase("FACTOR", _tp), NodeBase("FACTOR", _tp),
feature_ptr_(), feature_ptr_(),
factor_id_(++factor_id_count_), factor_id_(++factor_id_count_),
......
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