From d1ef0cef5b29c0da884442158c610b3c50bebdb8 Mon Sep 17 00:00:00 2001 From: pepms <jmarti@iri.upc.edu> Date: Wed, 9 Apr 2025 15:34:15 +0200 Subject: [PATCH] sensor_name now in ProcessorBase.schema --- schema/problem/Problem.schema | 2 +- schema/processor/ProcessorBase.schema | 5 +++++ schema/processor/ProcessorBaseWithSensor.schema | 6 ------ src/problem/problem.cpp | 6 +++--- test/yaml/processor_diff_drive.yaml | 1 + test/yaml/processor_fixed_wing_model.yaml | 1 + test/yaml/processor_landmark_external.yaml | 1 + test/yaml/processor_loop_closure_dummy.yaml | 1 + test/yaml/processor_motion_provider_dummy1.yaml | 1 + test/yaml/processor_motion_provider_dummy2.yaml | 1 + test/yaml/processor_motion_provider_dummy3.yaml | 1 + test/yaml/processor_odom_2d.yaml | 1 + test/yaml/processor_odom_2d_inactive.yaml | 1 + test/yaml/processor_odom_3d.yaml | 1 + test/yaml/processor_odom_3d_inactive.yaml | 1 + test/yaml/processor_pose_3d.yaml | 1 + test/yaml/processor_tracker_feature_dummy.yaml | 2 ++ test/yaml/processor_tracker_landmark_dummy.yaml | 2 ++ test/yaml/processor_tracker_two_processors_1.yaml | 2 ++ test/yaml/processor_tracker_two_processors_2.yaml | 2 ++ 20 files changed, 29 insertions(+), 10 deletions(-) delete mode 100644 schema/processor/ProcessorBaseWithSensor.schema diff --git a/schema/problem/Problem.schema b/schema/problem/Problem.schema index 71d7f9b69..aeec0a341 100644 --- a/schema/problem/Problem.schema +++ b/schema/problem/Problem.schema @@ -24,6 +24,6 @@ sensors: _doc: A sequence of all the sensors. processors: _type: derived[] - _base: ProcessorBaseWithSensor.schema + _base: ProcessorBase.schema _mandatory: true _doc: A sequence of all the processors. diff --git a/schema/processor/ProcessorBase.schema b/schema/processor/ProcessorBase.schema index 51f801a8d..e443f0c5b 100644 --- a/schema/processor/ProcessorBase.schema +++ b/schema/processor/ProcessorBase.schema @@ -5,6 +5,11 @@ name: _type: string _doc: The processor's name. It has to be unique. +sensor_name: + _mandatory: true + _type: string + _doc: The name of the sensor corresponding to this processor. + time_tolerance: _mandatory: true _type: double diff --git a/schema/processor/ProcessorBaseWithSensor.schema b/schema/processor/ProcessorBaseWithSensor.schema deleted file mode 100644 index 41f0c1346..000000000 --- a/schema/processor/ProcessorBaseWithSensor.schema +++ /dev/null @@ -1,6 +0,0 @@ -follow: ProcessorBase.schema - -sensor_name: - _mandatory: true - _type: string - _doc: The name of the sensor corresponding to this processor. \ No newline at end of file diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index c138baaea..965a0aa50 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -285,11 +285,11 @@ ProcessorBasePtr Problem::installProcessor(const YAML::Node& _processor_node, st // Add the installed schema folders after optional input _schema_folders FolderRegistry::appendRegisteredFolders(_schema_folders); - // Validate against ProcessorBaseWithSensor (check if it has 'type' and 'plugin') + // Validate against ProcessorBase (check if it has 'type' and 'plugin') // NOTE: Validation with the correponding schema is done in the creator auto server = yaml_schema_cpp::YamlServer(_schema_folders); server.setYaml(_processor_node); - if (not server.applySchema("ProcessorBaseWithSensor")) + if (not server.applySchema("ProcessorBase")) { WOLF_ERROR(server.getLog()); throw std::runtime_error("Processor could not be created!"); @@ -399,7 +399,7 @@ ProcessorBasePtr Problem::installProcessor(const std::string& _params_yaml // Validate against ProcessorBase and derived type // NOTE: Validation with the correponding schema is done in the creator - if (not server.applySchema("ProcessorBaseWithSensor")) + if (not server.applySchema("ProcessorBase")) { WOLF_ERROR(server.getLog()); throw std::runtime_error("Processor could not be created."); diff --git a/test/yaml/processor_diff_drive.yaml b/test/yaml/processor_diff_drive.yaml index e4eff792b..303839615 100644 --- a/test/yaml/processor_diff_drive.yaml +++ b/test/yaml/processor_diff_drive.yaml @@ -2,6 +2,7 @@ name: "a cool processor diff drive" type: ProcessorDiffDrive plugin: core +sensor_name: whatever time_tolerance: 0.5 # seconds diff --git a/test/yaml/processor_fixed_wing_model.yaml b/test/yaml/processor_fixed_wing_model.yaml index 6a5b36e86..4968ab03b 100644 --- a/test/yaml/processor_fixed_wing_model.yaml +++ b/test/yaml/processor_fixed_wing_model.yaml @@ -1,6 +1,7 @@ name: a cool processor for a fixed wing drone type: ProcessorFixedWingModel plugin: core +sensor_name: whatever time_tolerance: 0.01 # seconds diff --git a/test/yaml/processor_landmark_external.yaml b/test/yaml/processor_landmark_external.yaml index c97236f5a..b70dcc32f 100644 --- a/test/yaml/processor_landmark_external.yaml +++ b/test/yaml/processor_landmark_external.yaml @@ -1,6 +1,7 @@ name: cool dummy processor type: ProcessorLandmarkExternal plugin: core +sensor_name: whatever keyframe_vote: voting_active: true diff --git a/test/yaml/processor_loop_closure_dummy.yaml b/test/yaml/processor_loop_closure_dummy.yaml index 97064c355..034c8d78e 100644 --- a/test/yaml/processor_loop_closure_dummy.yaml +++ b/test/yaml/processor_loop_closure_dummy.yaml @@ -1,6 +1,7 @@ name: a cool processor loop closure type: ProcessorLoopClosureDummy plugin: core +sensor_name: whatever time_tolerance: 0.5 # seconds apply_loss_function: false diff --git a/test/yaml/processor_motion_provider_dummy1.yaml b/test/yaml/processor_motion_provider_dummy1.yaml index 8d1ba78b0..5dd618ce3 100644 --- a/test/yaml/processor_motion_provider_dummy1.yaml +++ b/test/yaml/processor_motion_provider_dummy1.yaml @@ -2,6 +2,7 @@ name: "not getter processor" type: ProcessorMotionProviderDummy plugin: core +sensor_name: whatever time_tolerance: 0.5 # seconds diff --git a/test/yaml/processor_motion_provider_dummy2.yaml b/test/yaml/processor_motion_provider_dummy2.yaml index 43605186b..89a43d702 100644 --- a/test/yaml/processor_motion_provider_dummy2.yaml +++ b/test/yaml/processor_motion_provider_dummy2.yaml @@ -2,6 +2,7 @@ name: "getter processor" type: ProcessorMotionProviderDummy plugin: core +sensor_name: whatever time_tolerance: 0.5 # seconds diff --git a/test/yaml/processor_motion_provider_dummy3.yaml b/test/yaml/processor_motion_provider_dummy3.yaml index 3414e1820..79904604d 100644 --- a/test/yaml/processor_motion_provider_dummy3.yaml +++ b/test/yaml/processor_motion_provider_dummy3.yaml @@ -2,6 +2,7 @@ name: "getter processor lower priority" type: ProcessorMotionProviderDummyPOV plugin: core +sensor_name: whatever time_tolerance: 0.5 # seconds diff --git a/test/yaml/processor_odom_2d.yaml b/test/yaml/processor_odom_2d.yaml index bdd02893d..5d747b7bb 100644 --- a/test/yaml/processor_odom_2d.yaml +++ b/test/yaml/processor_odom_2d.yaml @@ -2,6 +2,7 @@ name: "a cool processor odom 2d" type: ProcessorOdom2d plugin: core +sensor_name: sensor_odom time_tolerance: 0.005 # seconds diff --git a/test/yaml/processor_odom_2d_inactive.yaml b/test/yaml/processor_odom_2d_inactive.yaml index 2864aef8e..b75bd8909 100644 --- a/test/yaml/processor_odom_2d_inactive.yaml +++ b/test/yaml/processor_odom_2d_inactive.yaml @@ -2,6 +2,7 @@ name: "a cool processor odom 2d" type: ProcessorOdom2d plugin: core +sensor_name: whatever time_tolerance: 0.005 # seconds diff --git a/test/yaml/processor_odom_3d.yaml b/test/yaml/processor_odom_3d.yaml index 3653c5af7..2dd89e99b 100644 --- a/test/yaml/processor_odom_3d.yaml +++ b/test/yaml/processor_odom_3d.yaml @@ -2,6 +2,7 @@ name: a cool processor odom 3d type: ProcessorOdom3d plugin: core +sensor_name: whatever time_tolerance: 0.01 # seconds diff --git a/test/yaml/processor_odom_3d_inactive.yaml b/test/yaml/processor_odom_3d_inactive.yaml index e5c846447..0693a23d0 100644 --- a/test/yaml/processor_odom_3d_inactive.yaml +++ b/test/yaml/processor_odom_3d_inactive.yaml @@ -2,6 +2,7 @@ name: a cool processor odom 3d type: ProcessorOdom3d plugin: core +sensor_name: whatever time_tolerance: 0.01 # seconds diff --git a/test/yaml/processor_pose_3d.yaml b/test/yaml/processor_pose_3d.yaml index d319bbaa3..dc98db13e 100644 --- a/test/yaml/processor_pose_3d.yaml +++ b/test/yaml/processor_pose_3d.yaml @@ -2,6 +2,7 @@ name: a cool processor pose 3d type: ProcessorPose3d plugin: core +sensor_name: whatever time_tolerance: 0.01 # seconds diff --git a/test/yaml/processor_tracker_feature_dummy.yaml b/test/yaml/processor_tracker_feature_dummy.yaml index ed268cb6d..4139a42cd 100644 --- a/test/yaml/processor_tracker_feature_dummy.yaml +++ b/test/yaml/processor_tracker_feature_dummy.yaml @@ -1,6 +1,8 @@ name: cool dummy processor type: ProcessorTrackerFeatureDummy plugin: core +sensor_name: whatever + time_tolerance: 0.25 keyframe_vote: voting_active: true diff --git a/test/yaml/processor_tracker_landmark_dummy.yaml b/test/yaml/processor_tracker_landmark_dummy.yaml index 38af26730..95a8ab17e 100644 --- a/test/yaml/processor_tracker_landmark_dummy.yaml +++ b/test/yaml/processor_tracker_landmark_dummy.yaml @@ -1,6 +1,8 @@ name: cool dummy processor type: ProcessorTrackerLandmarkDummy plugin: core +sensor_name: whatever + time_tolerance: 0.25 keyframe_vote: voting_active: true diff --git a/test/yaml/processor_tracker_two_processors_1.yaml b/test/yaml/processor_tracker_two_processors_1.yaml index 1b71975c9..20b3c0257 100644 --- a/test/yaml/processor_tracker_two_processors_1.yaml +++ b/test/yaml/processor_tracker_two_processors_1.yaml @@ -1,6 +1,8 @@ name: processor_1 type: ProcessorTrackerFeatureDummy plugin: core +sensor_name: whatever + time_tolerance: 0.5 keyframe_vote: voting_active: true diff --git a/test/yaml/processor_tracker_two_processors_2.yaml b/test/yaml/processor_tracker_two_processors_2.yaml index ef69a2eb0..b2ad07b9c 100644 --- a/test/yaml/processor_tracker_two_processors_2.yaml +++ b/test/yaml/processor_tracker_two_processors_2.yaml @@ -1,6 +1,8 @@ name: processor_2 type: ProcessorTrackerFeatureDummy plugin: core +sensor_name: whatever + time_tolerance: 0.5 keyframe_vote: voting_active: true -- GitLab