Skip to content
Snippets Groups Projects
Commit 5fa0b9fd authored by Joaquim Casals Buñuel's avatar Joaquim Casals Buñuel
Browse files

All parameters objects should be able to fill themselves from params server.

parent 83422255
No related branches found
No related tags found
No related merge requests found
Pipeline #3727 passed
Showing
with 106 additions and 3 deletions
......@@ -22,6 +22,19 @@ WOLF_STRUCT_PTR_TYPEDEFS(ProcessorParamsRangeBearing);
struct ProcessorParamsRangeBearing : public ProcessorParamsBase
{
// We do not need special parameters, but in case you need they should be defined here.
ProcessorParamsRangeBearing()
{
//DEFINED FOR COMPATIBILITY PURPOSES. TO BE REMOVED IN THE FUTURE.
}
ProcessorParamsRangeBearing(std::string _unique_name, const paramsServer& _server):
ProcessorParamsBase(_unique_name, _server)
{
//
}
std::string print()
{
return "\n" + ProcessorParamsBase::print();
}
};
using namespace Eigen;
......
......@@ -29,6 +29,11 @@ struct IntrinsicsRangeBearing : public IntrinsicsBase
noise_range_metres_std = _server.getParam<Scalar>(_unique_name + "/noise_range_metres_std", "0.05");
noise_bearing_degrees_std = _server.getParam<Scalar>(_unique_name + "/noise_bearing_degrees_std", "0.5");
}
std::string print()
{
return "\n" + IntrinsicsBase::print() + "noise_range_metres_std: " + std::to_string(noise_range_metres_std) + "\n"
+ "noise_bearing_degrees_std: " + std::to_string(noise_bearing_degrees_std) + "\n";
}
};
WOLF_PTR_TYPEDEFS(SensorRangeBearing)
......
......@@ -375,6 +375,10 @@ struct ParamsBase
}
virtual ~ParamsBase() = default;
std::string print()
{
return "";
}
};
} // namespace wolf
......
......@@ -122,6 +122,7 @@ struct ProcessorParamsBase : public ParamsBase
ParamsBase(_unique_name, _server)
{
voting_active = _server.getParam<bool>(_unique_name + "/voting_active", "false");
voting_aux_active = _server.getParam<bool>(_unique_name + "/voting_aux_active", "false");
time_tolerance = _server.getParam<Scalar>(_unique_name + "/time_tolerance", "0");
}
......@@ -134,6 +135,12 @@ struct ProcessorParamsBase : public ParamsBase
/// a particular Capture of this processor to allow assigning
/// this Capture to the Keyframe.
Scalar time_tolerance = Scalar(0);
std::string print()
{
return ParamsBase::print() + "\n" + "voting_active: " + std::to_string(voting_active) + "\n"
+ "voting_aux_active: " + std::to_string(voting_aux_active) + "\n"
+ "time_tolerance: " + std::to_string(time_tolerance) + "\n";
}
};
//class ProcessorBase
......
......@@ -24,6 +24,16 @@ WOLF_STRUCT_PTR_TYPEDEFS(ProcessorParamsCaptureHolder);
struct ProcessorParamsCaptureHolder : public ProcessorParamsBase
{
Scalar buffer_size = 30;
ProcessorParamsCaptureHolder() = default;
ProcessorParamsCaptureHolder(std::string _unique_name, const wolf::paramsServer & _server):
ProcessorParamsBase(_unique_name, _server)
{
buffer_size = _server.getParam<Scalar>(_unique_name + "/buffer_size");
}
std::string print()
{
return "\n" + ProcessorParamsBase::print() + "buffer_size: " + std::to_string(buffer_size) + "\n";
}
};
/**
......
......@@ -25,6 +25,10 @@ struct ProcessorParamsDiffDrive : public ProcessorParamsMotion
{
unmeasured_perturbation_std = _server.getParam<Scalar>(_unique_name + "/unmeasured_perturbation_std", "0.0001");
}
std::string print()
{
return "\n" + ProcessorParamsMotion::print() + "unmeasured_perturbation_std: " + std::to_string(unmeasured_perturbation_std) + "\n";
}
};
/**
......
......@@ -39,6 +39,15 @@ struct ProcessorParamsMotion : public ProcessorParamsBase
angle_turned = _server.getParam<Scalar>(_unique_name + "/angle_turned", "0.5");
unmeasured_perturbation_std = _server.getParam<Scalar>(_unique_name + "/unmeasured_perturbation_std", "1e-4");
}
std::string print()
{
return "\n" + ProcessorParamsBase::print() + "max_time_span: " + std::to_string(max_time_span) + "\n"
+ "max_buff_length: " + std::to_string(max_buff_length) + "\n"
+ "dist_traveled: " + std::to_string(dist_traveled) + "\n"
+ "angle_turned: " +std::to_string(angle_turned) + "\n"
+ "unmeasured_perturbation_std: " + std::to_string(unmeasured_perturbation_std) + "\n";
}
};
/** \brief class for Motion processors
......
......@@ -26,9 +26,12 @@ struct ProcessorParamsOdom2D : public ProcessorParamsMotion
ProcessorParamsOdom2D(std::string _unique_name, const wolf::paramsServer & _server):
ProcessorParamsMotion(_unique_name, _server)
{
cov_det = _server.getParam<Scalar>(_unique_name + "/cov_det", "1.0");
unmeasured_perturbation_std = _server.getParam<Scalar>(_unique_name + "/unmeasured_perturbation_std", "0.001");
cov_det = _server.getParam<Scalar>(_unique_name + "/cov_det", "1.0");
}
std::string print()
{
return "\n" + ProcessorParamsMotion::print() + "cov_det: " + std::to_string(cov_det) + "\n";
}
};
class ProcessorOdom2D : public ProcessorMotion
{
......
......@@ -27,6 +27,10 @@ struct ProcessorParamsOdom3D : public ProcessorParamsMotion
{
//
}
std::string print()
{
return "\n" + ProcessorParamsMotion::print();
}
};
WOLF_PTR_TYPEDEFS(ProcessorOdom3D);
......
......@@ -27,6 +27,12 @@ struct ProcessorParamsTracker : public ProcessorParamsBase
min_features_for_keyframe = _server.getParam<unsigned int>(_unique_name + "/min_features_for_keyframe", "1");
max_new_features = _server.getParam<int>(_unique_name + "/max_new_features", "-1");
}
std::string print()
{
return ProcessorParamsBase::print() + "\n" + "min_features_for_keyframe: " + std::to_string(min_features_for_keyframe) + "\n"
+ "max_new_features: " + std::to_string(max_new_features) + "\n";
}
};
WOLF_PTR_TYPEDEFS(ProcessorTracker);
......@@ -213,6 +219,9 @@ class ProcessorTracker : public ProcessorBase
{
return number_of_tracks_;
}
std::string print(){
return this->params_tracker_->print();
}
protected:
......
......@@ -23,8 +23,12 @@ namespace wolf {
*/
struct IntrinsicsBase: public ParamsBase
{
virtual ~IntrinsicsBase() = default;
virtual ~IntrinsicsBase() = default;
using ParamsBase::ParamsBase;
std::string print()
{
return "";
}
};
class SensorBase : public NodeBase, public std::enable_shared_from_this<SensorBase>
......
......@@ -61,6 +61,24 @@ struct IntrinsicsDiffDrive : public IntrinsicsBase
right_gain_ = _server.getParam<Scalar>(_unique_name + "/right_gain", "0.01");
}
virtual ~IntrinsicsDiffDrive() = default;
std::string print()
{
std::string model_string;
if(model_ == DiffDriveModel::Two_Factor_Model) model_string = "Two Factor Model";
else if(model_ == DiffDriveModel::Three_Factor_Model) model_string = "Three Factor Model";
else if(model_ == DiffDriveModel::Five_Factor_Model) model_string = "Five Factor Model";
return "\n" + IntrinsicsBase::print() + "left_radius: " + std::to_string(left_radius_) + "\n"
+ "right_radius: " + std::to_string(right_radius_) + "\n"
+ "separation_: " + std::to_string(separation_) + "\n"
+ "model_string: " + model_string + "\n"
+ "factors_: " + converter<std::string>::convert(factors_) + "\n"
+ "left_resolution_: " + std::to_string(left_resolution_) + "\n"
+ "right_resolution_: " + std::to_string(right_resolution_) + "\n"
+ "left_gain_: " + std::to_string(left_gain_) + "\n"
+ "right_gain_: " + std::to_string(right_gain_) + "\n";
}
};
typedef std::shared_ptr<IntrinsicsDiffDrive> IntrinsicsDiffDrivePtr;
......
......@@ -25,6 +25,11 @@ struct IntrinsicsOdom2D : public IntrinsicsBase
k_disp_to_disp = _server.getParam<Scalar>(_unique_name + "/k_disp_to_disp");
k_rot_to_rot = _server.getParam<Scalar>(_unique_name + "/k_rot_to_rot");
}
std::string print()
{
return "\n" + IntrinsicsBase::print() + "k_disp_to_disp: " + std::to_string(k_disp_to_disp) + "\n"
+ "k_rot_to_rot: " + std::to_string(k_rot_to_rot) + "\n";
}
};
WOLF_PTR_TYPEDEFS(SensorOdom2D);
......
......@@ -36,6 +36,14 @@ struct IntrinsicsOdom3D : public IntrinsicsBase
min_disp_var = _server.getParam<Scalar>(_unique_name + "/min_disp_var");
min_rot_var = _server.getParam<Scalar>(_unique_name + "/min_rot_var");
}
std::string print()
{
return "\n" + IntrinsicsBase::print() + "k_disp_to_disp: " + std::to_string(k_disp_to_disp) + "\n"
+ "k_disp_to_rot: " + std::to_string(k_disp_to_rot) + "\n"
+ "k_rot_to_rot: " + std::to_string(k_rot_to_rot) + "\n"
+ "min_disp_var: " + std::to_string(min_disp_var) + "\n"
+ "min_rot_var: " + std::to_string(min_rot_var) + "\n";
}
virtual ~IntrinsicsOdom3D() = default;
};
......
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