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

added processor voting/permit auxiliary frames machinery

parent d4a0dc61
No related branches found
No related tags found
1 merge request!266Estimated frames
This commit is part of merge request !266. Comments created here will be created in the context of that merge request.
......@@ -110,16 +110,19 @@ struct ProcessorParamsBase
ProcessorParamsBase() = default;
ProcessorParamsBase(bool _voting_active,
Scalar _time_tolerance)
: voting_active(_voting_active)
, time_tolerance(_time_tolerance)
Scalar _time_tolerance,
bool _voting_aux_active = false) :
voting_active(_voting_active),
voting_aux_active(_voting_aux_active),
time_tolerance(_time_tolerance)
{
//
}
virtual ~ProcessorParamsBase() = default;
bool voting_active = false;
bool voting_active = false; ///< Whether this processor is allowed to vote for a Key Frame or not
bool voting_aux_active = false; ///< Whether this processor is allowed to vote for an Auxiliary Frame or not
///< maximum time difference between a Keyframe time stamp and
/// a particular Capture of this processor to allow assigning
......@@ -159,8 +162,19 @@ class ProcessorBase : public NodeBase, public std::enable_shared_from_this<Proce
*/
virtual bool voteForKeyFrame() = 0;
/** \brief Vote for Auxiliary Frame generation
*
* If a Auxiliary Frame criterion is validated, this function returns true,
* meaning that it wants to create a Auxiliary Frame at the \b last Capture.
*
* WARNING! This function only votes! It does not create Auxiliary Frames!
*/
virtual bool voteForAuxFrame(){return false;};
virtual bool permittedKeyFrame() final;
virtual bool permittedAuxFrame() final;
/**\brief make a Frame with the provided Capture
*
* Provide the following functionality:
......@@ -192,7 +206,11 @@ class ProcessorBase : public NodeBase, public std::enable_shared_from_this<Proce
bool isVotingActive() const;
bool isVotingAuxActive() const;
void setVotingActive(bool _voting_active = true);
void setVotingAuxActive(bool _voting_active = true);
};
inline bool ProcessorBase::isVotingActive() const
......@@ -200,11 +218,21 @@ inline bool ProcessorBase::isVotingActive() const
return params_->voting_active;
}
inline bool ProcessorBase::isVotingAuxActive() const
{
return params_->voting_aux_active;
}
inline void ProcessorBase::setVotingActive(bool _voting_active)
{
params_->voting_active = _voting_active;
}
inline void ProcessorBase::setVotingAuxActive(bool _voting_active)
{
params_->voting_aux_active = _voting_active;
}
}
#include "base/sensor/sensor_base.h"
......
......@@ -35,8 +35,6 @@ ProcessorBasePtr ProcessorIMU::create(const std::string& _unique_name, const Pro
bool ProcessorIMU::voteForKeyFrame()
{
if(!isVotingActive())
return false;
// time span
if (getBuffer().get().back().ts_ - getBuffer().get().front().ts_ > params_motion_IMU_->max_time_span)
{
......
......@@ -26,6 +26,11 @@ bool ProcessorBase::permittedKeyFrame()
return isVotingActive() && getProblem()->permitKeyFrame(shared_from_this());
}
bool ProcessorBase::permittedAuxFrame()
{
return isVotingAuxActive() && getProblem()->permitAuxFrame(shared_from_this());
}
FrameBasePtr ProcessorBase::emplaceFrame(FrameType _type, CaptureBasePtr _capture_ptr)
{
std::cout << "Making " << (_type == KEY ? "key-" : (_type == AUXILIARY ? "aux-" : "")) << "frame" << std::endl;
......
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