From 744badcc44c85b95087967c07db6d2acdc65a73c Mon Sep 17 00:00:00 2001 From: joanvallve <jvallve@iri.upc.edu> Date: Mon, 8 Jul 2024 17:02:56 +0200 Subject: [PATCH] [skip ci] sensors do not have dimension compatible, only processors --- include/core/processor/processor_base.h | 4 ++-- include/core/sensor/sensor_base.h | 10 ---------- include/core/sensor/sensor_odom.h | 1 - include/core/sensor/sensor_pose.h | 1 - src/problem/problem.cpp | 8 -------- src/processor/processor_base.cpp | 2 +- src/sensor/sensor_diff_drive.cpp | 2 +- src/sensor/sensor_motion_model.cpp | 2 +- 8 files changed, 5 insertions(+), 25 deletions(-) diff --git a/include/core/processor/processor_base.h b/include/core/processor/processor_base.h index f52aa0dd8..991aecca3 100644 --- a/include/core/processor/processor_base.h +++ b/include/core/processor/processor_base.h @@ -150,10 +150,10 @@ class ProcessorBase : public NodeBase, public std::enable_shared_from_this<Proce * * \param _type TO BE HARDCODED IN THE DERIVED CLASS CONSTRUCTOR: type name * \param _dim_compatible TO BE HARDCODED IN THE DERIVED CLASS CONSTRUCTOR: - * Which dimension is the sensor compatible (2: 2D, 3: 3D, -1: both) + * Which dimension is the processor compatible (2: 2D, 3: 3D, 0: both) * \param _params params yaml node */ - ProcessorBase(const std::string& _type, int _dim_compatible, const YAML::Node& _params); + ProcessorBase(const std::string& _type, unsigned int _dim_compatible, const YAML::Node& _params); ~ProcessorBase() override; virtual void configure(SensorBasePtr _sensor) = 0; virtual void remove(); diff --git a/include/core/sensor/sensor_base.h b/include/core/sensor/sensor_base.h index 94c6ceef2..064c16aa2 100644 --- a/include/core/sensor/sensor_base.h +++ b/include/core/sensor/sensor_base.h @@ -129,22 +129,18 @@ class SensorBase : public NodeStateBlocks std::map<char, Eigen::VectorXd> drifts_std_rate_; ///< std rate of the drift of dynamic state blocks [unit/sqrt(s)] YAML::Node params_; ///< Params yaml node - unsigned int dim_compatible_; ///< Dimension compatibility of the sensor: 2: 2D, 3: 3D, 0: both void setProblem(ProblemPtr _problem) override final; /** \brief Constructor * * \param _type TO BE HARDCODED IN THE DERIVED CLASS CONSTRUCTOR: derived class name - * \param _dim_compatible TO BE HARDCODED IN THE DERIVED CLASS CONSTRUCTOR: Which dimension is the - * sensor compatible with (2: 2D, 3: 3D, -1: both) * \param _state_types TO BE HARDCODED IN THE DERIVED CLASS CONSTRUCTOR: Composite of keys and types of the states * of the sensor. * \param _params params yaml node * **/ SensorBase(const std::string& _type, - const int& _dim_compatible, const TypeComposite& _state_types, const YAML::Node& _params); @@ -152,7 +148,6 @@ class SensorBase : public NodeStateBlocks ~SensorBase() override; unsigned int id() const override; - unsigned int getDimCompatible() const; HardwareBaseConstPtr getHardware() const; HardwareBasePtr getHardware(); @@ -283,11 +278,6 @@ inline unsigned int SensorBase::id() const return sensor_id_; } -inline unsigned int SensorBase::getDimCompatible() const -{ - return dim_compatible_; -} - inline ProcessorBaseConstPtrList SensorBase::getProcessorList() const { ProcessorBaseConstPtrList list_const; diff --git a/include/core/sensor/sensor_odom.h b/include/core/sensor/sensor_odom.h index 78798fd3f..b1f35aa26 100644 --- a/include/core/sensor/sensor_odom.h +++ b/include/core/sensor/sensor_odom.h @@ -33,7 +33,6 @@ class SensorOdom : public SensorBase SensorOdom(const YAML::Node& _params) : SensorBase( "SensorOdom" + std::to_string(DIM) + "d", - DIM, {{'P', DIM == 2 ? "StatePoint2d" : "StatePoint3d"}, {'O', DIM == 2 ? "StateAngle" : "StateQuaternion"}}, _params) { diff --git a/include/core/sensor/sensor_pose.h b/include/core/sensor/sensor_pose.h index 043e0d281..0cee11fe8 100644 --- a/include/core/sensor/sensor_pose.h +++ b/include/core/sensor/sensor_pose.h @@ -33,7 +33,6 @@ class SensorPose : public SensorBase SensorPose(const YAML::Node& _params) : SensorBase( "SensorPose" + std::to_string(DIM) + "d", - DIM, {{'P', DIM == 2 ? "StatePoint2d" : "StatePoint3d"}, {'O', DIM == 2 ? "StateAngle" : "StateQuaternion"}}, _params) { diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index 457efea29..766edef8f 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -211,10 +211,6 @@ SensorBasePtr Problem::installSensor(const YAML::Node& _sensor_node, std::vector if (not sen_ptr) throw std::runtime_error("Sensor could not be created."); - // Dimension check - if (sen_ptr->getDimCompatible() != 0 and sen_ptr->getDimCompatible() != this->getDim()) - throw std::runtime_error("Sensor not compatible with the Problem dimension."); - // Link sen_ptr->link(getHardware()); return sen_ptr; @@ -256,10 +252,6 @@ SensorBasePtr Problem::installSensor(const std::string& _params_yaml_filen if (not sen_ptr) throw std::runtime_error("Sensor could not be created."); - // Dimension check - if (sen_ptr->getDimCompatible() != 0 and sen_ptr->getDimCompatible() != this->getDim()) - throw std::runtime_error("Sensor not compatible with the Problem dimension."); - // Link sen_ptr->link(getHardware()); diff --git a/src/processor/processor_base.cpp b/src/processor/processor_base.cpp index d41616968..dcfe946e5 100644 --- a/src/processor/processor_base.cpp +++ b/src/processor/processor_base.cpp @@ -27,7 +27,7 @@ namespace wolf { unsigned int ProcessorBase::processor_id_count_ = 0; -ProcessorBase::ProcessorBase(const std::string& _type, int _dim_compatible, const YAML::Node& _params) +ProcessorBase::ProcessorBase(const std::string& _type, unsigned int _dim_compatible, const YAML::Node& _params) : NodeBase("PROCESSOR", _type, _params["name"].as<std::string>()), processor_id_(++processor_id_count_), params_(Clone(_params)), diff --git a/src/sensor/sensor_diff_drive.cpp b/src/sensor/sensor_diff_drive.cpp index 05b5455d1..b02bfa776 100644 --- a/src/sensor/sensor_diff_drive.cpp +++ b/src/sensor/sensor_diff_drive.cpp @@ -25,7 +25,7 @@ namespace wolf { SensorDiffDrive::SensorDiffDrive(const YAML::Node& _params) - : SensorBase("SensorDiffDrive", 2, {{'P', "StatePoint2d"}, {'O', "StateAngle"}, {'I', "StateParams3"}}, _params), + : SensorBase("SensorDiffDrive", {{'P', "StatePoint2d"}, {'O', "StateAngle"}, {'I', "StateParams3"}}, _params), ticks_per_wheel_revolution_(_params["ticks_per_wheel_revolution"].as<double>()), ticks_std_factor_(_params["ticks_std_factor"].as<double>()) { diff --git a/src/sensor/sensor_motion_model.cpp b/src/sensor/sensor_motion_model.cpp index da0e6f226..69273807a 100644 --- a/src/sensor/sensor_motion_model.cpp +++ b/src/sensor/sensor_motion_model.cpp @@ -22,7 +22,7 @@ namespace wolf { -SensorMotionModel::SensorMotionModel(const YAML::Node& _params) : SensorBase("SensorMotionModel", -1, {}, _params) {} +SensorMotionModel::SensorMotionModel(const YAML::Node& _params) : SensorBase("SensorMotionModel", {}, _params) {} SensorMotionModel::~SensorMotionModel() {} -- GitLab