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

YAML with underscores and not spaces

parent 89ff6973
No related branches found
No related tags found
2 merge requests!312Adress 244: Do not use default yaml params,!305WIP: Resolve "Do not use default YAML params"
config: config:
problem: problem:
frame structure: "PO" frame_structure: "PO"
dimension: 2 dimension: 2
prior timestamp: 0.0 prior:
prior state: [0,0,0] timestamp: 0.0
prior cov: [[3,3],.01,0,0,0,.01,0,0,0,.01] state: [0,0,0]
prior time tolerance: 0.1 cov: [[3,3],.01,0,0,0,.01,0,0,0,.01]
time_tolerance: 0.1
sensors: sensors:
- -
type: "ODOM 2D" type: "ODOM 2D"
name: "odom" name: "odom"
k_disp_to_disp: 0.1
k_rot_to_rot: 0.1
extrinsic:
pose: [0,0,0]
- -
type: "RANGE BEARING" type: "RANGE BEARING"
name: "rb" name: "rb"
noise range metres std: 0.1 noise_range_metres_std: 0.1
noise bearing degrees std: 0.5 noise_bearing_degrees_std: 0.5
processors: processors:
- -
type: "ODOM 2D" type: "ODOM 2D"
name: "odom" name: "odom"
sensor name: "odom" sensor_name: "odom"
voting active: true voting_active: true
time tolerance: 0.1 voting_aux_active: false
max time span: 999 time_tolerance: 0.1
max_time_span: 999
dist_traveled: 0.95 dist_traveled: 0.95
angle_turned: 999 angle_turned: 999
cov_det: 999 max_buff_length: 999
unmeasured_perturbation_std: 0.001 unmeasured_perturbation_std: 0.001
cov_det: 999
- -
type: "RANGE BEARING" type: "RANGE BEARING"
name: "rb" name: "rb"
sensor name: "rb" sensor_name: "rb"
voting_active: false
voting_aux_active: false
time_tolerance: 0.1
files: files:
# - "/Users/jsola/dev/wolf_lib/core/lib/libhellowolf.dylib" # - "/Users/jsola/dev/wolf lib/core/lib/libhellowolf.dylib"
\ No newline at end of file
...@@ -297,7 +297,7 @@ void ParserYAML::parseFirstLevel(std::string file){ ...@@ -297,7 +297,7 @@ void ParserYAML::parseFirstLevel(std::string file){
_paramsSens.push_back(pSensor); _paramsSens.push_back(pSensor);
} }
for(const auto& kv : n_config["processors"]){ for(const auto& kv : n_config["processors"]){
ParamsInitProcessor pProc = {kv["type"].Scalar(), kv["name"].Scalar(), kv["sensor name"].Scalar(), kv}; ParamsInitProcessor pProc = {kv["type"].Scalar(), kv["name"].Scalar(), kv["sensor_name"].Scalar(), kv};
_paramsProc.push_back(pProc); _paramsProc.push_back(pProc);
} }
for(const auto& kv : n_config["callbacks"]){ for(const auto& kv : n_config["callbacks"]){
......
...@@ -107,10 +107,10 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server) ...@@ -107,10 +107,10 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server)
} }
// Prior // Prior
Eigen::VectorXs prior_state = _server.getParam<Eigen::VectorXs>("problem/prior state"); Eigen::VectorXs prior_state = _server.getParam<Eigen::VectorXs>("problem/prior/state");
Eigen::MatrixXs prior_cov = _server.getParam<Eigen::MatrixXs>("problem/prior cov"); Eigen::MatrixXs prior_cov = _server.getParam<Eigen::MatrixXs>("problem/prior/cov");
Scalar prior_time_tolerance = _server.getParam<Scalar>("problem/prior time tolerance"); Scalar prior_time_tolerance = _server.getParam<Scalar>("problem/prior/time_tolerance");
Scalar prior_ts = _server.getParam<Scalar>("problem/prior timestamp"); Scalar prior_ts = _server.getParam<Scalar>("problem/prior/timestamp");
WOLF_TRACE("prior timestamp:\n" , prior_ts); WOLF_TRACE("prior timestamp:\n" , prior_ts);
WOLF_TRACE("prior state:\n" , prior_state.transpose()); WOLF_TRACE("prior state:\n" , prior_state.transpose());
......
...@@ -22,7 +22,7 @@ TEST(ParserYAML, RegularParse) ...@@ -22,7 +22,7 @@ TEST(ParserYAML, RegularParse)
// for(auto it : params) // for(auto it : params)
// cout << it.first << " %% " << it.second << endl; // cout << it.first << " %% " << it.second << endl;
EXPECT_EQ(params["odom/intrinsic/k_rot_to_rot"], "0.1"); EXPECT_EQ(params["odom/intrinsic/k_rot_to_rot"], "0.1");
EXPECT_EQ(params["processor1/sensor name"], "odom"); EXPECT_EQ(params["processor1/sensor_name"], "odom");
} }
TEST(ParserYAML, ParseMap) TEST(ParserYAML, ParseMap)
{ {
...@@ -34,14 +34,14 @@ TEST(ParserYAML, JumpFile) ...@@ -34,14 +34,14 @@ TEST(ParserYAML, JumpFile)
{ {
auto parser = parse("test/yaml/params3.yaml", wolf_root); auto parser = parse("test/yaml/params3.yaml", wolf_root);
auto params = parser.getParams(); auto params = parser.getParams();
EXPECT_EQ(params["my_proc_test/extern params/max_buff_length"], "100"); EXPECT_EQ(params["my_proc_test/extern_params/max_buff_length"], "100");
EXPECT_EQ(params["my_proc_test/extern params/voting_active"], "false"); EXPECT_EQ(params["my_proc_test/extern_params/voting_active"], "false");
} }
TEST(ParserYAML, ProblemConfig) TEST(ParserYAML, ProblemConfig)
{ {
auto parser = parse("test/yaml/params2.yaml", wolf_root); auto parser = parse("test/yaml/params2.yaml", wolf_root);
auto params = parser.getParams(); auto params = parser.getParams();
EXPECT_EQ(params["problem/frame structure"], "POV"); EXPECT_EQ(params["problem/frame_structure"], "POV");
EXPECT_EQ(params["problem/dimension"], "2"); EXPECT_EQ(params["problem/dimension"], "2");
} }
int main(int argc, char **argv) int main(int argc, char **argv)
......
config: config:
problem: problem:
frame structure: "POV" frame_structure: "POV"
dimension: 3 dimension: 3
sensors: sensors:
- -
...@@ -10,7 +10,7 @@ config: ...@@ -10,7 +10,7 @@ config:
k_disp_to_disp: 0.1 k_disp_to_disp: 0.1
k_rot_to_rot: 0.1 k_rot_to_rot: 0.1
extrinsic: extrinsic:
pos: [1,2,3] pose: [1,2,3]
- -
type: "RANGE BEARING" type: "RANGE BEARING"
name: "rb" name: "rb"
...@@ -18,15 +18,15 @@ config: ...@@ -18,15 +18,15 @@ config:
- -
type: "ODOM 2D" type: "ODOM 2D"
name: "processor1" name: "processor1"
sensor name: "odom" sensor_name: "odom"
- -
type: "RANGE BEARING" type: "RANGE BEARING"
name: "rb_processor" name: "rb_processor"
sensor name: "rb" sensor_name: "rb"
- -
type: "ODOM 2D" type: "ODOM 2D"
name: "my_proc_test" name: "my_proc_test"
sensor name: "odom" sensor_name: "odom"
follow: "test/yaml/params3.1.yaml" follow: "test/yaml/params3.1.yaml"
files: files:
- "/home/jcasals/workspace/wip/wolf/lib/libsensor_odo.so" - "/home/jcasals/workspace/wip/wolf/lib/libsensor_odo.so"
......
config: config:
problem: problem:
frame structure: "POV" frame_structure: "POV"
dimension: 2 dimension: 2
sensors: sensors:
- -
...@@ -10,7 +10,7 @@ config: ...@@ -10,7 +10,7 @@ config:
k_disp_to_disp: 0.1 k_disp_to_disp: 0.1
k_rot_to_rot: 0.1 k_rot_to_rot: 0.1
extrinsic: extrinsic:
pos: [1,2,3] pose: [1,2,3]
- -
type: "RANGE BEARING" type: "RANGE BEARING"
name: "rb" name: "rb"
...@@ -18,7 +18,7 @@ config: ...@@ -18,7 +18,7 @@ config:
- -
type: "ODOM 2D" type: "ODOM 2D"
name: "processor1" name: "processor1"
sensor name: "odom" sensor_name: "odom"
$mymap: $mymap:
k1: v1 k1: v1
k2: v2 k2: v2
...@@ -26,11 +26,11 @@ config: ...@@ -26,11 +26,11 @@ config:
- -
type: "RANGE BEARING" type: "RANGE BEARING"
name: "rb_processor" name: "rb_processor"
sensor name: "rb" sensor_name: "rb"
- -
type: "ODOM 2D" type: "ODOM 2D"
name: "my_proc_test" name: "my_proc_test"
sensor name: "odom" sensor_name: "odom"
files: files:
- "/home/jcasals/workspace/wip/wolf/lib/libsensor_odo.so" - "/home/jcasals/workspace/wip/wolf/lib/libsensor_odo.so"
- "/home/jcasals/workspace/wip/wolf/lib/librange_bearing.so" - "/home/jcasals/workspace/wip/wolf/lib/librange_bearing.so"
\ No newline at end of file
config: config:
# problem: # problem:
# frame structure: "POV" # frame_structure: "POV"
# dimension: 2 # dimension: 2
sensors: sensors:
- -
...@@ -10,10 +10,10 @@ config: ...@@ -10,10 +10,10 @@ config:
k_disp_to_disp: 0.1 k_disp_to_disp: 0.1
k_rot_to_rot: 0.1 k_rot_to_rot: 0.1
extrinsic: extrinsic:
pos: [1,2,3] pose: [1,2,3]
processors: processors:
- -
type: "ODOM 2D" type: "ODOM 2D"
name: "my_proc_test" name: "my_proc_test"
sensor name: "odom" sensor_name: "odom"
extern params: "@test/yaml/params3.1.yaml" extern_params: "@test/yaml/params3.1.yaml"
\ No newline at end of file \ No newline at end of file
time tolerance: 0.01 # seconds type: "ODOM 3D" # This must match the KEY used in the SensorFactory. Otherwise it is an error.
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)type: "ODOM 3D" # This must match the KEY used in the SensorFactory. Otherwise it is an error.
name: "Main odometer" # This is ignored. The name provided to the SensorFactory prevails 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
motion variances:
type: "ODOM 3D" # This must match the KEY used in the SensorFactory. Otherwise it is an error. type: "ODOM 3D" # This must match the KEY used in the SensorFactory. Otherwise it is an error.
name: "Main odometer" # This is ignored. The name provided to the SensorFactory prevails 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_disp: 0.02 # m^2 / m
disp_to_rot: 0.02 # rad^2 / m disp_to_rot: 0.02 # rad^2 / m
rot_to_rot: 0.01 # rad^2 / rad rot_to_rot: 0.01 # rad^2 / rad
......
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