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

Transfer problem_ptr_ to NodeBase

getProblem is virtual and overriden in several Base classes.
parent ce184f39
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,6 @@ unsigned int CaptureBase::capture_id_count_ = 0;
CaptureBase::CaptureBase(const std::string& _type, const TimeStamp& _ts, SensorBasePtr _sensor_ptr) :
NodeBase("CAPTURE", _type),
problem_ptr_(nullptr),
frame_ptr_(nullptr),
capture_id_(++capture_id_count_),
time_stamp_(_ts),
......
......@@ -20,7 +20,6 @@ namespace wolf{
class CaptureBase : public NodeBase, public std::enable_shared_from_this<CaptureBase>
{
private:
ProblemWPtr problem_ptr_;
FrameBaseWPtr frame_ptr_;
FeatureBaseList feature_list_;
......@@ -48,7 +47,6 @@ class CaptureBase : public NodeBase, public std::enable_shared_from_this<Capture
void setTimeStampToNow();
ProblemPtr getProblem();
void setProblem(ProblemPtr _prob_ptr){problem_ptr_ = _prob_ptr;}
FrameBasePtr getFramePtr() const;
void setFramePtr(const FrameBasePtr _frm_ptr);
......
......@@ -8,7 +8,6 @@ unsigned int ConstraintBase::constraint_id_count_ = 0;
ConstraintBase::ConstraintBase(ConstraintType _tp, bool _apply_loss_function, ConstraintStatus _status) :
NodeBase("CONSTRAINT", "Base"),
problem_ptr_(nullptr),
feature_ptr_(nullptr),
constraint_id_(++constraint_id_count_),
type_id_(_tp),
......@@ -25,7 +24,6 @@ ConstraintBase::ConstraintBase(ConstraintType _tp, bool _apply_loss_function, Co
ConstraintBase::ConstraintBase(ConstraintType _tp, FrameBasePtr _frame_ptr, bool _apply_loss_function, ConstraintStatus _status) :
NodeBase("CONSTRAINT", "Base"),
problem_ptr_(nullptr),
feature_ptr_(nullptr),
constraint_id_(++constraint_id_count_),
type_id_(_tp),
......@@ -43,7 +41,6 @@ ConstraintBase::ConstraintBase(ConstraintType _tp, FrameBasePtr _frame_ptr, bool
ConstraintBase::ConstraintBase(ConstraintType _tp, FeatureBasePtr _feature_ptr, bool _apply_loss_function, ConstraintStatus _status) :
NodeBase("CONSTRAINT"),
problem_ptr_(nullptr),
feature_ptr_(nullptr),
constraint_id_(++constraint_id_count_),
type_id_(_tp),
......@@ -61,7 +58,6 @@ ConstraintBase::ConstraintBase(ConstraintType _tp, FeatureBasePtr _feature_ptr,
ConstraintBase::ConstraintBase(ConstraintType _tp, LandmarkBasePtr _landmark_ptr, bool _apply_loss_function, ConstraintStatus _status) :
NodeBase("CONSTRAINT"),
problem_ptr_(nullptr),
feature_ptr_(nullptr),
constraint_id_(++constraint_id_count_),
type_id_(_tp),
......
......@@ -19,7 +19,6 @@ namespace wolf {
class ConstraintBase : public NodeBase, public std::enable_shared_from_this<ConstraintBase>
{
private:
ProblemWPtr problem_ptr_;
FeatureBaseWPtr feature_ptr_; ///< FeatureBase pointer (upper node)
static unsigned int constraint_id_count_;
......@@ -131,7 +130,6 @@ class ConstraintBase : public NodeBase, public std::enable_shared_from_this<Cons
LandmarkBasePtr getLandmarkOtherPtr();
ProblemPtr getProblem();
void setProblem(ProblemPtr _prob_ptr){problem_ptr_ = _prob_ptr;}
};
......
......@@ -8,7 +8,6 @@ unsigned int FeatureBase::feature_id_count_ = 0;
FeatureBase::FeatureBase(FeatureType _tp, const std::string& _type, unsigned int _dim_measurement) :
NodeBase("FEATURE", _type),
problem_ptr_(nullptr),
capture_ptr_(nullptr),
feature_id_(++feature_id_count_),
track_id_(0),
......@@ -21,7 +20,6 @@ FeatureBase::FeatureBase(FeatureType _tp, const std::string& _type, unsigned int
FeatureBase::FeatureBase(FeatureType _tp, const std::string& _type, const Eigen::VectorXs& _measurement, const Eigen::MatrixXs& _meas_covariance) :
NodeBase("FEATURE", _type),
problem_ptr_(nullptr),
capture_ptr_(nullptr),
feature_id_(++feature_id_count_),
track_id_(0),
......@@ -58,13 +56,6 @@ FeatureBase::~FeatureBase()
}
void FeatureBase::setProblem(ProblemPtr _prob_ptr)
{
problem_ptr_ = _prob_ptr;
}
ConstraintBasePtr FeatureBase::addConstraint(ConstraintBasePtr _co_ptr)
{
constraint_list_.push_back(_co_ptr);
......
......@@ -20,7 +20,6 @@ namespace wolf {
class FeatureBase : public NodeBase, public std::enable_shared_from_this<FeatureBase>
{
private:
ProblemWPtr problem_ptr_;
CaptureBaseWPtr capture_ptr_;
ConstraintBaseList constraint_list_;
ConstraintBaseList constrained_by_list_;
......@@ -73,7 +72,6 @@ class FeatureBase : public NodeBase, public std::enable_shared_from_this<Feature
ProblemPtr getProblem();
void setProblem(ProblemPtr _prob_ptr);
FrameBasePtr getFramePtr() const;
......
......@@ -11,7 +11,6 @@ unsigned int FrameBase::frame_id_count_ = 0;
FrameBase::FrameBase(const TimeStamp& _ts, StateBlock* _p_ptr, StateBlock* _o_ptr, StateBlock* _v_ptr) :
NodeBase("FRAME", "BASE"),
problem_ptr_(nullptr),
trajectory_ptr_(nullptr),
frame_id_(++frame_id_count_),
type_id_(NON_KEY_FRAME),
......@@ -26,7 +25,6 @@ FrameBase::FrameBase(const TimeStamp& _ts, StateBlock* _p_ptr, StateBlock* _o_pt
FrameBase::FrameBase(const FrameKeyType & _tp, const TimeStamp& _ts, StateBlock* _p_ptr, StateBlock* _o_ptr, StateBlock* _v_ptr) :
NodeBase("FRAME", "BASE"),
problem_ptr_(nullptr),
trajectory_ptr_(nullptr),
frame_id_(++frame_id_count_),
type_id_(_tp),
......
......@@ -22,7 +22,6 @@ namespace wolf {
class FrameBase : public NodeBase, public std::enable_shared_from_this<FrameBase>
{
private:
ProblemWPtr problem_ptr_;
TrajectoryBasePtr trajectory_ptr_;
CaptureBaseList capture_list_;
ConstraintBaseList constrained_by_list_;
......@@ -100,7 +99,6 @@ class FrameBase : public NodeBase, public std::enable_shared_from_this<FrameBase
// Wolf tree access ---------------------------------------------------
ProblemPtr getProblem();
void setProblem(ProblemPtr _prob_ptr);
TrajectoryBasePtr getTrajectoryPtr() const;
void setTrajectoryPtr(TrajectoryBasePtr _trj_ptr);
......@@ -282,11 +280,6 @@ inline void FrameBase::getConstraintList(ConstraintBaseList& _ctr_list)
}
inline void FrameBase::setProblem(ProblemPtr _prob_ptr)
{
problem_ptr_ = _prob_ptr;
}
inline void FrameBase::addConstrainedBy(ConstraintBasePtr _ctr_ptr)
{
constrained_by_list_.push_back(_ctr_ptr);
......
......@@ -5,8 +5,7 @@
namespace wolf {
HardwareBase::HardwareBase() :
NodeBase("HARDWARE"),
problem_ptr_(nullptr)
NodeBase("HARDWARE")
{
//std::cout << "HardwareBase::HardwareBase(): " << __LINE__ << std::endl;
}
......
......@@ -14,19 +14,15 @@ class SensorBase;
namespace wolf {
//class HardwareBase
class HardwareBase : public NodeBase //: public NodeLinked<Problem, SensorBase>
class HardwareBase : public NodeBase
{
private:
ProblemWPtr problem_ptr_;
SensorBaseList sensor_list_;
public:
HardwareBase();
virtual ~HardwareBase();
ProblemPtr getProblem(){return problem_ptr_;}
void setProblem(ProblemPtr _prob_ptr){problem_ptr_ = _prob_ptr;}
virtual SensorBasePtr addSensor(SensorBasePtr _sensor_ptr);
SensorBaseList* getSensorListPtr();
void removeSensor(const SensorBaseIter& _sensor_iter);
......
......@@ -11,7 +11,6 @@ unsigned int LandmarkBase::landmark_id_count_ = 0;
LandmarkBase::LandmarkBase(const LandmarkType & _tp, const std::string& _type, StateBlock* _p_ptr, StateBlock* _o_ptr) :
NodeBase("LANDMARK", _type),
problem_ptr_(nullptr),
map_ptr_(nullptr),
landmark_id_(++landmark_id_count_),
type_id_(_tp),
......
......@@ -28,7 +28,6 @@ namespace wolf {
class LandmarkBase : public NodeBase, public std::enable_shared_from_this<LandmarkBase>
{
private:
ProblemWPtr problem_ptr_;
MapBaseWPtr map_ptr_;
ConstraintBaseList constrained_by_list_;
......@@ -105,7 +104,6 @@ class LandmarkBase : public NodeBase, public std::enable_shared_from_this<Landma
void setMapPtr(MapBasePtr _map_ptr){map_ptr_ = _map_ptr.get();} // TODO remove .get()
ProblemPtr getProblem();
void setProblem(ProblemPtr _prob_ptr){problem_ptr_ = _prob_ptr;}
};
......
......@@ -19,8 +19,7 @@
namespace wolf {
MapBase::MapBase() :
NodeBase("MAP"),
problem_ptr_(nullptr)
NodeBase("MAP")
{
std::cout << "created M"<< std::endl;
}
......
......@@ -20,7 +20,6 @@ namespace wolf {
class MapBase : public NodeBase, public std::enable_shared_from_this<MapBase>
{
private:
ProblemWPtr problem_ptr_;
LandmarkBaseList landmark_list_;
public:
......@@ -33,9 +32,6 @@ class MapBase : public NodeBase, public std::enable_shared_from_this<MapBase>
~MapBase();
// void destruct();
ProblemPtr getProblem(){return problem_ptr_;}
void setProblem(ProblemPtr _prob_ptr){problem_ptr_ = _prob_ptr;}
virtual LandmarkBasePtr addLandmark(LandmarkBasePtr _landmark_ptr);
virtual void addLandmarkList(LandmarkBaseList _landmark_list);
void removeLandmark(const LandmarkBaseIter& _landmark_iter);
......
......@@ -57,13 +57,14 @@ class NodeBase
static unsigned int node_id_count_; ///< Object counter (acts as simple ID factory)
protected:
ProblemWPtr problem_ptr_;
bool is_removing_;
unsigned int node_id_; ///< Node id. It is unique over the whole Wolf Tree
std::string node_class_; ///< Text label identifying the class of node ("SENSOR", "FEATURE", etc)
std::string node_type_; ///< Text label identifying the type or subclass of node ("Pin Hole", "Point 2D", etc)
std::string node_name_; ///< Text label identifying each specific object ("left camera", "LIDAR 1", "PointGrey", "Andrew", etc)
bool is_removing_;
public:
NodeBase(const std::string& _class, const std::string& _type = "Undefined", const std::string& _name = "");
......@@ -76,6 +77,10 @@ class NodeBase
void setType(const std::string& _name){node_type_ = _name;};
void setName(const std::string& _name);
virtual ProblemPtr getProblem(){return problem_ptr_;}
void setProblem(ProblemPtr _prob_ptr) {problem_ptr_ = _prob_ptr;}
};
} // namespace wolf
......@@ -85,9 +90,8 @@ class NodeBase
namespace wolf{
inline NodeBase::NodeBase(const std::string& _class, const std::string& _type, const std::string& _name) :
node_id_(++node_id_count_), node_class_(_class), node_type_(_type), node_name_(_name)
problem_ptr_(nullptr), is_removing_(false), node_id_(++node_id_count_), node_class_(_class), node_type_(_type), node_name_(_name)
{
is_removing_ = false;
//
}
......
......@@ -30,7 +30,6 @@ struct IntrinsicsBase
class SensorBase : public NodeBase, public std::enable_shared_from_this<SensorBase>
{
private:
ProblemPtr problem_ptr_;
HardwareBasePtr hardware_ptr_;
ProcessorBaseList processor_list_;
......@@ -129,7 +128,6 @@ class SensorBase : public NodeBase, public std::enable_shared_from_this<SensorBa
Eigen::MatrixXs getNoiseCov();
ProblemPtr getProblem();
void setProblem(ProblemPtr _prob_ptr){problem_ptr_ = _prob_ptr;}
};
......
......@@ -22,7 +22,6 @@ namespace wolf {
class TrajectoryBase : public NodeBase, public std::enable_shared_from_this<TrajectoryBase>
{
private:
ProblemWPtr problem_ptr_;
std::list<FrameBasePtr> frame_list_;
protected:
......@@ -42,10 +41,6 @@ class TrajectoryBase : public NodeBase, public std::enable_shared_from_this<Traj
// Properties
FrameStructure getFrameStructure() const;
// Problem
ProblemPtr getProblem() { return problem_ptr_; }
void setProblem(ProblemPtr _prob_ptr);
// Frames
FrameBasePtr addFrame(FrameBasePtr _frame_ptr);
void removeFrame(const FrameBaseIter& _frame_iter);
......@@ -70,11 +65,6 @@ class TrajectoryBase : public NodeBase, public std::enable_shared_from_this<Traj
namespace wolf{
inline void TrajectoryBase::setProblem(ProblemPtr _prob_ptr)
{
problem_ptr_ = _prob_ptr;
}
inline void TrajectoryBase::moveFrame(FrameBasePtr _frm_ptr, FrameBaseIter _place)
{
if (*_place != _frm_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