From b37b0a961e074d39f1d1dd06d45dca631b1bde7d Mon Sep 17 00:00:00 2001 From: Joan Sola <jsola@iri.upc.edu> Date: Wed, 27 Apr 2022 22:06:04 +0200 Subject: [PATCH] Rename getSensor(sensor name) --> findSensor(sensor name) --- demos/hello_wolf/hello_wolf_autoconf.cpp | 4 ++-- include/core/problem/problem.h | 2 +- src/problem/problem.cpp | 6 +++--- test/gtest_tree_manager_sliding_window_dual_rate.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/demos/hello_wolf/hello_wolf_autoconf.cpp b/demos/hello_wolf/hello_wolf_autoconf.cpp index db934ca13..272142450 100644 --- a/demos/hello_wolf/hello_wolf_autoconf.cpp +++ b/demos/hello_wolf/hello_wolf_autoconf.cpp @@ -138,8 +138,8 @@ int main() SolverManagerPtr ceres = FactorySolver::create("SolverCeres", problem, server); // recover sensor pointers and other stuff for later use (access by sensor name) - SensorBasePtr sensor_odo = problem->getSensor("sen odom"); - SensorBasePtr sensor_rb = problem->getSensor("sen rb"); + SensorBasePtr sensor_odo = problem->findSensor("sen odom"); + SensorBasePtr sensor_rb = problem->findSensor("sen rb"); // APPLY PRIOR and SET PROCESSOR ODOM ORIGIN =================================================== TimeStamp t(0.0); diff --git a/include/core/problem/problem.h b/include/core/problem/problem.h index 7405ae832..d85a6503b 100644 --- a/include/core/problem/problem.h +++ b/include/core/problem/problem.h @@ -151,7 +151,7 @@ class Problem : public std::enable_shared_from_this<Problem> /** \brief get a sensor pointer by its name * \param _sensor_name The sensor name, as it was installed with installSensor() */ - SensorBasePtr getSensor(const std::string& _sensor_name) const; + SensorBasePtr findSensor(const std::string& _sensor_name) const; /** \brief Factory method to install (create, and add to sensor) processors only from its properties * diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index 1e5c88a2d..3c731dc3e 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -300,7 +300,7 @@ ProcessorBasePtr Problem::installProcessor(const std::string& _prc_type, // const std::string& _corresponding_sensor_name, // const std::string& _params_filename) { - SensorBasePtr sen_ptr = getSensor(_corresponding_sensor_name); + SensorBasePtr sen_ptr = findSensor(_corresponding_sensor_name); if (sen_ptr == nullptr) throw std::runtime_error("Cannot bind processor. Reason: Sensor \"" + _corresponding_sensor_name + "\" not found. Check sensor name, it must match in sensor and processor!"); if (_params_filename == "") @@ -318,7 +318,7 @@ ProcessorBasePtr Problem::installProcessor(const std::string& _prc_type, // const std::string& _corresponding_sensor_name, // const ParamsServer& _server) { - SensorBasePtr sen_ptr = getSensor(_corresponding_sensor_name); + SensorBasePtr sen_ptr = findSensor(_corresponding_sensor_name); if (sen_ptr == nullptr) throw std::runtime_error("Cannot bind processor. Reason: Sensor \"" + _corresponding_sensor_name + "\" not found. Check sensor name, it must match in sensor and processor!"); @@ -335,7 +335,7 @@ ProcessorBasePtr Problem::installProcessor(const std::string& _prc_type, // return prc_ptr; } -SensorBasePtr Problem::getSensor(const std::string& _sensor_name) const +SensorBasePtr Problem::findSensor(const std::string& _sensor_name) const { auto sen_it = std::find_if(getHardware()->getSensorList().begin(), getHardware()->getSensorList().end(), diff --git a/test/gtest_tree_manager_sliding_window_dual_rate.cpp b/test/gtest_tree_manager_sliding_window_dual_rate.cpp index e394a7c59..448fc0d93 100644 --- a/test/gtest_tree_manager_sliding_window_dual_rate.cpp +++ b/test/gtest_tree_manager_sliding_window_dual_rate.cpp @@ -1050,11 +1050,11 @@ TEST(TreeManagerSlidingWindowDualRate, slidingWindowWithProcessor) TimeStamp t(0.0); double dt = 1; CaptureMotionPtr capture = std::make_shared<CaptureOdom3d>(t, - problem->getSensor("odom"), + problem->findSensor("odom"), data, data_cov); CaptureMotionPtr capture_bl = std::make_shared<CaptureOdom3d>(t, - problem_bl->getSensor("odom"), + problem_bl->findSensor("odom"), data, data_cov); -- GitLab