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

Inline things in all base classes

parent d4547f8c
No related branches found
No related tags found
No related merge requests found
......@@ -31,17 +31,7 @@ void HardwareBase::addSensor(SensorBase* _sensor_ptr)
}
void HardwareBase::removeSensor(const SensorBaseIter& _sensor_iter)
{
removeDownNode(_sensor_iter);
}
void HardwareBase::removeSensor(SensorBase* _sensor_ptr)
{
removeDownNode(_sensor_ptr->nodeId());
}
SensorBaseList* HardwareBase::getSensorListPtr()
{
return getDownNodeListPtr();
removeDownNode(_sensor_ptr->nodeId());
}
......@@ -28,32 +28,31 @@ class HardwareBase : public NodeLinked<WolfProblem, SensorBase>
virtual ~HardwareBase();
/** \brief Adds a sensor
*
* Adds a sensor
*
**/
virtual void addSensor(SensorBase* _sensor_ptr);
/** \brief Removes a sensor
*
* Removes a sensor
*
**/
void removeSensor(const SensorBaseIter& _sensor_iter);
/** \brief Removes a sensor
*
* Removes a sensor
*
**/
void removeSensor(SensorBase* _sensor_ptr);
/** \brief Returns Sensor list
*
* Returns SensorBase list
*
**/
SensorBaseList* getSensorListPtr();
};
inline void HardwareBase::removeSensor(const SensorBaseIter& _sensor_iter)
{
removeDownNode(_sensor_iter);
}
inline SensorBaseList* HardwareBase::getSensorListPtr()
{
return getDownNodeListPtr();
}
#endif
......@@ -45,11 +45,6 @@ LandmarkBase::~LandmarkBase()
//std::cout << "constraints deleted" << std::endl;
}
void LandmarkBase::addConstraintTo(ConstraintBase* _ctr_ptr)
{
constraint_to_list_.push_back(_ctr_ptr);
}
void LandmarkBase::removeConstraintTo(ConstraintBase* _ctr_ptr)
{
constraint_to_list_.remove(_ctr_ptr);
......@@ -58,16 +53,6 @@ void LandmarkBase::removeConstraintTo(ConstraintBase* _ctr_ptr)
this->destruct();
}
unsigned int LandmarkBase::getHits() const
{
return constraint_to_list_.size();
}
std::list<ConstraintBase*>* LandmarkBase::getConstraintToListPtr()
{
return &constraint_to_list_;
}
void LandmarkBase::setStatus(LandmarkStatus _st)
{
status_ = _st;
......@@ -104,55 +89,3 @@ void LandmarkBase::setStatus(LandmarkStatus _st)
}
}
}
void LandmarkBase::fix()
{
//std::cout << "Fixing frame " << nodeId() << std::endl;
this->setStatus(LANDMARK_FIXED);
}
void LandmarkBase::unfix()
{
//std::cout << "Unfixing frame " << nodeId() << std::endl;
this->setStatus(LANDMARK_ESTIMATED);
}
StateBlock* LandmarkBase::getPPtr() const
{
return p_ptr_;
}
StateBlock* LandmarkBase::getOPtr() const
{
return o_ptr_;
}
void LandmarkBase::setPPtr(StateBlock* _st_ptr)
{
p_ptr_ = _st_ptr;
}
void LandmarkBase::setOPtr(StateBlock* _st_ptr)
{
o_ptr_ = _st_ptr;
}
void LandmarkBase::setDescriptor(const Eigen::VectorXs& _descriptor)
{
descriptor_ = _descriptor;
}
const Eigen::VectorXs& LandmarkBase::getDescriptor() const
{
return descriptor_;
}
WolfScalar LandmarkBase::getDescriptor(unsigned int _ii) const
{
return descriptor_(_ii);
}
const LandmarkType LandmarkBase::getType() const
{
return type_;
}
......@@ -47,109 +47,133 @@ class LandmarkBase : public NodeLinked<MapBase, NodeTerminus>
virtual ~LandmarkBase();
/** \brief Link with a constraint
*
* Link with a constraint
*
**/
void addConstraintTo(ConstraintBase* _ctr_ptr);
/** \brief Remove a constraint to this landmark
*
* Remove a constraint to this landmark
*
**/
void removeConstraintTo(ConstraintBase* _ctr_ptr);
/** \brief Gets the number of constraints linked with this landmark
*
* Gets the number of constraints linked with this landmark
*
**/
unsigned int getHits() const;
/** \brief Gets the list of constraints linked with this landmark
*
* Gets the list of constraints linked with this landmark
*
**/
std::list<ConstraintBase*>* getConstraintToListPtr();
/** \brief Sets the Landmark status
*
* Sets the Landmark status (see wolf.h)
*
**/
void setStatus(LandmarkStatus _st);
/** \brief Sets the Landmark status to fixed
*
* Sets the Landmark status to fixed
*
**/
void fix();
/** \brief Sets the Landmark status to estimated
*
* Sets the Landmark status to estimated
*
**/
void unfix();
/** \brief Gets the position state block pointer
*
* Gets the position state block pointer
*
**/
StateBlock* getPPtr() const;
/** \brief Gets the orientation state block pointer
*
* Gets the orientation state block pointer
*
**/
StateBlock* getOPtr() const;
/** \brief Sets the position state block pointer
*
* Sets the position state block pointer
*
**/
void setPPtr(StateBlock* _st_ptr);
/** \brief Sets the orientation state block pointer
*
* Sets the orientation state block pointer
*
**/
void setOPtr(StateBlock* _st_ptr);
/** \brief Sets the descriptor
*
* Sets the descriptor
*
**/
void setDescriptor(const Eigen::VectorXs& _descriptor);
/** \brief Gets the descriptor
*
* Gets the descriptor
*
**/
const Eigen::VectorXs& getDescriptor() const;
/** \brief Returns _ii component of descriptor vector
*
* Returns _ii component of descriptor_ vector
* WARNING: To be fast, it does not check that index _ii is smaller than dimension.
*
**/
WolfScalar getDescriptor(unsigned int _ii) const;
/** \brief Return the type of the landmark
*
* Return the type of the landmark (see wolf.h)
*
**/
const LandmarkType getType() const;
};
inline void LandmarkBase::addConstraintTo(ConstraintBase* _ctr_ptr)
{
constraint_to_list_.push_back(_ctr_ptr);
}
inline unsigned int LandmarkBase::getHits() const
{
return constraint_to_list_.size();
}
inline std::list<ConstraintBase*>* LandmarkBase::getConstraintToListPtr()
{
return &constraint_to_list_;
}
inline void LandmarkBase::fix()
{
//std::cout << "Fixing frame " << nodeId() << std::endl;
this->setStatus(LANDMARK_FIXED);
}
inline void LandmarkBase::unfix()
{
//std::cout << "Unfixing frame " << nodeId() << std::endl;
this->setStatus(LANDMARK_ESTIMATED);
}
inline StateBlock* LandmarkBase::getPPtr() const
{
return p_ptr_;
}
inline StateBlock* LandmarkBase::getOPtr() const
{
return o_ptr_;
}
inline void LandmarkBase::setPPtr(StateBlock* _st_ptr)
{
p_ptr_ = _st_ptr;
}
inline void LandmarkBase::setOPtr(StateBlock* _st_ptr)
{
o_ptr_ = _st_ptr;
}
inline void LandmarkBase::setDescriptor(const Eigen::VectorXs& _descriptor)
{
descriptor_ = _descriptor;
}
inline WolfScalar LandmarkBase::getDescriptor(unsigned int _ii) const
{
return descriptor_(_ii);
}
inline const Eigen::VectorXs& LandmarkBase::getDescriptor() const
{
return descriptor_;
}
inline const LandmarkType LandmarkBase::getType() const
{
return type_;
}
#endif
......@@ -21,23 +21,3 @@ NodeBase::~NodeBase()
//std::cout << "deleting NodeBase " << nodeId() << std::endl;
}
unsigned int NodeBase::nodeId() const
{
return node_id_;
}
std::string NodeBase::nodeLabel() const
{
return label_;
}
//void NodeBase::print(unsigned int _ntabs, std::ostream& _ost) const
//{
// _ost << label_ << " " << node_id_ << std::endl;
//}
//void NodeBase::printTabs(unsigned int _ntabs, std::ostream& _ost) const
//{
// for (unsigned int i = 0; i < _ntabs; i++) _ost << "\t";
//}
......@@ -54,27 +54,16 @@ class NodeBase
*/
std::string nodeLabel() const;
// /** \brief Print node information
// *
// * Prints node information. Inine function.
// * \param _ntabs number of tabulations to print at the left of the printed information
// * \param _ost output stream
// *
// * Overload this function in derived classes to adapt the printed output to each object's relevant info.
// *
// */
// virtual void print(unsigned int _ntabs = 0, std::ostream& _ost = std::cout) const;
};
protected:
inline unsigned int NodeBase::nodeId() const
{
return node_id_;
}
// /** \brief prints a number of tabulations.
// *
// * Prints a number of tabulations, i.e., "\t". Inline function.
// * \param _ntabs number of tabulations to print
// * \param _ost output stream
// *
// */
// void printTabs(unsigned int _ntabs = 0, std::ostream& _ost = std::cout) const;
};
inline std::string NodeBase::nodeLabel() const
{
return label_;
}
#endif /* NODE_BASE_H_ */
......@@ -12,9 +12,3 @@ ProcessorBase::~ProcessorBase()
{
//
}
SensorBase* ProcessorBase::getSensorPtr()
{
return upperNodePtr();
}
......@@ -34,4 +34,10 @@ class ProcessorBase : public NodeLinked<SensorBase, NodeTerminus>
virtual void process(CaptureBase* _capture_ptr) = 0;
};
inline SensorBase* ProcessorBase::getSensorPtr()
{
return upperNodePtr();
}
#endif
......@@ -50,31 +50,6 @@ SensorBase::~SensorBase()
}
void SensorBase::addProcessor(ProcessorBase* _proc_ptr)
{
addDownNode(_proc_ptr);
}
ProcessorBaseList* SensorBase::getProcessorListPtr()
{
return getDownNodeListPtr();
}
StateBlock* SensorBase::getPPtr() const
{
return p_ptr_;
}
StateBlock* SensorBase::getOPtr() const
{
return o_ptr_;
}
StateBlock* SensorBase::getIntrinsicPtr() const
{
return intrinsic_ptr_;
}
void SensorBase::fix()
{
// State Blocks
......@@ -109,22 +84,9 @@ void SensorBase::unfix()
}
}
bool SensorBase::isExtrinsicDynamic() {
return extrinsic_dynamic_;
}
void SensorBase::setNoise(const Eigen::VectorXs& _noise_std) {
noise_std_ = _noise_std;
noise_cov_.setZero();
for (unsigned int i=0; i<_noise_std.size(); i++)
noise_cov_(i,i) = _noise_std(i) * _noise_std(i);
}
Eigen::VectorXs SensorBase::getNoiseStd() {
return noise_std_;
}
Eigen::MatrixXs SensorBase::getNoiseCov() {
return noise_cov_;
}
......@@ -86,4 +86,45 @@ class SensorBase : public NodeLinked<HardwareBase, ProcessorBase>
Eigen::MatrixXs getNoiseCov();
};
inline void SensorBase::addProcessor(ProcessorBase* _proc_ptr)
{
addDownNode(_proc_ptr);
}
inline ProcessorBaseList* SensorBase::getProcessorListPtr()
{
return getDownNodeListPtr();
}
inline StateBlock* SensorBase::getPPtr() const
{
return p_ptr_;
}
inline StateBlock* SensorBase::getOPtr() const
{
return o_ptr_;
}
inline StateBlock* SensorBase::getIntrinsicPtr() const
{
return intrinsic_ptr_;
}
inline bool SensorBase::isExtrinsicDynamic()
{
return extrinsic_dynamic_;
}
inline Eigen::VectorXs SensorBase::getNoiseStd()
{
return noise_std_;
}
inline Eigen::MatrixXs SensorBase::getNoiseCov()
{
return noise_cov_;
}
#endif
......@@ -29,26 +29,6 @@ void TrajectoryBase::addFrame(FrameBase* _frame_ptr)
}
}
void TrajectoryBase::removeFrame(const FrameBaseIter& _frame_iter)
{
removeDownNode(_frame_iter);
}
FrameStructure TrajectoryBase::getFrameStructure() const
{
return frame_structure_;
}
FrameBaseList* TrajectoryBase::getFrameListPtr()
{
return getDownNodeListPtr();
}
FrameBase* TrajectoryBase::getLastFramePtr()
{
return getDownNodeListPtr()->back();
}
void TrajectoryBase::getConstraintList(ConstraintBaseList & _ctr_list)
{
for(auto fr_it = getFrameListPtr()->begin(); fr_it != getFrameListPtr()->end(); ++fr_it)
......
......@@ -47,21 +47,30 @@ class TrajectoryBase : public NodeLinked<WolfProblem,FrameBase>
* Remove a frame to the trajectory
*
**/
void removeFrame(const FrameBaseIter& _frame_ptr);
void removeFrame(const FrameBaseIter& _frame_iter)
{
removeDownNode(_frame_iter);
}
/** \brief Returns a pointer to Frame list
*
* Returns a pointer to Frame list
*
**/
FrameBaseList* getFrameListPtr();
FrameBaseList* getFrameListPtr()
{
return getDownNodeListPtr();
}
/** \brief Returns a pointer to last Frame
*
* Returns a pointer to last Frame
*
**/
FrameBase* getLastFramePtr();
FrameBase* getLastFramePtr()
{
return getDownNodeListPtr()->back();
}
/** \brief Returns a list of all constraints in the trajectory thru reference
......@@ -71,6 +80,9 @@ class TrajectoryBase : public NodeLinked<WolfProblem,FrameBase>
**/
void getConstraintList(ConstraintBaseList & _ctr_list);
FrameStructure getFrameStructure() const;
FrameStructure getFrameStructure() const
{
return frame_structure_;
}
};
#endif
......@@ -210,79 +210,11 @@ void WolfProblem::addTrajectory(TrajectoryBase* _trajectory_ptr)
trajectory_ptr_->linkToUpperNode( this );
}
MapBase* WolfProblem::getMapPtr()
{
return map_ptr_;
}
TrajectoryBase* WolfProblem::getTrajectoryPtr()
{
return trajectory_ptr_;
}
HardwareBase* WolfProblem::getHardwarePtr()
{
return hardware_ptr_;
}
FrameBase* WolfProblem::getLastFramePtr()
{
return trajectory_ptr_->getLastFramePtr();
}
StateBlockList* WolfProblem::getStateListPtr()
{
return &state_block_ptr_list_;
}
//void WolfProblem::print(unsigned int _ntabs, std::ostream& _ost) const
//{
// printSelf(_ntabs, _ost); //one line
// printLower(_ntabs, _ost);
//}
//
//void WolfProblem::printSelf(unsigned int _ntabs, std::ostream& _ost) const
//{
// printTabs(_ntabs);
// _ost << nodeLabel() << " " << nodeId() << " : ";
// _ost << "TOP" << std::endl;
//}
std::list<StateBlock*>* WolfProblem::getStateBlockAddList()
{
return &state_block_add_list_;
}
std::list<StateBlock*>* WolfProblem::getStateBlockUpdateList()
{
return &state_block_update_list_;
}
std::list<WolfScalar*>* WolfProblem::getStateBlockRemoveList()
{
return &state_block_remove_list_;
}
std::list<ConstraintBase*>* WolfProblem::getConstraintAddList()
{
return &constraint_add_list_;
}
std::list<unsigned int>* WolfProblem::getConstraintRemoveList()
{
return &constraint_remove_list_;
}
WolfProblem* WolfProblem::getTop()
{
return this;
}
bool WolfProblem::isTop()
{
return true;
}
void WolfProblem::removeDownNode(const LowerNodePtr _ptr)
{
//
......
......@@ -183,4 +183,59 @@ class WolfProblem: public NodeBase
};
inline MapBase* WolfProblem::getMapPtr()
{
return map_ptr_;
}
inline TrajectoryBase* WolfProblem::getTrajectoryPtr()
{
return trajectory_ptr_;
}
inline HardwareBase* WolfProblem::getHardwarePtr()
{
return hardware_ptr_;
}
inline StateBlockList* WolfProblem::getStateListPtr()
{
return &state_block_ptr_list_;
}
inline std::list<StateBlock*>* WolfProblem::getStateBlockAddList()
{
return &state_block_add_list_;
}
inline std::list<StateBlock*>* WolfProblem::getStateBlockUpdateList()
{
return &state_block_update_list_;
}
inline std::list<WolfScalar*>* WolfProblem::getStateBlockRemoveList()
{
return &state_block_remove_list_;
}
inline std::list<ConstraintBase*>* WolfProblem::getConstraintAddList()
{
return &constraint_add_list_;
}
inline std::list<unsigned int>* WolfProblem::getConstraintRemoveList()
{
return &constraint_remove_list_;
}
inline WolfProblem* WolfProblem::getTop()
{
return this;
}
inline bool WolfProblem::isTop()
{
return true;
}
#endif
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