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

Merge remote-tracking branch 'origin/devel' into...

Merge remote-tracking branch 'origin/devel' into 478-subscriber-processor-for-landmark-external-detections
parents 299261e3 1f83c15f
No related branches found
No related tags found
1 merge request!462Resolve "Subscriber&processor for landmark external detections"
Pipeline #13929 canceled
...@@ -123,6 +123,31 @@ class FactorBase : public NodeBase, public std::enable_shared_from_this<FactorBa ...@@ -123,6 +123,31 @@ class FactorBase : public NodeBase, public std::enable_shared_from_this<FactorBa
return topology_; return topology_;
} }
std::string getTopologyString() const
{
switch (topology_)
{
case TOP_GEOM:
return "GEOM";
break;
case TOP_ABS:
return "ABS";
break;
case TOP_LMK:
return "LMK";
break;
case TOP_LOOP:
return "LOOP";
break;
case TOP_OTHER:
return "OTHER";
break;
default:
return "UNDEFINED";
}
}
/** \brief Evaluate the factor given the input parameters and returning the residuals and jacobians /** \brief Evaluate the factor given the input parameters and returning the residuals and jacobians
**/ **/
virtual bool evaluate(double const* const* _parameters, double* _residuals, double** _jacobians) const = 0; virtual bool evaluate(double const* const* _parameters, double* _residuals, double** _jacobians) const = 0;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#define PROCESSOR_MOTION_H_ #define PROCESSOR_MOTION_H_
// Wolf // Wolf
#include <core/processor/motion_provider.h> #include "core/processor/motion_provider.h"
#include "core/capture/capture_motion.h" #include "core/capture/capture_motion.h"
#include "core/processor/processor_base.h" #include "core/processor/processor_base.h"
#include "core/common/time_stamp.h" #include "core/common/time_stamp.h"
...@@ -271,6 +271,10 @@ class ProcessorMotion : public ProcessorBase, public MotionProvider ...@@ -271,6 +271,10 @@ class ProcessorMotion : public ProcessorBase, public MotionProvider
bool voteForKeyFrame() const override; bool voteForKeyFrame() const override;
double updateDt(); double updateDt();
/** \brief Make one step of motion integration
*
* Integrate motiondata in incoming_ptr_ and store all results in the MotionBuffer in last_ptr_
*/
void integrateOneStep(); void integrateOneStep();
void reintegrateBuffer(CaptureMotionPtr _capture_ptr) const; void reintegrateBuffer(CaptureMotionPtr _capture_ptr) const;
void splitBuffer(const wolf::CaptureMotionPtr& capture_source, void splitBuffer(const wolf::CaptureMotionPtr& capture_source,
......
...@@ -158,13 +158,15 @@ FactorBasePtrList CaptureBase::getFactorList() ...@@ -158,13 +158,15 @@ FactorBasePtrList CaptureBase::getFactorList()
void CaptureBase::getFactorList(FactorBaseConstPtrList& _fac_list) const void CaptureBase::getFactorList(FactorBaseConstPtrList& _fac_list) const
{ {
for (auto f_ptr : getFeatureList()) for (auto f_ptr : getFeatureList())
f_ptr->getFactorList(_fac_list); if (not f_ptr->isRemoving())
f_ptr->getFactorList(_fac_list);
} }
void CaptureBase::getFactorList(FactorBasePtrList& _fac_list) void CaptureBase::getFactorList(FactorBasePtrList& _fac_list)
{ {
for (auto f_ptr : getFeatureList()) for (auto f_ptr : getFeatureList())
f_ptr->getFactorList(_fac_list); if (not f_ptr->isRemoving())
f_ptr->getFactorList(_fac_list);
} }
FactorBasePtr CaptureBase::addConstrainedBy(FactorBasePtr _fac_ptr) FactorBasePtr CaptureBase::addConstrainedBy(FactorBasePtr _fac_ptr)
......
...@@ -351,13 +351,15 @@ FactorBasePtrList FrameBase::getFactorList() ...@@ -351,13 +351,15 @@ FactorBasePtrList FrameBase::getFactorList()
void FrameBase::getFactorList(FactorBaseConstPtrList& _fac_list) const void FrameBase::getFactorList(FactorBaseConstPtrList& _fac_list) const
{ {
for (auto c_ptr : getCaptureList()) for (auto c_ptr : getCaptureList())
c_ptr->getFactorList(_fac_list); if (not c_ptr->isRemoving())
c_ptr->getFactorList(_fac_list);
} }
void FrameBase::getFactorList(FactorBasePtrList& _fac_list) void FrameBase::getFactorList(FactorBasePtrList& _fac_list)
{ {
for (auto c_ptr : getCaptureList()) for (auto c_ptr : getCaptureList())
c_ptr->getFactorList(_fac_list); if (not c_ptr->isRemoving())
c_ptr->getFactorList(_fac_list);
} }
bool FrameBase::hasCapture(const CaptureBaseConstPtr& _capture) const bool FrameBase::hasCapture(const CaptureBaseConstPtr& _capture) const
......
...@@ -194,7 +194,7 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr) ...@@ -194,7 +194,7 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
if (keyframe_from_callback) if (keyframe_from_callback)
buffer_frame_.removeUpTo( keyframe_from_callback->getTimeStamp() ); buffer_frame_.removeUpTo( keyframe_from_callback->getTimeStamp() );
switch(processing_step_) switch(processing_step_) // Things to do before integrating motion data
{ {
case FIRST_TIME_WITHOUT_KF : case FIRST_TIME_WITHOUT_KF :
{ {
...@@ -229,14 +229,14 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr) ...@@ -229,14 +229,14 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
} }
// integrate data // integrate motion data
// Done at this place because setPrior() needs // Done at this place because setPrior() needs
integrateOneStep(); integrateOneStep();
// perform bootstrap steps (usually only IMU requires this) // perform bootstrap steps (usually only IMU requires this)
if (bootstrapping_) bootstrap(); if (bootstrapping_) bootstrap();
switch (processing_step_) switch (processing_step_) // Things to do after integrating motion data
{ {
case RUNNING_WITH_KF_BEFORE_ORIGIN : case RUNNING_WITH_KF_BEFORE_ORIGIN :
{ {
...@@ -272,11 +272,11 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr) ...@@ -272,11 +272,11 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
TimeStamp timestamp_from_callback = keyframe_from_callback->getTimeStamp(); TimeStamp timestamp_from_callback = keyframe_from_callback->getTimeStamp();
// find the capture whose buffer is affected by the new keyframe // find the capture whose buffer is affected by the new keyframe
auto capture_existing = findCaptureContainingTimeStamp(timestamp_from_callback); // k auto capture_existing = findCaptureContainingTimeStamp(timestamp_from_callback);
if (!capture_existing) if (!capture_existing)
{ {
WOLF_WARN("A KF before first motion capture (TS = ", timestamp_from_callback, "). ProcessorMotion cannot do anything."); WOLF_WARN(getName(), ": Cannot join KF. The received KF (TS = ", timestamp_from_callback, ") is older than the first motion capture.");
break; break;
} }
...@@ -438,7 +438,7 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr) ...@@ -438,7 +438,7 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
* x : any capture * x : any capture
* o : origin capture * o : origin capture
* l : last capture -> we'll make a KF here * l : last capture -> we'll make a KF here
* i : incoming capture * i : incoming capture -> data has already been integrated into last capture
* n : new capture -> * n : new capture ->
* --- : buffer history * --- : buffer history
* *
...@@ -560,8 +560,6 @@ VectorComposite ProcessorMotion::getState(const StateStructure& _structure) cons ...@@ -560,8 +560,6 @@ VectorComposite ProcessorMotion::getState(const StateStructure& _structure) cons
auto calib_preint = last_ptr_->getCalibrationPreint(); auto calib_preint = last_ptr_->getCalibrationPreint();
VectorComposite state; VectorComposite state;
//WOLF_INFO("processorMotion last timestamp: ", last_ptr_->getTimeStamp());
//WOLF_INFO("processorMotion origin timestamp: ", origin_ptr_->getTimeStamp());
if ( hasCalibration()) if ( hasCalibration())
{ {
// Get current calibration -- from origin capture // Get current calibration -- from origin capture
...@@ -606,7 +604,6 @@ VectorComposite ProcessorMotion::getState(const StateStructure& _structure) cons ...@@ -606,7 +604,6 @@ VectorComposite ProcessorMotion::getState(const StateStructure& _structure) cons
// _x needs to have the size of the processor state
VectorComposite ProcessorMotion::getState(const TimeStamp& _ts, const StateStructure& _structure) const VectorComposite ProcessorMotion::getState(const TimeStamp& _ts, const StateStructure& _structure) const
{ {
assert(_ts.ok()); assert(_ts.ok());
...@@ -759,6 +756,9 @@ void ProcessorMotion::setOrigin(FrameBasePtr _origin_frame) ...@@ -759,6 +756,9 @@ void ProcessorMotion::setOrigin(FrameBasePtr _origin_frame)
void ProcessorMotion::integrateOneStep() void ProcessorMotion::integrateOneStep()
{ {
/* Integrate motiondata in incoming_ptr_ and store all results in the MotionBuffer in last_ptr_
*/
// Set dt // Set dt
dt_ = updateDt(); dt_ = updateDt();
assert(dt_ >= 0 && "Time interval _dt is negative!"); assert(dt_ >= 0 && "Time interval _dt is negative!");
......
...@@ -54,13 +54,15 @@ void TrajectoryBase::removeFrame(FrameBasePtr _frame_ptr) ...@@ -54,13 +54,15 @@ void TrajectoryBase::removeFrame(FrameBasePtr _frame_ptr)
void TrajectoryBase::getFactorList(FactorBaseConstPtrList & _fac_list) const void TrajectoryBase::getFactorList(FactorBaseConstPtrList & _fac_list) const
{ {
for(auto fr_pair: frame_map_) for(auto fr_pair: frame_map_)
fr_pair.second->getFactorList(_fac_list); if (not fr_pair.second->isRemoving())
fr_pair.second->getFactorList(_fac_list);
} }
void TrajectoryBase::getFactorList(FactorBasePtrList & _fac_list) void TrajectoryBase::getFactorList(FactorBasePtrList & _fac_list)
{ {
for(auto fr_pair: frame_map_) for(auto fr_pair: frame_map_)
fr_pair.second->getFactorList(_fac_list); if (not fr_pair.second->isRemoving())
fr_pair.second->getFactorList(_fac_list);
} }
TimeStamp TrajectoryBase::closestTimeStampToTimeStamp(const TimeStamp& _ts) const TimeStamp TrajectoryBase::closestTimeStampToTimeStamp(const TimeStamp& _ts) const
......
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