diff --git a/demos/processor_odom_3D.yaml b/demos/processor_odom_3D.yaml index 8ea2d9176f080016b7145728a4f62eb8df82ae15..89e9d00f268fd341368f1c4063e4685985072750 100644 --- a/demos/processor_odom_3D.yaml +++ b/demos/processor_odom_3D.yaml @@ -3,10 +3,11 @@ type: "ODOM 3D" # This must match the KEY used in the SensorFactory time_tolerance: 0.01 # seconds unmeasured_perturbation_std: 0.001 -voting_active: false -voting_aux_active: false -max_time_span: 0.2 # seconds -max_buff_length: 10 # motion deltas -dist_traveled: 0.5 # meters -angle_turned: 0.1 # radians (1 rad approx 57 deg, approx 60 deg) +keyframe_vote: + voting_active: false + voting_aux_active: false + max_time_span: 0.2 # seconds + max_buff_length: 10 # motion deltas + dist_traveled: 0.5 # meters + angle_turned: 0.1 # radians (1 rad approx 57 deg, approx 60 deg) diff --git a/include/core/processor/processor_base.h b/include/core/processor/processor_base.h index fdbd88974f34df0326e16808c5b82378dfa73249..8a3cbd5d13e6db8fb60c053e40cbded040e18279 100644 --- a/include/core/processor/processor_base.h +++ b/include/core/processor/processor_base.h @@ -216,9 +216,9 @@ struct ProcessorParamsBase : public ParamsBase ProcessorParamsBase(std::string _unique_name, const ParamsServer& _server): ParamsBase(_unique_name, _server) { - voting_active = _server.getParam<bool>(_unique_name + "/voting_active"); - voting_aux_active = _server.getParam<bool>(_unique_name + "/voting_aux_active"); - time_tolerance = _server.getParam<Scalar>(_unique_name + "/time_tolerance"); + time_tolerance = _server.getParam<Scalar>(_unique_name + "/time_tolerance"); + voting_active = _server.getParam<bool>(_unique_name + "/keyframe_vote/voting_active"); + voting_aux_active = _server.getParam<bool>(_unique_name + "/keyframe_vote/voting_aux_active"); } virtual ~ProcessorParamsBase() = default; diff --git a/include/core/processor/processor_motion.h b/include/core/processor/processor_motion.h index 6a96be5ef0c13a299e687bafb77bf38fbd48ede1..03c9f4308a2d0d1b6bba6ca0e722478a8d850e73 100644 --- a/include/core/processor/processor_motion.h +++ b/include/core/processor/processor_motion.h @@ -34,19 +34,19 @@ struct ProcessorParamsMotion : public ProcessorParamsBase ProcessorParamsMotion(std::string _unique_name, const ParamsServer& _server): ProcessorParamsBase(_unique_name, _server) { - max_time_span = _server.getParam<Scalar>(_unique_name + "/max_time_span"); - max_buff_length = _server.getParam<unsigned int>(_unique_name + "/max_buff_length"); - dist_traveled = _server.getParam<Scalar>(_unique_name + "/dist_traveled"); - angle_turned = _server.getParam<Scalar>(_unique_name + "/angle_turned"); + max_time_span = _server.getParam<Scalar>(_unique_name + "/keyframe_vote/max_time_span"); + max_buff_length = _server.getParam<unsigned int>(_unique_name + "/keyframe_vote/max_buff_length"); + dist_traveled = _server.getParam<Scalar>(_unique_name + "/keyframe_vote/dist_traveled"); + angle_turned = _server.getParam<Scalar>(_unique_name + "/keyframe_vote/angle_turned"); unmeasured_perturbation_std = _server.getParam<Scalar>(_unique_name + "/unmeasured_perturbation_std"); } 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" + + "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"; } diff --git a/src/yaml/processor_odom_3D_yaml.cpp b/src/yaml/processor_odom_3D_yaml.cpp index 6b6f53a64d655f77127ddf398add56246b2a55ed..f9f939553af76223416385f11785fe2ee694e70d 100644 --- a/src/yaml/processor_odom_3D_yaml.cpp +++ b/src/yaml/processor_odom_3D_yaml.cpp @@ -28,14 +28,17 @@ static ProcessorParamsBasePtr createProcessorOdom3DParams(const std::string & _f { ProcessorParamsOdom3DPtr params = std::make_shared<ProcessorParamsOdom3D>(); - params->voting_active = config["voting_active"] .as<bool>(); - params->voting_aux_active = config["voting_aux_active"] .as<bool>(); - params->time_tolerance = config["time_tolerance"] .as<Scalar>(); - params->max_time_span = config["max_time_span"] .as<Scalar>(); - params->max_buff_length = config["max_buff_length"] .as<SizeEigen >(); - params->dist_traveled = config["dist_traveled"] .as<Scalar>(); - params->angle_turned = config["angle_turned"] .as<Scalar>(); - params->unmeasured_perturbation_std = config["unmeasured_perturbation_std"].as<Scalar>(); + params->time_tolerance = config["time_tolerance"] .as<Scalar>(); + params->unmeasured_perturbation_std = config["unmeasured_perturbation_std"] .as<Scalar>(); + + YAML::Node keyframe_vote = config["keyframe_vote"]; + + params->voting_active = keyframe_vote["voting_active"] .as<bool>(); + params->voting_aux_active = keyframe_vote["voting_aux_active"].as<bool>(); + params->max_time_span = keyframe_vote["max_time_span"] .as<Scalar>(); + params->max_buff_length = keyframe_vote["max_buff_length"] .as<SizeEigen>(); + params->dist_traveled = keyframe_vote["dist_traveled"] .as<Scalar>(); + params->angle_turned = keyframe_vote["angle_turned"] .as<Scalar>(); return params; } diff --git a/test/gtest_parser_yaml.cpp b/test/gtest_parser_yaml.cpp index a61d6d4f121c2c470991eb2c5016ad59e2254bca..7d155a86f70e66ae8d6f869f54eadc9b63fb68bf 100644 --- a/test/gtest_parser_yaml.cpp +++ b/test/gtest_parser_yaml.cpp @@ -44,8 +44,8 @@ TEST(ParserYAML, FollowOdom3D) { auto parser = parse("test/yaml/params1.yaml", wolf_root); auto params = parser.getParams(); - EXPECT_EQ(params["my_proc_odom3d/max_buff_length"], "10"); - EXPECT_EQ(params["my_proc_odom3d/max_time_span"], "0.2"); + EXPECT_EQ(params["my_proc_odom3d/keyframe_vote/max_buff_length"], "10"); + EXPECT_EQ(params["my_proc_odom3d/keyframe_vote/max_time_span"], "0.2"); } TEST(ParserYAML, JumpFile) { diff --git a/test/yaml/processor_odom_3D.yaml b/test/yaml/processor_odom_3D.yaml index 5e94beeb249767881487f323bf84ff128e4eba20..a43fb60198d51944566308f3f06b0b6f33cee8bf 100644 --- a/test/yaml/processor_odom_3D.yaml +++ b/test/yaml/processor_odom_3D.yaml @@ -2,10 +2,12 @@ type: "ODOM 3D" # This must match the KEY used in the SensorFactory time_tolerance: 0.01 # seconds -voting_active: false -voting_aux_active: false -max_time_span: 0.2 # seconds -max_buff_length: 10 # motion deltas -dist_traveled: 0.5 # meters -angle_turned: 0.1 # radians (1 rad approx 57 deg, approx 60 deg) +keyframe_vote: + voting_active: false + voting_aux_active: false + max_time_span: 0.2 # seconds + max_buff_length: 10 # motion deltas + dist_traveled: 0.5 # meters + angle_turned: 0.1 # radians (1 rad approx 57 deg, approx 60 deg) + unmeasured_perturbation_std: 0.001 \ No newline at end of file