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

Merge branch 'processor_params' into 'master'

Processor params

See merge request mobile_robotics/wolf!191
parents 85b3df3c 440d012b
No related branches found
No related tags found
1 merge request!191Processor params
Pipeline #
...@@ -8,13 +8,14 @@ ProcessorIMU::ProcessorIMU(const ProcessorParamsIMU& _params) : ...@@ -8,13 +8,14 @@ ProcessorIMU::ProcessorIMU(const ProcessorParamsIMU& _params) :
max_time_span_ (_params.max_time_span ), max_time_span_ (_params.max_time_span ),
max_buff_length_(_params.max_buff_length ), max_buff_length_(_params.max_buff_length ),
dist_traveled_ (_params.dist_traveled ), dist_traveled_ (_params.dist_traveled ),
angle_turned_ (_params.angle_turned ), angle_turned_ (_params.angle_turned )
voting_active_ (_params.voting_active )
{ {
// Set constant parts of Jacobians // Set constant parts of Jacobians
jacobian_delta_preint_.setIdentity(9,9); // dDp'/dDp, dDv'/dDv, all zeros jacobian_delta_preint_.setIdentity(9,9); // dDp'/dDp, dDv'/dDv, all zeros
jacobian_delta_.setIdentity(9,9); // jacobian_delta_.setIdentity(9,9); //
jacobian_calib_.setZero(9,6); jacobian_calib_.setZero(9,6);
setVotingActive(_params.voting_active );
} }
ProcessorIMU::~ProcessorIMU() ProcessorIMU::~ProcessorIMU()
...@@ -44,7 +45,7 @@ ProcessorBasePtr ProcessorIMU::create(const std::string& _unique_name, const Pro ...@@ -44,7 +45,7 @@ ProcessorBasePtr ProcessorIMU::create(const std::string& _unique_name, const Pro
bool ProcessorIMU::voteForKeyFrame() bool ProcessorIMU::voteForKeyFrame()
{ {
if(!voting_active_) if(!isVotingActive())
return false; return false;
// time span // time span
if (getBuffer().get().back().ts_ - getBuffer().get().front().ts_ > max_time_span_) if (getBuffer().get().back().ts_ - getBuffer().get().front().ts_ > max_time_span_)
......
...@@ -16,7 +16,6 @@ struct ProcessorParamsIMU : public ProcessorParamsBase ...@@ -16,7 +16,6 @@ struct ProcessorParamsIMU : public ProcessorParamsBase
Size max_buff_length = 10; Size max_buff_length = 10;
Scalar dist_traveled = 5; Scalar dist_traveled = 5;
Scalar angle_turned = 0.5; Scalar angle_turned = 0.5;
bool voting_active = false; //IMU will not vote for key Frames to be created
}; };
WOLF_PTR_TYPEDEFS(ProcessorIMU); WOLF_PTR_TYPEDEFS(ProcessorIMU);
...@@ -70,7 +69,6 @@ class ProcessorIMU : public ProcessorMotion{ ...@@ -70,7 +69,6 @@ class ProcessorIMU : public ProcessorMotion{
Size max_buff_length_;// maximum buffer size before keyframe Size max_buff_length_;// maximum buffer size before keyframe
Scalar dist_traveled_; // maximum linear motion between keyframes Scalar dist_traveled_; // maximum linear motion between keyframes
Scalar angle_turned_; // maximum rotation between keyframes Scalar angle_turned_; // maximum rotation between keyframes
bool voting_active_; // IMU will be voting for KeyFrame only if this is true
public: public:
......
...@@ -12,7 +12,8 @@ ProcessorBase::ProcessorBase(const std::string& _type, const Scalar& _time_toler ...@@ -12,7 +12,8 @@ ProcessorBase::ProcessorBase(const std::string& _type, const Scalar& _time_toler
processor_id_(++processor_id_count_), processor_id_(++processor_id_count_),
time_tolerance_(_time_tolerance), time_tolerance_(_time_tolerance),
sensor_ptr_(), sensor_ptr_(),
is_removing_(false) is_removing_(false),
voting_active_(true)
{ {
// WOLF_DEBUG("constructed +p" , id()); // WOLF_DEBUG("constructed +p" , id());
} }
...@@ -24,7 +25,7 @@ ProcessorBase::~ProcessorBase() ...@@ -24,7 +25,7 @@ ProcessorBase::~ProcessorBase()
bool ProcessorBase::permittedKeyFrame() bool ProcessorBase::permittedKeyFrame()
{ {
return getProblem()->permitKeyFrame(shared_from_this()); return isVotingActive() && getProblem()->permitKeyFrame(shared_from_this());
} }
FrameBasePtr ProcessorBase::emplaceFrame(FrameType _type, CaptureBasePtr _capture_ptr) FrameBasePtr ProcessorBase::emplaceFrame(FrameType _type, CaptureBasePtr _capture_ptr)
......
...@@ -111,6 +111,7 @@ struct ProcessorParamsBase ...@@ -111,6 +111,7 @@ struct ProcessorParamsBase
std::string type; std::string type;
std::string name; std::string name;
Scalar time_tolerance; ///< maximum time difference between a Keyframe time stamp and a particular Capture of this processor to allow assigning this Capture to the Keyframe. Scalar time_tolerance; ///< maximum time difference between a Keyframe time stamp and a particular Capture of this processor to allow assigning this Capture to the Keyframe.
bool voting_active;
}; };
//class ProcessorBase //class ProcessorBase
...@@ -125,6 +126,8 @@ class ProcessorBase : public NodeBase, public std::enable_shared_from_this<Proce ...@@ -125,6 +126,8 @@ class ProcessorBase : public NodeBase, public std::enable_shared_from_this<Proce
SensorBaseWPtr sensor_ptr_; SensorBaseWPtr sensor_ptr_;
bool is_removing_; ///< A flag for safely removing nodes from the Wolf tree. See remove(). bool is_removing_; ///< A flag for safely removing nodes from the Wolf tree. See remove().
bool voting_active_; ///< A flag for allowing the processor to vote for KF or not.
static unsigned int processor_id_count_; static unsigned int processor_id_count_;
public: public:
...@@ -176,8 +179,21 @@ class ProcessorBase : public NodeBase, public std::enable_shared_from_this<Proce ...@@ -176,8 +179,21 @@ class ProcessorBase : public NodeBase, public std::enable_shared_from_this<Proce
void setTimeTolerance(Scalar _time_tolerance); void setTimeTolerance(Scalar _time_tolerance);
bool isVotingActive() const;
void setVotingActive(bool _voting_active = true);
}; };
inline bool ProcessorBase::isVotingActive() const
{
return voting_active_;
}
inline void ProcessorBase::setVotingActive(bool _voting_active)
{
voting_active_ = _voting_active;
}
} }
#include "sensor_base.h" #include "sensor_base.h"
......
...@@ -13,7 +13,7 @@ namespace wolf ...@@ -13,7 +13,7 @@ namespace wolf
{ {
ProcessorDiffDrive::ProcessorDiffDrive(const ProcessorParamsDiffDrive &params) : ProcessorDiffDrive::ProcessorDiffDrive(const ProcessorParamsDiffDrive &params) :
ProcessorMotion("DIFF DRIVE", 3, 3, 3, 2, 3, 0.15), ProcessorMotion("DIFF DRIVE", 0.15, 3, 3, 3, 2, 3),
unmeasured_perturbation_cov_(Matrix3s::Identity()* unmeasured_perturbation_cov_(Matrix3s::Identity()*
params.unmeasured_perturbation_std_* params.unmeasured_perturbation_std_*
params.unmeasured_perturbation_std_), params.unmeasured_perturbation_std_),
......
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