diff --git a/include/IMU/processor/processor_IMU.h b/include/IMU/processor/processor_IMU.h index 7a6a7f9a168c9fb4bb11586f4a4e8a39d7b1c6b6..ed48c392a1139e32be86644f9bdd70a71b894dac 100644 --- a/include/IMU/processor/processor_IMU.h +++ b/include/IMU/processor/processor_IMU.h @@ -11,9 +11,6 @@ WOLF_STRUCT_PTR_TYPEDEFS(ProcessorParamsIMU); struct ProcessorParamsIMU : public ProcessorParamsMotion { - // ProcessorParamsIMU() = default; - // using ProcessorParamsMotion::ProcessorParamsMotion; - ProcessorParamsIMU() = default; ProcessorParamsIMU(std::string _unique_name, const ParamsServer& _server): ProcessorParamsMotion(_unique_name, _server) @@ -35,8 +32,7 @@ class ProcessorIMU : public ProcessorMotion{ virtual ~ProcessorIMU(); virtual void configure(SensorBasePtr _sensor) override { }; - // Factory method for high level API - static ProcessorBasePtr create(const std::string& _unique_name, const ProcessorParamsBasePtr _params); + WOLF_PROCESSOR_CREATE(ProcessorIMU, ProcessorParamsIMU); protected: virtual void computeCurrentDelta(const Eigen::VectorXd& _data, diff --git a/include/IMU/sensor/sensor_IMU.h b/include/IMU/sensor/sensor_IMU.h index c5da4386a10bc06e40609f16eba9ee9d31fef084..b70d25aab736531beb58faebfa6d6c9089b08530 100644 --- a/include/IMU/sensor/sensor_IMU.h +++ b/include/IMU/sensor/sensor_IMU.h @@ -13,19 +13,19 @@ WOLF_STRUCT_PTR_TYPEDEFS(IntrinsicsIMU); struct IntrinsicsIMU : public IntrinsicsBase { - //noise std dev - double w_noise = 0.001; //standard deviation of Gyroscope noise (same for all the axis) in rad/sec/ sqrt(s) - double a_noise = 0.04; //standard deviation of Acceleration noise (same for all the axis) in m/s2/sqrt(s) + //noise std dev + double w_noise = 0.001; //standard deviation of Gyroscope noise (same for all the axis) in rad/sec/ sqrt(s) + double a_noise = 0.04; //standard deviation of Acceleration noise (same for all the axis) in m/s2/sqrt(s) - //Initial biases std dev - double ab_initial_stdev = 0.01; //accelerometer micro_g/sec - double wb_initial_stdev = 0.01; //gyroscope rad/sec + //Initial biases std dev + double ab_initial_stdev = 0.01; //accelerometer micro_g/sec + double wb_initial_stdev = 0.01; //gyroscope rad/sec - // bias rate of change std dev - double ab_rate_stdev = 0.00001; - double wb_rate_stdev = 0.00001; + // bias rate of change std dev + double ab_rate_stdev = 0.00001; + double wb_rate_stdev = 0.00001; - virtual ~IntrinsicsIMU() = default; + virtual ~IntrinsicsIMU() = default; IntrinsicsIMU() { //DEFINED FOR COMPATIBILITY PURPOSES. TO BE REMOVED IN THE FUTURE. @@ -33,12 +33,12 @@ struct IntrinsicsIMU : public IntrinsicsBase IntrinsicsIMU(std::string _unique_name, const ParamsServer& _server): IntrinsicsBase(_unique_name, _server) { - w_noise = _server.getParam<double>(_unique_name + "/w_noise"); - a_noise = _server.getParam<double>(_unique_name + "/a_noise"); - ab_initial_stdev = _server.getParam<double>(_unique_name + "/ab_initial_stdev"); - wb_initial_stdev = _server.getParam<double>(_unique_name + "/wb_initial_stdev"); - ab_rate_stdev = _server.getParam<double>(_unique_name + "/ab_rate_stdev"); - wb_rate_stdev = _server.getParam<double>(_unique_name + "/wb_rate_stdev"); + w_noise = _server.getParam<double>(prefix + _unique_name + "/w_noise"); + a_noise = _server.getParam<double>(prefix + _unique_name + "/a_noise"); + ab_initial_stdev = _server.getParam<double>(prefix + _unique_name + "/ab_initial_stdev"); + wb_initial_stdev = _server.getParam<double>(prefix + _unique_name + "/wb_initial_stdev"); + ab_rate_stdev = _server.getParam<double>(prefix + _unique_name + "/ab_rate_stdev"); + wb_rate_stdev = _server.getParam<double>(prefix + _unique_name + "/wb_rate_stdev"); } std::string print() const { @@ -71,6 +71,7 @@ class SensorIMU : public SensorBase SensorIMU(const Eigen::VectorXd& _extrinsics, const IntrinsicsIMU& _params); SensorIMU(const Eigen::VectorXd& _extrinsics, IntrinsicsIMUPtr _params); + WOLF_SENSOR_CREATE(SensorIMU, IntrinsicsIMU, 7); double getGyroNoise() const; double getAccelNoise() const; @@ -80,10 +81,6 @@ class SensorIMU : public SensorBase double getAbRateStdev() const; virtual ~SensorIMU(); - - public: - static SensorBasePtr create(const std::string& _unique_name, const Eigen::VectorXd& _extrinsics_pq, const IntrinsicsBasePtr _intrinsics = nullptr); - }; inline double SensorIMU::getGyroNoise() const diff --git a/src/processor/processor_IMU.cpp b/src/processor/processor_IMU.cpp index fdb2cecef0f134882fdd6b45232c6c03479f495b..d23e282c59e50180339163bb8f612ff37a5771e7 100644 --- a/src/processor/processor_IMU.cpp +++ b/src/processor/processor_IMU.cpp @@ -21,17 +21,6 @@ ProcessorIMU::~ProcessorIMU() // } -ProcessorBasePtr ProcessorIMU::create(const std::string& _unique_name, const ProcessorParamsBasePtr _params) -{ - auto prc_imu_params = std::static_pointer_cast<ProcessorParamsIMU>(_params); - - auto prc_ptr = std::make_shared<ProcessorIMU>(prc_imu_params); - - prc_ptr->setName(_unique_name); - - return prc_ptr; -} - bool ProcessorIMU::voteForKeyFrame() const { // time span @@ -210,4 +199,5 @@ void ProcessorIMU::deltaPlusDelta(const Eigen::VectorXd& _delta_preint, namespace wolf { WOLF_REGISTER_PROCESSOR("ProcessorIMU", ProcessorIMU) +WOLF_REGISTER_PROCESSOR_AUTO("ProcessorIMU", ProcessorIMU) } diff --git a/src/sensor/sensor_IMU.cpp b/src/sensor/sensor_IMU.cpp index 393af0da7bd0f09ce4f5b5999f2af8c6042ce799..deb652ce43bc32f52be45a81403b6b79d5dff84f 100644 --- a/src/sensor/sensor_IMU.cpp +++ b/src/sensor/sensor_IMU.cpp @@ -27,23 +27,11 @@ SensorIMU::~SensorIMU() // } -// Define the factory method -SensorBasePtr SensorIMU::create(const std::string& _unique_name, const Eigen::VectorXd& _extrinsics_pq, - const IntrinsicsBasePtr _intrinsics) -{ - // decode extrinsics vector - assert(_extrinsics_pq.size() == 7 && "Bad extrinsics vector length. Should be 7 for 3D."); - - IntrinsicsIMUPtr params = std::static_pointer_cast<IntrinsicsIMU>(_intrinsics); - SensorIMUPtr sen = std::make_shared<SensorIMU>(_extrinsics_pq, params); - sen->setName(_unique_name); - return sen; -} - } // namespace wolf // Register in the SensorFactory #include "core/sensor/sensor_factory.h" namespace wolf { WOLF_REGISTER_SENSOR("SensorIMU", SensorIMU) +WOLF_REGISTER_SENSOR_AUTO("SensorIMU", SensorIMU); } // namespace wolf