diff --git a/include/core/yaml/parser_yaml.hpp b/include/core/yaml/parser_yaml.hpp index f93d882cb54837e1755e0bc0f127f01ce8d12ca7..07ac73ab3df0ec9c7a446864209770c7bb4df65b 100644 --- a/include/core/yaml/parser_yaml.hpp +++ b/include/core/yaml/parser_yaml.hpp @@ -180,7 +180,7 @@ void parserYAML::walkTreeR(YAML::Node n, vector<string>& tags, string hdr){ The following example shows how the header remains unafected: @my_main_config | @some_path - cov_det: 1 | - my_value : 23 - - follow: "some_path" | + - follow: "@some_path" | - var: 1.2 | Resulting map: cov_det -> 1 @@ -193,7 +193,7 @@ void parserYAML::walkTreeR(YAML::Node n, vector<string>& tags, string hdr){ Which would result from the following yaml files @my_main_config | @some_path - cov_det: 1 | - my_value : 23 - - $follow: "some_path" | + - $follow: "@some_path" | - var: 1.2 | */ regex rr("follow"); diff --git a/test/gtest_param_server.cpp b/test/gtest_param_server.cpp index ab349ceb38fc304d6ad581a157d98fe4de42d390..a24b07a7e01b8a37b17806fd89d25d10a5e8f22b 100644 --- a/test/gtest_param_server.cpp +++ b/test/gtest_param_server.cpp @@ -18,7 +18,7 @@ parserYAML parse(string _file, string _path_root) TEST(ParamsServer, Default) { - auto parser = parse("/test/params1.yaml", wolf_root); + auto parser = parse("/test/yaml/params1.yaml", wolf_root); auto params = parser.getParams(); paramsServer server = paramsServer(params, parser.sensorsSerialization(), parser.processorsSerialization()); EXPECT_EQ(server.getParam<double>("should_not_exist", "2.6"), 2.6); diff --git a/test/gtest_parser_yaml.cpp b/test/gtest_parser_yaml.cpp index 4af9e7760ef8d8d9b14fb6da4240852ee7919885..752c06fd29831bb29dcd550ed35cdc24bd76d3de 100644 --- a/test/gtest_parser_yaml.cpp +++ b/test/gtest_parser_yaml.cpp @@ -17,7 +17,7 @@ parserYAML parse(string _file, string _path_root) TEST(ParserYAML, RegularParse) { - auto parser = parse("/test/params1.yaml", wolf_root); + auto parser = parse("/test/yaml/params1.yaml", wolf_root); auto params = parser.getParams(); // for(auto it : params) // cout << it.first << " %% " << it.second << endl; @@ -26,13 +26,13 @@ TEST(ParserYAML, RegularParse) } TEST(ParserYAML, ParseMap) { - auto parser = parse("/test/params2.yaml", wolf_root); + auto parser = parse("/test/yaml/params2.yaml", wolf_root); auto params = parser.getParams(); EXPECT_EQ(params["processor1/mymap"], "[{k1:v1},{k2:v2},{k3:[v3,v4,v5]}]"); } TEST(ParserYAML, JumpFile) { - auto parser = parse("/test/params3.yaml", wolf_root); + auto parser = parse("/test/yaml/params3.yaml", wolf_root); auto params = parser.getParams(); EXPECT_EQ(params["my_proc_test/max_buff_length"], "100"); EXPECT_EQ(params["my_proc_test/jump/voting_active"], "false"); diff --git a/test/gtest_problem.cpp b/test/gtest_problem.cpp index 29f4f132dc646705cca3c633798a8785c2494fea..942e49086acba86cbd74101bd21ec1ec14195e66 100644 --- a/test/gtest_problem.cpp +++ b/test/gtest_problem.cpp @@ -111,7 +111,7 @@ TEST(Problem, Installers) ProblemPtr P = Problem::create("PO", 3); Eigen::Vector7s xs; - SensorBasePtr S = P->installSensor ("ODOM 3D", "odometer", xs, wolf_root + "/demos/sensor_odom_3D.yaml"); + SensorBasePtr S = P->installSensor ("ODOM 3D", "odometer", xs, wolf_root + "/test/yaml/sensor_odom_3D.yaml"); // install processor tracker (dummy installation under an Odometry sensor -- it's OK for this test) ProcessorParamsTrackerFeaturePtr params = std::make_shared<ProcessorParamsTrackerFeature>(); @@ -126,7 +126,7 @@ TEST(Problem, Installers) ASSERT_FALSE(P->getProcessorMotion()); // install processor motion - ProcessorBasePtr pm = P->installProcessor("ODOM 3D", "odom integrator", "odometer", wolf_root + "/demos/processor_odom_3D.yaml"); + ProcessorBasePtr pm = P->installProcessor("ODOM 3D", "odom integrator", "odometer", wolf_root + "/test/yaml/processor_odom_3D.yaml"); // check motion processor is set ASSERT_TRUE(P->getProcessorMotion()); @@ -243,7 +243,7 @@ TEST(Problem, StateBlocks) Eigen::Vector3s xs2d; // 2 state blocks, fixed - SensorBasePtr Sm = P->installSensor ("ODOM 3D", "odometer",xs3d, wolf_root + "/demos/sensor_odom_3D.yaml"); + SensorBasePtr Sm = P->installSensor ("ODOM 3D", "odometer",xs3d, wolf_root + "/test/yaml/sensor_odom_3D.yaml"); ASSERT_EQ(P->getStateBlockNotificationMapSize(), (SizeStd) 2); // 2 state blocks, fixed @@ -256,7 +256,7 @@ TEST(Problem, StateBlocks) params->min_features_for_keyframe = 10; auto pt = ProcessorBase::emplace<ProcessorTrackerFeatureDummy>(St, ProcessorTrackerFeatureDummy(params)); - ProcessorBasePtr pm = P->installProcessor("ODOM 3D", "odom integrator", "odometer", wolf_root + "/demos/processor_odom_3D.yaml"); + ProcessorBasePtr pm = P->installProcessor("ODOM 3D", "odom integrator", "odometer", wolf_root + "/test/yaml/processor_odom_3D.yaml"); // 2 state blocks, estimated auto KF = P->emplaceFrame("PO", 3, KEY, xs3d, 0); @@ -302,7 +302,7 @@ TEST(Problem, Covariances) Eigen::Vector7s xs3d; Eigen::Vector3s xs2d; - SensorBasePtr Sm = P->installSensor ("ODOM 3D", "odometer",xs3d, wolf_root + "/demos/sensor_odom_3D.yaml"); + SensorBasePtr Sm = P->installSensor ("ODOM 3D", "odometer",xs3d, wolf_root + "/test/yaml/sensor_odom_3D.yaml"); SensorBasePtr St = P->installSensor ("ODOM 2D", "other odometer", xs2d, ""); ProcessorParamsTrackerFeaturePtr params = std::make_shared<ProcessorParamsTrackerFeature>(); @@ -313,7 +313,7 @@ TEST(Problem, Covariances) auto pt = ProcessorBase::emplace<ProcessorTrackerFeatureDummy>(St, ProcessorTrackerFeatureDummy(params)); // St->addProcessor(pt); - ProcessorBasePtr pm = P->installProcessor("ODOM 3D", "odom integrator", "odometer", wolf_root + "/demos/processor_odom_3D.yaml"); + ProcessorBasePtr pm = P->installProcessor("ODOM 3D", "odom integrator", "odometer", wolf_root + "/test/yaml/processor_odom_3D.yaml"); // 4 state blocks, estimated St->unfixExtrinsics(); diff --git a/test/params1.yaml b/test/params1.yaml index 834984f6cc03f111dd446cca4e802603b81ae961..4ad74198329b61d86b023f17f9a7016224d5489a 100644 --- a/test/params1.yaml +++ b/test/params1.yaml @@ -1,30 +1 @@ -config: - sensors: - - - type: "ODOM 2D" - name: "odom" - intrinsic: - k_disp_to_disp: 0.1 - k_rot_to_rot: 0.1 - extrinsic: - pos: [1,2,3] - - - type: "RANGE BEARING" - name: "rb" - processors: - - - type: "ODOM 2D" - name: "processor1" - sensor name: "odom" - - - type: "RANGE BEARING" - name: "rb_processor" - sensor name: "rb" - - - type: "ODOM 2D" - name: "my_proc_test" - sensor name: "odom" - follow: "/test/params3.1.yaml" -files: - - "/home/jcasals/workspace/wip/wolf/lib/libsensor_odo.so" - - "/home/jcasals/workspace/wip/wolf/lib/librange_bearing.so" \ No newline at end of file + follow: "/test/yaml/params3.1.yaml" \ No newline at end of file diff --git a/test/params3.yaml b/test/params3.yaml index 3ee99dcc40a597e0b83a346aedd1e6c63fa52754..78489d218fad394f90364a1e1d758daa0270e7cd 100644 --- a/test/params3.yaml +++ b/test/params3.yaml @@ -1,31 +1 @@ -config: - sensors: - - - type: "ODOM 2D" - name: "odom" - intrinsic: - k_disp_to_disp: 0.1 - k_rot_to_rot: 0.1 - extrinsic: - pos: [1,2,3] - - - type: "RANGE BEARING" - name: "rb" - processors: - - - type: "ODOM 2D" - name: "processor1" - sensor name: "odom" - - - type: "RANGE BEARING" - name: "rb_processor" - sensor name: "rb" - - - type: "ODOM 2D" - name: "my_proc_test" - sensor name: "odom" - follow: "/test/params3.1.yaml" - jump: "@/test/params3.1.yaml" -files: - - "/home/jcasals/workspace/wip/wolf/lib/libsensor_odo.so" - - "/home/jcasals/workspace/wip/wolf/lib/librange_bearing.so" \ No newline at end of file + jump: "@/test/yaml/params3.1.yaml" \ No newline at end of file diff --git a/test/yaml/params1.yaml b/test/yaml/params1.yaml new file mode 100644 index 0000000000000000000000000000000000000000..940d3e5854a5ec612f5223251243e643c7bef79b --- /dev/null +++ b/test/yaml/params1.yaml @@ -0,0 +1,30 @@ +config: + sensors: + - + type: "ODOM 2D" + name: "odom" + intrinsic: + k_disp_to_disp: 0.1 + k_rot_to_rot: 0.1 + extrinsic: + pos: [1,2,3] + - + type: "RANGE BEARING" + name: "rb" + processors: + - + type: "ODOM 2D" + name: "processor1" + sensor name: "odom" + - + type: "RANGE BEARING" + name: "rb_processor" + sensor name: "rb" + - + type: "ODOM 2D" + name: "my_proc_test" + sensor name: "odom" + follow: "/test/yaml/params3.1.yaml" +files: + - "/home/jcasals/workspace/wip/wolf/lib/libsensor_odo.so" + - "/home/jcasals/workspace/wip/wolf/lib/librange_bearing.so" \ No newline at end of file diff --git a/test/params2.yaml b/test/yaml/params2.yaml similarity index 100% rename from test/params2.yaml rename to test/yaml/params2.yaml diff --git a/test/params3.1.yaml b/test/yaml/params3.1.yaml similarity index 100% rename from test/params3.1.yaml rename to test/yaml/params3.1.yaml diff --git a/test/yaml/params3.yaml b/test/yaml/params3.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ac82cf0dd818e6c6dec00c61ff86b75c38a3fc11 --- /dev/null +++ b/test/yaml/params3.yaml @@ -0,0 +1,31 @@ +config: + sensors: + - + type: "ODOM 2D" + name: "odom" + intrinsic: + k_disp_to_disp: 0.1 + k_rot_to_rot: 0.1 + extrinsic: + pos: [1,2,3] + - + type: "RANGE BEARING" + name: "rb" + processors: + - + type: "ODOM 2D" + name: "processor1" + sensor name: "odom" + - + type: "RANGE BEARING" + name: "rb_processor" + sensor name: "rb" + - + type: "ODOM 2D" + name: "my_proc_test" + sensor name: "odom" + follow: "/test/yaml/params3.1.yaml" + jump: "@/test/yaml/params3.1.yaml" +files: + - "/home/jcasals/workspace/wip/wolf/lib/libsensor_odo.so" + - "/home/jcasals/workspace/wip/wolf/lib/librange_bearing.so" \ No newline at end of file diff --git a/test/yaml/processor_odom_3D.yaml b/test/yaml/processor_odom_3D.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f501e333800ec1bbb4b7c751a32aa67a99bec74c --- /dev/null +++ b/test/yaml/processor_odom_3D.yaml @@ -0,0 +1,8 @@ +processor type: "ODOM 3D" # This must match the KEY used in the SensorFactory. Otherwise it is an error. +processor name: "Main odometer" # This is ignored. The name provided to the SensorFactory prevails +time tolerance: 0.01 # seconds +keyframe vote: + max time span: 0.2 # seconds + max buffer length: 10 # motion deltas + dist traveled: 0.5 # meters + angle turned: 0.1 # radians (1 rad approx 57 deg, approx 60 deg) \ No newline at end of file diff --git a/test/yaml/sensor_odom_3D.yaml b/test/yaml/sensor_odom_3D.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9ea77803548cfd9d033f54e40b6d92a72710afb8 --- /dev/null +++ b/test/yaml/sensor_odom_3D.yaml @@ -0,0 +1,8 @@ +sensor type: "ODOM 3D" # This must match the KEY used in the SensorFactory. Otherwise it is an error. +sensor name: "Main odometer" # This is ignored. The name provided to the SensorFactory prevails +motion variances: + disp_to_disp: 0.02 # m^2 / m + disp_to_rot: 0.02 # rad^2 / m + rot_to_rot: 0.01 # rad^2 / rad + min_disp_var: 0.01 # m^2 + min_rot_var: 0.01 # rad^2