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

Remove name and type from ProcParams and Intrinsics structs

parent 63166529
No related branches found
No related tags found
1 merge request!244Resolve "Remove type and name from ProcessorParamsBase and IntrinsicsBase"
Pipeline #2490 passed
...@@ -8,7 +8,7 @@ namespace wolf { ...@@ -8,7 +8,7 @@ namespace wolf {
unsigned int ProcessorBase::processor_id_count_ = 0; unsigned int ProcessorBase::processor_id_count_ = 0;
ProcessorBase::ProcessorBase(const std::string& _type, ProcessorParamsBasePtr _params) : ProcessorBase::ProcessorBase(const std::string& _type, ProcessorParamsBasePtr _params) :
NodeBase("PROCESSOR", _type, _params->name), NodeBase("PROCESSOR", _type),
processor_id_(++processor_id_count_), processor_id_(++processor_id_count_),
params_(_params), params_(_params),
sensor_ptr_() sensor_ptr_()
......
...@@ -112,13 +112,9 @@ struct ProcessorParamsBase ...@@ -112,13 +112,9 @@ struct ProcessorParamsBase
ProcessorParamsBase() = default; ProcessorParamsBase() = default;
ProcessorParamsBase(bool _voting_active, ProcessorParamsBase(bool _voting_active,
Scalar _time_tolerance, Scalar _time_tolerance)
const std::string& _type,
const std::string& _name)
: voting_active(_voting_active) : voting_active(_voting_active)
, time_tolerance(_time_tolerance) , time_tolerance(_time_tolerance)
, type(_type)
, name(_name)
{ {
// //
} }
...@@ -131,9 +127,6 @@ struct ProcessorParamsBase ...@@ -131,9 +127,6 @@ struct ProcessorParamsBase
/// a particular Capture of this processor to allow assigning /// a particular Capture of this processor to allow assigning
/// this Capture to the Keyframe. /// this Capture to the Keyframe.
Scalar time_tolerance = Scalar(0); Scalar time_tolerance = Scalar(0);
std::string type;
std::string name;
}; };
//class ProcessorBase //class ProcessorBase
......
...@@ -39,7 +39,6 @@ ProcessorTrackerFeatureTrifocal::ProcessorTrackerFeatureTrifocal(ProcessorParams ...@@ -39,7 +39,6 @@ ProcessorTrackerFeatureTrifocal::ProcessorTrackerFeatureTrifocal(ProcessorParams
prev_origin_ptr_(nullptr), prev_origin_ptr_(nullptr),
initialized_(false) initialized_(false)
{ {
setName(_params_tracker_feature_trifocal->name);
assert(!(params_tracker_feature_trifocal_->yaml_file_params_vision_utils.empty()) && "Missing YAML file with vision_utils parameters!"); assert(!(params_tracker_feature_trifocal_->yaml_file_params_vision_utils.empty()) && "Missing YAML file with vision_utils parameters!");
assert(file_exists(params_tracker_feature_trifocal_->yaml_file_params_vision_utils) && "Cannot setup processor: vision_utils' YAML file does not exist."); assert(file_exists(params_tracker_feature_trifocal_->yaml_file_params_vision_utils) && "Cannot setup processor: vision_utils' YAML file does not exist.");
......
...@@ -25,9 +25,6 @@ namespace wolf { ...@@ -25,9 +25,6 @@ namespace wolf {
struct IntrinsicsBase struct IntrinsicsBase
{ {
virtual ~IntrinsicsBase() = default; virtual ~IntrinsicsBase() = default;
std::string type;
std::string name;
}; };
class SensorBase : public NodeBase, public std::enable_shared_from_this<SensorBase> class SensorBase : public NodeBase, public std::enable_shared_from_this<SensorBase>
......
...@@ -82,7 +82,7 @@ TEST(ProcessorTrackerFeatureTrifocal, KeyFrameCallback) ...@@ -82,7 +82,7 @@ TEST(ProcessorTrackerFeatureTrifocal, KeyFrameCallback)
intr); intr);
ProcessorParamsTrackerFeatureTrifocalPtr params_tracker_feature_trifocal = std::make_shared<ProcessorParamsTrackerFeatureTrifocal>(); ProcessorParamsTrackerFeatureTrifocalPtr params_tracker_feature_trifocal = std::make_shared<ProcessorParamsTrackerFeatureTrifocal>();
params_tracker_feature_trifocal->name = "trifocal"; // params_tracker_feature_trifocal->name = "trifocal";
params_tracker_feature_trifocal->pixel_noise_std = 1.0; params_tracker_feature_trifocal->pixel_noise_std = 1.0;
params_tracker_feature_trifocal->voting_active = true; params_tracker_feature_trifocal->voting_active = true;
params_tracker_feature_trifocal->min_features_for_keyframe = 5; params_tracker_feature_trifocal->min_features_for_keyframe = 5;
......
...@@ -26,18 +26,10 @@ static ProcessorParamsBasePtr createProcessorIMUParams(const std::string & _file ...@@ -26,18 +26,10 @@ static ProcessorParamsBasePtr createProcessorIMUParams(const std::string & _file
if (config["processor type"].as<std::string>() == "IMU") if (config["processor type"].as<std::string>() == "IMU")
{ {
// YAML:: to Eigen::
using namespace Eigen;
std::string processor_type = config["processor type"] .as<std::string>();
std::string processor_name = config["processor name"] .as<std::string>();
YAML::Node kf_vote = config["keyframe vote"]; YAML::Node kf_vote = config["keyframe vote"];
ProcessorParamsIMUPtr params = std::make_shared<ProcessorParamsIMU>(); ProcessorParamsIMUPtr params = std::make_shared<ProcessorParamsIMU>();
params->type = processor_type;
params->name = processor_name;
params->max_time_span = kf_vote["max time span"] .as<Scalar>(); params->max_time_span = kf_vote["max time span"] .as<Scalar>();
params->max_buff_length = kf_vote["max buffer length"] .as<SizeEigen >(); params->max_buff_length = kf_vote["max buffer length"] .as<SizeEigen >();
params->dist_traveled = kf_vote["dist traveled"] .as<Scalar>(); params->dist_traveled = kf_vote["dist traveled"] .as<Scalar>();
......
...@@ -26,18 +26,10 @@ static ProcessorParamsBasePtr createProcessorOdom3DParams(const std::string & _f ...@@ -26,18 +26,10 @@ static ProcessorParamsBasePtr createProcessorOdom3DParams(const std::string & _f
if (config["processor type"].as<std::string>() == "ODOM 3D") if (config["processor type"].as<std::string>() == "ODOM 3D")
{ {
// YAML:: to Eigen::
using namespace Eigen;
std::string processor_type = config["processor type"] .as<std::string>();
std::string processor_name = config["processor name"] .as<std::string>();
YAML::Node kf_vote = config["keyframe vote"]; YAML::Node kf_vote = config["keyframe vote"];
ProcessorParamsOdom3DPtr params = std::make_shared<ProcessorParamsOdom3D>(); ProcessorParamsOdom3DPtr params = std::make_shared<ProcessorParamsOdom3D>();
params->type = processor_type;
params->name = processor_name;
params->max_time_span = kf_vote["max time span"] .as<Scalar>(); params->max_time_span = kf_vote["max time span"] .as<Scalar>();
params->max_buff_length = kf_vote["max buffer length"] .as<SizeEigen >(); params->max_buff_length = kf_vote["max buffer length"] .as<SizeEigen >();
params->dist_traveled = kf_vote["dist traveled"] .as<Scalar>(); params->dist_traveled = kf_vote["dist traveled"] .as<Scalar>();
......
...@@ -34,9 +34,6 @@ static ProcessorParamsBasePtr createProcessorParamsTrackerFeatureTrifocal(const ...@@ -34,9 +34,6 @@ static ProcessorParamsBasePtr createProcessorParamsTrackerFeatureTrifocal(const
{ {
ProcessorParamsTrackerFeatureTrifocalPtr params = std::make_shared<ProcessorParamsTrackerFeatureTrifocal>(); ProcessorParamsTrackerFeatureTrifocalPtr params = std::make_shared<ProcessorParamsTrackerFeatureTrifocal>();
params->type = config["processor type"].as<std::string>();
params->name = config["processor name"].as<std::string>();
YAML::Node vision_utils = config ["vision_utils"]; YAML::Node vision_utils = config ["vision_utils"];
params->yaml_file_params_vision_utils = vision_utils["YAML file params"].as<std::string>(); params->yaml_file_params_vision_utils = vision_utils["YAML file params"].as<std::string>();
......
...@@ -27,23 +27,17 @@ static IntrinsicsBasePtr createIntrinsicsIMU(const std::string & _filename_dot_y ...@@ -27,23 +27,17 @@ static IntrinsicsBasePtr createIntrinsicsIMU(const std::string & _filename_dot_y
if (config["sensor type"].as<std::string>() == "IMU") if (config["sensor type"].as<std::string>() == "IMU")
{ {
YAML::Node variances = config["motion variances"];
// YAML:: to Eigen:: YAML::Node kf_vote = config["keyframe vote"];
using namespace Eigen;
std::string sensor_type = config["sensor type"] .as<std::string>();
std::string sensor_name = config["sensor name"] .as<std::string>();
YAML::Node variances = config["motion variances"];
YAML::Node kf_vote = config["keyframe vote"];
IntrinsicsIMUPtr params = std::make_shared<IntrinsicsIMU>(); IntrinsicsIMUPtr params = std::make_shared<IntrinsicsIMU>();
params->a_noise = variances["a_noise"] .as<Scalar>(); params->a_noise = variances["a_noise"] .as<Scalar>();
params->w_noise = variances["w_noise"] .as<Scalar>(); params->w_noise = variances["w_noise"] .as<Scalar>();
params->ab_initial_stdev = variances["ab_initial_stdev"] .as<Scalar>(); params->ab_initial_stdev = variances["ab_initial_stdev"] .as<Scalar>();
params->wb_initial_stdev = variances["wb_initial_stdev"] .as<Scalar>(); params->wb_initial_stdev = variances["wb_initial_stdev"] .as<Scalar>();
params->ab_rate_stdev = variances["ab_rate_stdev"] .as<Scalar>(); params->ab_rate_stdev = variances["ab_rate_stdev"] .as<Scalar>();
params->wb_rate_stdev = variances["wb_rate_stdev"] .as<Scalar>(); params->wb_rate_stdev = variances["wb_rate_stdev"] .as<Scalar>();
return params; return params;
} }
......
...@@ -24,13 +24,12 @@ static IntrinsicsBasePtr createIntrinsicsCamera(const std::string & _filename_do ...@@ -24,13 +24,12 @@ static IntrinsicsBasePtr createIntrinsicsCamera(const std::string & _filename_do
{ {
YAML::Node camera_config = YAML::LoadFile(_filename_dot_yaml); YAML::Node camera_config = YAML::LoadFile(_filename_dot_yaml);
if ("CAMERA") //camera_config["sensor type"]) // if (camera_config["sensor type"].as<std::string>() == "CAMERA") // this does not work: camera YAML files are ROS-styled
if (camera_config["camera_matrix"]) // check that at least this field exists to validate YAML file of the correct type
{ {
// YAML:: to Eigen:: // YAML:: to Eigen::
using namespace Eigen; using namespace Eigen;
std::string sensor_type = "CAMERA"; //camera_config["sensor type"] .as<std::string>();
std::string sensor_name = camera_config["camera_name"] .as<std::string>();
unsigned int width = camera_config["image_width"] .as<unsigned int>(); unsigned int width = camera_config["image_width"] .as<unsigned int>();
unsigned int height = camera_config["image_height"] .as<unsigned int>(); unsigned int height = camera_config["image_height"] .as<unsigned int>();
VectorXd intrinsic = camera_config["camera_matrix"]["data"] .as<VectorXd>(); VectorXd intrinsic = camera_config["camera_matrix"]["data"] .as<VectorXd>();
...@@ -38,8 +37,6 @@ static IntrinsicsBasePtr createIntrinsicsCamera(const std::string & _filename_do ...@@ -38,8 +37,6 @@ static IntrinsicsBasePtr createIntrinsicsCamera(const std::string & _filename_do
// Eigen:: to wolf:: // Eigen:: to wolf::
std::shared_ptr<IntrinsicsCamera> intrinsics_cam = std::make_shared<IntrinsicsCamera>(); std::shared_ptr<IntrinsicsCamera> intrinsics_cam = std::make_shared<IntrinsicsCamera>();
intrinsics_cam->type = sensor_type;
intrinsics_cam->name = sensor_name;
intrinsics_cam->pinhole_model[0] = intrinsic[2]; intrinsics_cam->pinhole_model[0] = intrinsic[2];
intrinsics_cam->pinhole_model[1] = intrinsic[5]; intrinsics_cam->pinhole_model[1] = intrinsic[5];
intrinsics_cam->pinhole_model[2] = intrinsic[0]; intrinsics_cam->pinhole_model[2] = intrinsic[0];
...@@ -87,7 +84,7 @@ static IntrinsicsBasePtr createIntrinsicsCamera(const std::string & _filename_do ...@@ -87,7 +84,7 @@ static IntrinsicsBasePtr createIntrinsicsCamera(const std::string & _filename_do
return intrinsics_cam; return intrinsics_cam;
} }
std::cout << "Bad configuration file. No sensor type found." << std::endl; std::cout << "Bad configuration file. No or bad sensor type found." << std::endl;
return nullptr; return nullptr;
} }
......
...@@ -23,9 +23,9 @@ namespace { ...@@ -23,9 +23,9 @@ namespace {
// intrinsics creator // intrinsics creator
IntrinsicsBasePtr createIntrinsicsLaser2D(const std::string& _filename_dot_yaml) IntrinsicsBasePtr createIntrinsicsLaser2D(const std::string& _filename_dot_yaml)
{ {
// TODO: Parse YAML <-- maybe we want this out of this file? // If required: Parse YAML
IntrinsicsLaser2DPtr params; // dummy IntrinsicsLaser2DPtr params; // dummy
params->type = "LASER 2D"; // fill this one just for the fun of it
return params; return params;
} }
......
...@@ -26,14 +26,7 @@ static IntrinsicsBasePtr createIntrinsicsOdom3D(const std::string & _filename_do ...@@ -26,14 +26,7 @@ static IntrinsicsBasePtr createIntrinsicsOdom3D(const std::string & _filename_do
if (config["sensor type"].as<std::string>() == "ODOM 3D") if (config["sensor type"].as<std::string>() == "ODOM 3D")
{ {
// YAML:: to Eigen::
using namespace Eigen;
std::string sensor_type = config["sensor type"] .as<std::string>();
std::string sensor_name = config["sensor name"] .as<std::string>();
YAML::Node variances = config["motion variances"]; YAML::Node variances = config["motion variances"];
YAML::Node kf_vote = config["keyframe vote"];
IntrinsicsOdom3DPtr params = std::make_shared<IntrinsicsOdom3D>(); IntrinsicsOdom3DPtr params = std::make_shared<IntrinsicsOdom3D>();
......
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