diff --git a/CMakeLists.txt b/CMakeLists.txt index cab800a231b74a05eb9c466e0ec5d508ca561918..9ae5db6ed39c099a74bbd8c5e8de2ebd4c7ec3e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -263,7 +263,7 @@ SET(HDRS_PROCESSOR include/core/processor/motion_buffer.h include/core/processor/processor_base.h include/core/processor/processor_diff_drive.h - include/core/processor/processor_factory.h + include/core/processor/factory_processor.h include/core/processor/processor_logging.h include/core/processor/processor_loopclosure.h include/core/processor/processor_motion.h @@ -277,13 +277,13 @@ SET(HDRS_PROCESSOR SET(HDRS_SENSOR include/core/sensor/sensor_base.h include/core/sensor/sensor_diff_drive.h - include/core/sensor/sensor_factory.h + include/core/sensor/factory_sensor.h include/core/sensor/sensor_odom_2d.h include/core/sensor/sensor_odom_3d.h ) SET(HDRS_SOLVER include/core/solver/solver_manager.h - include/core/solver/solver_factory.h + include/core/solver/factory_solver.h ) SET(HDRS_YAML diff --git a/hello_wolf/processor_range_bearing.cpp b/hello_wolf/processor_range_bearing.cpp index 69c3651d48065490622c59d39fa758289226b16e..fb51ed537d59dca40a69d473c76d53dd5761c712 100644 --- a/hello_wolf/processor_range_bearing.cpp +++ b/hello_wolf/processor_range_bearing.cpp @@ -160,7 +160,7 @@ bool ProcessorRangeBearing::storeCapture(CaptureBasePtr _cap_ptr) } /* namespace wolf */ // Register in the SensorFactory -#include "core/processor/processor_factory.h" +#include "core/processor/factory_processor.h" namespace wolf { WOLF_REGISTER_PROCESSOR("ProcessorRangeBearing", ProcessorRangeBearing) diff --git a/hello_wolf/sensor_range_bearing.cpp b/hello_wolf/sensor_range_bearing.cpp index 3eea032b2ba632cf3343805446a98d0805e56f3c..4bf5db0509face0d097172ec56855df9b26898ae 100644 --- a/hello_wolf/sensor_range_bearing.cpp +++ b/hello_wolf/sensor_range_bearing.cpp @@ -38,7 +38,7 @@ SensorRangeBearing::~SensorRangeBearing() } /* namespace wolf */ // Register in the SensorFactory -#include "core/sensor/sensor_factory.h" +#include "core/sensor/factory_sensor.h" namespace wolf { WOLF_REGISTER_SENSOR("SensorRangeBearing", SensorRangeBearing) diff --git a/hello_wolf/yaml/sensor_odom_2d.yaml b/hello_wolf/yaml/sensor_odom_2d.yaml index 3ad7204855cae5c1e8e00cfdc011ff27d2725692..2149405a784f637087572df559287f3f36942d7c 100644 --- a/hello_wolf/yaml/sensor_odom_2d.yaml +++ b/hello_wolf/yaml/sensor_odom_2d.yaml @@ -1,4 +1,4 @@ -type: "SensorOdom2d" # This must match the KEY used in the SensorFactory. Otherwise it is an error. +type: "SensorOdom2d" # This must match the KEY used in the FactorySensor. Otherwise it is an error. k_disp_to_disp: 0.1 # m^2 / m k_rot_to_rot: 0.1 # rad^2 / rad diff --git a/include/core/common/factory.h b/include/core/common/factory.h index 0d02a89c38568accad79597c9da881d752419d3a..34c214bd674157eefe04433b3406918ae8e0cba0 100644 --- a/include/core/common/factory.h +++ b/include/core/common/factory.h @@ -28,8 +28,8 @@ namespace wolf * This class implements a generic factory as a singleton. * * > IMPORTANT: This template factory can be used to construct many different objects except: - * > - Objects deriving from SensorBase --> see SensorFactory - * > - Objects deriving from ProcessorBase --> see ProcessorFactory + * > - Objects deriving from SensorBase --> see FactorySensor + * > - Objects deriving from ProcessorBase --> see FactoryProcessor * > * > The reason for this is that the two cases above need a more elaborated API than the one in this template class. * @@ -86,8 +86,8 @@ namespace wolf * The first thing to know is that we have defined typedefs for the templates that we are using. For example: * * \code - * typedef Factory<ParamsSensorBase, std::string> ParamsSensorFactory; - * typedef Factory<ParamsProcessorBase, std::string> ParamsProcessorFactory; + * typedef Factory<ParamsSensorBase, std::string> FactoryParamsSensor; + * typedef Factory<ParamsProcessorBase, std::string> FactoryParamsProcessor; * typedef Factory<LandmarkBase, YAML::Node> LandmarkFactory; * \endcode * @@ -145,7 +145,7 @@ namespace wolf * For example, in sensor_camera_yaml.cpp we find the line: * * \code - * const bool registered_camera_intr = ParamsSensorFactory::get().registerCreator("CAMERA", createParamsSensorCamera); + * const bool registered_camera_intr = FactoryParamsSensor::get().registerCreator("CAMERA", createParamsSensorCamera); * \endcode * * which is a static invocation (i.e., it is placed at global scope outside of the ParamsSensorCamera class). @@ -218,15 +218,15 @@ namespace wolf * \endcode * * ### More information - * - ParamsSensorFactory: typedef of this template to create intrinsic structs deriving from ParamsSensorBase directly from YAML files. - * - ParamsProcessorFactory: typedef of this template to create processor params structs deriving from ParamsProcessorBase directly from YAML files. + * - FactoryParamsSensor: typedef of this template to create intrinsic structs deriving from ParamsSensorBase directly from YAML files. + * - FactoryParamsProcessor: typedef of this template to create processor params structs deriving from ParamsProcessorBase directly from YAML files. * - LandmarkFactory: typedef of this template to create landmarks deriving from LandmarkBase directly from YAML nodes. * - Problem::loadMap() : to load a maps directly from YAML files. * - You can also check the code in the example file ````src/examples/test_map_yaml.cpp````. * * #### See also - * - SensorFactory: to create sensors - * - ProcessorFactory: to create processors. + * - FactorySensor: to create sensors + * - FactoryProcessor: to create processors. * - Problem::installSensor() : to install sensors in WOLF Problem. * - Problem::installProcessor() : to install processors in WOLF Problem. * diff --git a/include/core/problem/problem.h b/include/core/problem/problem.h index 1f76367e64d5345f8e475f3c5a79b19b98d01fba..dc485c52754078c53751c537fcfe72c674f645e0 100644 --- a/include/core/problem/problem.h +++ b/include/core/problem/problem.h @@ -19,8 +19,8 @@ struct ParamsProcessorBase; #include "core/frame/frame_base.h" #include "core/state_block/state_block.h" #include "core/utils/params_server.h" -#include "core/sensor/sensor_factory.h" -#include "core/processor/processor_factory.h" +#include "core/sensor/factory_sensor.h" +#include "core/processor/factory_processor.h" #include "core/processor/is_motion.h" // std includes @@ -91,7 +91,7 @@ class Problem : public std::enable_shared_from_this<Problem> * \param _sen_type type of sensor * \param _unique_sensor_name unique sensor name, used to identify the particular instance of the sensor * \param _extrinsics a vector of extrinsic parameters: size 2 for 2d position, 3 for 2d pose, 3 for 3d position, 7 for 3d pose. - * \param _intrinsics_filename the name of a file containing the intrinsic parameters in a format compatible with the intrinsics creator registered in ParamsSensorFactory under the key _sen_type. + * \param _intrinsics_filename the name of a file containing the intrinsic parameters in a format compatible with the intrinsics creator registered in FactoryParamsSensor under the key _sen_type. */ SensorBasePtr installSensor(const std::string& _sen_type, // const std::string& _unique_sensor_name, // diff --git a/include/core/processor/processor_factory.h b/include/core/processor/factory_processor.h similarity index 83% rename from include/core/processor/processor_factory.h rename to include/core/processor/factory_processor.h index 947955d4b92d58348b7bb86ded547b380e334b12..e744f5325a740ceb1bf3e89a2d374a112925af74 100644 --- a/include/core/processor/processor_factory.h +++ b/include/core/processor/factory_processor.h @@ -1,12 +1,12 @@ /** - * \file processor_factory.h + * \file factory_processor.h * * Created on: May 4, 2016 * \author: jsola */ -#ifndef PROCESSOR_FACTORY_H_ -#define PROCESSOR_FACTORY_H_ +#ifndef FACTORY_PROCESSOR_H_ +#define FACTORY_PROCESSOR_H_ namespace wolf { @@ -47,17 +47,17 @@ namespace wolf * - Write a processor creator for ProcessorOdom2d (example). * * #### Accessing the Factory - * The ProcessorFactory class is a singleton: it can only exist once in your application. + * The FactoryProcessor class is a singleton: it can only exist once in your application. * To obtain an instance of it, use the static method get(), * * \code - * ProcessorFactory::get() + * FactoryProcessor::get() * \endcode * * You can then call the methods you like, e.g. to create a processor, you type: * * \code - * ProcessorFactory::get().create(...); // see below for creating processors ... + * FactoryProcessor::get().create(...); // see below for creating processors ... * \endcode * * #### Registering processor creators @@ -69,7 +69,7 @@ namespace wolf * that knows how to create your specific processor, e.g.: * * \code - * ProcessorFactory::get().registerCreator("ProcessorOdom2d", ProcessorOdom2d::create); + * FactoryProcessor::get().registerCreator("ProcessorOdom2d", ProcessorOdom2d::create); * \endcode * * The method ProcessorOdom2d::create() exists in the ProcessorOdom2d class as a static method. @@ -96,7 +96,7 @@ namespace wolf * For example, in processor_odom_2d.cpp we find the line: * * \code - * const bool registered_odom_2d = ProcessorFactory::get().registerCreator("ProcessorOdom2d", ProcessorOdom2d::create); + * const bool registered_odom_2d = FactoryProcessor::get().registerCreator("ProcessorOdom2d", ProcessorOdom2d::create); * \endcode * * which is a static invocation (i.e., it is placed at global scope outside of the ProcessorOdom2d class). @@ -107,7 +107,7 @@ namespace wolf * It only needs to be passed the string of the processor type. * * \code - * ProcessorFactory::get().unregisterCreator("ProcessorOdom2d"); + * FactoryProcessor::get().unregisterCreator("ProcessorOdom2d"); * \endcode * * #### Creating processors @@ -117,7 +117,7 @@ namespace wolf * To create a ProcessorOdom2d, you type: * * \code - * ProcessorFactory::get().create("ProcessorOdom2d", "main odometry", params_ptr); + * FactoryProcessor::get().create("ProcessorOdom2d", "main odometry", params_ptr); * \endcode * * #### Example 1 : using the Factories alone @@ -125,21 +125,21 @@ namespace wolf * and bind it to a SensorOdom2d: * * \code - * #include "core/sensor/sensor_odom_2d.h" // provides SensorOdom2d and SensorFactory - * #include "core/processor/processor_odom_2d.h" // provides ProcessorOdom2d and ProcessorFactory + * #include "core/sensor/sensor_odom_2d.h" // provides SensorOdom2d and FactorySensor + * #include "core/processor/processor_odom_2d.h" // provides ProcessorOdom2d and FactoryProcessor * * // Note: SensorOdom2d::create() is already registered, automatically. * // Note: ProcessorOdom2d::create() is already registered, automatically. * - * // First create the sensor (See SensorFactory for details) - * SensorBasePtr sensor_ptr = SensorFactory::get().create ( "FactorOdom2d" , "Main odometer" , extrinsics , &intrinsics ); + * // First create the sensor (See FactorySensor for details) + * SensorBasePtr sensor_ptr = FactorySensor::get().create ( "FactorOdom2d" , "Main odometer" , extrinsics , &intrinsics ); * * // To create a odometry integrator, provide a type="ODOM 2d", a name="main odometry", and a pointer to the parameters struct: * * ParamsProcessorOdom2d params({...}); // fill in the derived struct (note: ProcessorOdom2d actually has no input params) * * ProcessorBasePtr processor_ptr = - * ProcessorFactory::get().create ( "ProcessorOdom2d" , "main odometry" , ¶ms ); + * FactoryProcessor::get().create ( "ProcessorOdom2d" , "main odometry" , ¶ms ); * * // Bind processor to sensor * sensor_ptr->addProcessor(processor_ptr); @@ -168,40 +168,40 @@ namespace wolf // ParamsProcessor factory struct ParamsProcessorBase; typedef Factory<ParamsProcessorBase, - const std::string&> ParamsProcessorFactory; + const std::string&> FactoryParamsProcessor; template<> -inline std::string ParamsProcessorFactory::getClass() +inline std::string FactoryParamsProcessor::getClass() { - return "ParamsProcessorFactory"; + return "FactoryParamsProcessor"; } // Processor factory typedef Factory<ProcessorBase, const std::string&, - const ParamsProcessorBasePtr> ProcessorFactory; + const ParamsProcessorBasePtr> FactoryProcessor; template<> -inline std::string ProcessorFactory::getClass() +inline std::string FactoryProcessor::getClass() { - return "ProcessorFactory"; + return "FactoryProcessor"; } #define WOLF_REGISTER_PROCESSOR(ProcessorType, ProcessorName) \ namespace{ const bool WOLF_UNUSED ProcessorName##Registered = \ - wolf::ProcessorFactory::get().registerCreator(ProcessorType, ProcessorName::create); } \ + wolf::FactoryProcessor::get().registerCreator(ProcessorType, ProcessorName::create); } \ typedef Factory<ProcessorBase, const std::string&, - const ParamsServer&> AutoConfProcessorFactory; + const ParamsServer&> AutoConfFactoryProcessor; template<> -inline std::string AutoConfProcessorFactory::getClass() +inline std::string AutoConfFactoryProcessor::getClass() { - return "AutoConfProcessorFactory"; + return "AutoConfFactoryProcessor"; } #define WOLF_REGISTER_PROCESSOR_AUTO(ProcessorType, ProcessorName) \ namespace{ const bool WOLF_UNUSED ProcessorName##AutoConfRegistered = \ - wolf::AutoConfProcessorFactory::get().registerCreator(ProcessorType, ProcessorName::create); } \ + wolf::AutoConfFactoryProcessor::get().registerCreator(ProcessorType, ProcessorName::create); } \ } /* namespace wolf */ diff --git a/include/core/sensor/sensor_factory.h b/include/core/sensor/factory_sensor.h similarity index 83% rename from include/core/sensor/sensor_factory.h rename to include/core/sensor/factory_sensor.h index daf01499ac759d799517cdd73ab830fb6ccaf4d5..cae320bba5d2e0d380afbca67984e294ac667984 100644 --- a/include/core/sensor/sensor_factory.h +++ b/include/core/sensor/factory_sensor.h @@ -1,12 +1,12 @@ /** - * \file sensor_factory.h + * \file factory_sensor.h * * Created on: Apr 25, 2016 * \author: jsola */ -#ifndef SENSOR_FACTORY_H_ -#define SENSOR_FACTORY_H_ +#ifndef FACTORY_SENSOR_H_ +#define FACTORY_SENSOR_H_ namespace wolf { @@ -47,17 +47,17 @@ namespace wolf * - Write a sensor creator for SensorCamera (example). * * #### Accessing the factory - * The SensorFactory class is a <a href="http://stackoverflow.com/questions/1008019/c-singleton-design-pattern#1008289">singleton</a>: it can only exist once in your application. + * The FactorySensor class is a <a href="http://stackoverflow.com/questions/1008019/c-singleton-design-pattern#1008289">singleton</a>: it can only exist once in your application. * To obtain an instance of it, use the static method get(), * * \code - * SensorFactory::get() + * FactorySensor::get() * \endcode * * You can then call the methods you like, e.g. to create a sensor, you type: * * \code - * SensorFactory::get().create(...); // see below for creating sensors ... + * FactorySensor::get().create(...); // see below for creating sensors ... * \endcode * * #### Registering sensor creators @@ -69,7 +69,7 @@ namespace wolf * that knows how to create your specific sensor, e.g.: * * \code - * SensorFactory::get().registerCreator("CAMERA", SensorCamera::create); + * FactorySensor::get().registerCreator("CAMERA", SensorCamera::create); * \endcode * * The method SensorCamera::create() exists in the SensorCamera class as a static method. @@ -89,7 +89,7 @@ namespace wolf * For example, in sensor_camera.cpp we find the line: * * \code - * const bool registered_camera = SensorFactory::get().registerCreator("CAMERA", SensorCamera::create); + * const bool registered_camera = FactorySensor::get().registerCreator("CAMERA", SensorCamera::create); * \endcode * * which is a static invocation (i.e., it is placed at global scope outside of the SensorCamera class). @@ -99,7 +99,7 @@ namespace wolf * The method unregisterCreator() unregisters the SensorXxx::create() method. It only needs to be passed the string of the sensor type. * * \code - * SensorFactory::get().unregisterCreator("CAMERA"); + * FactorySensor::get().unregisterCreator("CAMERA"); * \endcode * * #### Creating sensors @@ -109,15 +109,15 @@ namespace wolf * To create e.g. a SensorCamera, you type: * * \code - * SensorFactory::get().create("CAMERA", "Front-left camera", extrinsics, intrinsics_ptr); + * FactorySensor::get().create("CAMERA", "Front-left camera", extrinsics, intrinsics_ptr); * \endcode * * where ABSOLUTELY ALL input parameters are important. In particular, the sensor name "Front-left camera" will be used to identify this camera * and to assign it the appropriate processors. DO NOT USE IT WITH DUMMY PARAMETERS! * * #### See also - * - ParamsSensorFactory: to create intrinsic structs deriving from ParamsSensorBase directly from YAML files. - * - ProcessorFactory: to create processors that will be bound to sensors. + * - FactoryParamsSensor: to create intrinsic structs deriving from ParamsSensorBase directly from YAML files. + * - FactoryProcessor: to create processors that will be bound to sensors. * - Problem::installSensor() : to install sensors in WOLF Problem. * * #### Example 1: writing a specific sensor creator @@ -148,14 +148,14 @@ namespace wolf * Put the code either at global scope (you must define a dummy variable for this), * \code * namespace { - * const bool registered_camera = SensorFactory::get().registerCreator("CAMERA", SensorCamera::create); + * const bool registered_camera = FactorySensor::get().registerCreator("CAMERA", SensorCamera::create); * } * main () { ... } * \endcode * or inside your main(), where a direct call is possible: * \code * main () { - * SensorFactory::get().registerCreator("CAMERA", SensorCamera::create); + * FactorySensor::get().registerCreator("CAMERA", SensorCamera::create); * ... * } * \endcode @@ -164,7 +164,7 @@ namespace wolf * Put the code at the last line of the sensor_xxx.cpp file, * \code * namespace { - * const bool registered_camera = SensorFactory::get().registerCreator("CAMERA", SensorCamera::create); + * const bool registered_camera = FactorySensor::get().registerCreator("CAMERA", SensorCamera::create); * } * \endcode * Automatic registration is recommended in wolf, and implemented in the classes shipped with it. @@ -174,7 +174,7 @@ namespace wolf * We finally provide the necessary steps to create a sensor of class SensorCamera in our application: * * \code - * #include "sensor_factory.h" + * #include "factory_sensor.h" * #include "core/sensor/sensor_camera.h" // provides SensorCamera * * // Note: SensorCamera::create() is already registered, automatically. @@ -189,10 +189,10 @@ namespace wolf * // a pointer to the intrinsics struct: * * Eigen::VectorXd extrinsics_1(7); // give it some values... - * ParamsSensorCamera intrinsics_1({...}); // see ParamsSensorFactory to fill in the derived struct + * ParamsSensorCamera intrinsics_1({...}); // see FactoryParamsSensor to fill in the derived struct * * SensorBasePtr camera_1_ptr = - * SensorFactory::get().create ( "CAMERA" , "Front-left camera" , extrinsics_1 , &intrinsics_1 ); + * FactorySensor::get().create ( "CAMERA" , "Front-left camera" , extrinsics_1 , &intrinsics_1 ); * * // A second camera... with a different name! * @@ -200,7 +200,7 @@ namespace wolf * ParamsSensorCamera intrinsics_2({...}); * * SensorBasePtr camera_2_ptr = - * SensorFactory::get().create( "CAMERA" , "Front-right camera" , extrinsics_2 , &intrinsics_2 ); + * FactorySensor::get().create( "CAMERA" , "Front-right camera" , extrinsics_2 , &intrinsics_2 ); * * return 0; * } @@ -212,42 +212,42 @@ namespace wolf // ParamsSensor factory struct ParamsSensorBase; typedef Factory<ParamsSensorBase, - const std::string&> ParamsSensorFactory; + const std::string&> FactoryParamsSensor; template<> -inline std::string ParamsSensorFactory::getClass() +inline std::string FactoryParamsSensor::getClass() { - return "ParamsSensorFactory"; + return "FactoryParamsSensor"; } // Sensor factory typedef Factory<SensorBase, const std::string&, - const Eigen::VectorXd&, const ParamsSensorBasePtr> SensorFactory; + const Eigen::VectorXd&, const ParamsSensorBasePtr> FactorySensor; template<> -inline std::string SensorFactory::getClass() +inline std::string FactorySensor::getClass() { - return "SensorFactory"; + return "FactorySensor"; } #define WOLF_REGISTER_SENSOR(SensorType, SensorName) \ namespace{ const bool WOLF_UNUSED SensorName##Registered = \ - SensorFactory::get().registerCreator(SensorType, SensorName::create); } \ + FactorySensor::get().registerCreator(SensorType, SensorName::create); } \ typedef Factory<SensorBase, const std::string&, - const ParamsServer&> AutoConfSensorFactory; + const ParamsServer&> AutoConfFactorySensor; template<> -inline std::string AutoConfSensorFactory::getClass() +inline std::string AutoConfFactorySensor::getClass() { - return "AutoConfSensorFactory"; + return "AutoConfFactorySensor"; } #define WOLF_REGISTER_SENSOR_AUTO(SensorType, SensorName) \ namespace{ const bool WOLF_UNUSED SensorName##AutoConfRegistered = \ - AutoConfSensorFactory::get().registerCreator(SensorType, SensorName::create); } \ + AutoConfFactorySensor::get().registerCreator(SensorType, SensorName::create); } \ } /* namespace wolf */ diff --git a/include/core/solver/solver_factory.h b/include/core/solver/factory_solver.h similarity index 85% rename from include/core/solver/solver_factory.h rename to include/core/solver/factory_solver.h index d80fe24f78ddaa91a44e7821f2dc0a55117b8dcf..4c9971d90a86a57b8254b21a4fc0cad6775b9ee1 100644 --- a/include/core/solver/solver_factory.h +++ b/include/core/solver/factory_solver.h @@ -1,12 +1,12 @@ /** - * \file solver_factory.h + * \file factory_solver.h * * Created on: Dec 17, 2018 * \author: jcasals */ -#ifndef SOLVER_FACTORY_H_ -#define SOLVER_FACTORY_H_ +#ifndef FACTORY_SOLVER_H_ +#define FACTORY_SOLVER_H_ namespace wolf { @@ -47,17 +47,17 @@ namespace wolf * - Write a sensor creator for SensorCamera (example). * * #### Accessing the factory - * The SensorFactory class is a <a href="http://stackoverflow.com/questions/1008019/c-singleton-design-pattern#1008289">singleton</a>: it can only exist once in your application. + * The FactorySensor class is a <a href="http://stackoverflow.com/questions/1008019/c-singleton-design-pattern#1008289">singleton</a>: it can only exist once in your application. * To obtain an instance of it, use the static method get(), * * \code - * SensorFactory::get() + * FactorySensor::get() * \endcode * * You can then call the methods you like, e.g. to create a sensor, you type: * * \code - * SensorFactory::get().create(...); // see below for creating sensors ... + * FactorySensor::get().create(...); // see below for creating sensors ... * \endcode * * #### Registering sensor creators @@ -69,7 +69,7 @@ namespace wolf * that knows how to create your specific sensor, e.g.: * * \code - * SensorFactory::get().registerCreator("CAMERA", SensorCamera::create); + * FactorySensor::get().registerCreator("CAMERA", SensorCamera::create); * \endcode * * The method SensorCamera::create() exists in the SensorCamera class as a static method. @@ -89,7 +89,7 @@ namespace wolf * For example, in sensor_camera.cpp we find the line: * * \code - * const bool registered_camera = SensorFactory::get().registerCreator("CAMERA", SensorCamera::create); + * const bool registered_camera = FactorySensor::get().registerCreator("CAMERA", SensorCamera::create); * \endcode * * which is a static invocation (i.e., it is placed at global scope outside of the SensorCamera class). @@ -99,7 +99,7 @@ namespace wolf * The method unregisterCreator() unregisters the SensorXxx::create() method. It only needs to be passed the string of the sensor type. * * \code - * SensorFactory::get().unregisterCreator("CAMERA"); + * FactorySensor::get().unregisterCreator("CAMERA"); * \endcode * * #### Creating sensors @@ -109,15 +109,15 @@ namespace wolf * To create e.g. a SensorCamera, you type: * * \code - * SensorFactory::get().create("CAMERA", "Front-left camera", extrinsics, intrinsics_ptr); + * FactorySensor::get().create("CAMERA", "Front-left camera", extrinsics, intrinsics_ptr); * \endcode * * where ABSOLUTELY ALL input parameters are important. In particular, the sensor name "Front-left camera" will be used to identify this camera * and to assign it the appropriate processors. DO NOT USE IT WITH DUMMY PARAMETERS! * * #### See also - * - ParamsSensorFactory: to create intrinsic structs deriving from ParamsSensorBase directly from YAML files. - * - ProcessorFactory: to create processors that will be bound to sensors. + * - FactoryParamsSensor: to create intrinsic structs deriving from ParamsSensorBase directly from YAML files. + * - FactoryProcessor: to create processors that will be bound to sensors. * - Problem::installSensor() : to install sensors in WOLF Problem. * * #### Example 1: writing a specific sensor creator @@ -148,14 +148,14 @@ namespace wolf * Put the code either at global scope (you must define a dummy variable for this), * \code * namespace { - * const bool registered_camera = SensorFactory::get().registerCreator("CAMERA", SensorCamera::create); + * const bool registered_camera = FactorySensor::get().registerCreator("CAMERA", SensorCamera::create); * } * main () { ... } * \endcode * or inside your main(), where a direct call is possible: * \code * main () { - * SensorFactory::get().registerCreator("CAMERA", SensorCamera::create); + * FactorySensor::get().registerCreator("CAMERA", SensorCamera::create); * ... * } * \endcode @@ -164,7 +164,7 @@ namespace wolf * Put the code at the last line of the sensor_xxx.cpp file, * \code * namespace { - * const bool registered_camera = SensorFactory::get().registerCreator("CAMERA", SensorCamera::create); + * const bool registered_camera = FactorySensor::get().registerCreator("CAMERA", SensorCamera::create); * } * \endcode * Automatic registration is recommended in wolf, and implemented in the classes shipped with it. @@ -174,7 +174,7 @@ namespace wolf * We finally provide the necessary steps to create a sensor of class SensorCamera in our application: * * \code - * #include "sensor_factory.h" + * #include "factory_sensor.h" * #include "sensor_camera.h" // provides SensorCamera * * // Note: SensorCamera::create() is already registered, automatically. @@ -189,10 +189,10 @@ namespace wolf * // a pointer to the intrinsics struct: * * Eigen::VectorXd extrinsics_1(7); // give it some values... - * ParamsSensorCamera intrinsics_1({...}); // see ParamsSensorFactory to fill in the derived struct + * ParamsSensorCamera intrinsics_1({...}); // see FactoryParamsSensor to fill in the derived struct * * SensorBasePtr camera_1_ptr = - * SensorFactory::get().create ( "CAMERA" , "Front-left camera" , extrinsics_1 , &intrinsics_1 ); + * FactorySensor::get().create ( "CAMERA" , "Front-left camera" , extrinsics_1 , &intrinsics_1 ); * * // A second camera... with a different name! * @@ -200,7 +200,7 @@ namespace wolf * ParamsSensorCamera intrinsics_2({...}); * * SensorBasePtr camera_2_ptr = - * SensorFactory::get().create( "CAMERA" , "Front-right camera" , extrinsics_2 , &intrinsics_2 ); + * FactorySensor::get().create( "CAMERA" , "Front-right camera" , extrinsics_2 , &intrinsics_2 ); * * return 0; * } @@ -211,17 +211,17 @@ namespace wolf typedef Factory<SolverManager, const ProblemPtr&, - const ParamsServer&> SolverFactory; + const ParamsServer&> FactorySolver; template<> -inline std::string SolverFactory::getClass() +inline std::string FactorySolver::getClass() { - return "SolverFactory"; + return "FactorySolver"; } #define WOLF_REGISTER_SOLVER(SolverType, SolverName) \ namespace{ const bool WOLF_UNUSED SolverName##Registered = \ - wolf::SolverFactory::get().registerCreator(SolverType, SolverName::create); } \ + wolf::FactorySolver::get().registerCreator(SolverType, SolverName::create); } \ } /* namespace wolf */ diff --git a/src/ceres_wrapper/ceres_manager.cpp b/src/ceres_wrapper/ceres_manager.cpp index 0d8cba6f97cb7e2c2cdf067e7ebcb65d8ac79c10..c358c072f87b6f9de97b74c689a45e811b25cdee 100644 --- a/src/ceres_wrapper/ceres_manager.cpp +++ b/src/ceres_wrapper/ceres_manager.cpp @@ -515,7 +515,7 @@ const Eigen::SparseMatrixd CeresManager::computeHessian() const } // namespace wolf -#include "core/solver/solver_factory.h" +#include "core/solver/factory_solver.h" namespace wolf { WOLF_REGISTER_SOLVER("CERES", CeresManager) } // namespace wolf diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index 1d5ad2ec6627fb99011dbf7841860e0f9b28e951..785d95f2f66293ea72202103852733da111b7365 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -8,8 +8,8 @@ #include "core/processor/processor_tracker.h" #include "core/capture/capture_pose.h" #include "core/factor/factor_base.h" -#include "core/sensor/sensor_factory.h" -#include "core/processor/processor_factory.h" +#include "core/sensor/factory_sensor.h" +#include "core/processor/factory_processor.h" #include "core/state_block/state_block.h" #include "core/utils/logging.h" #include "core/utils/params_server.h" @@ -179,7 +179,7 @@ SensorBasePtr Problem::installSensor(const std::string& _sen_type, // const Eigen::VectorXd& _extrinsics, // ParamsSensorBasePtr _intrinsics) { - SensorBasePtr sen_ptr = SensorFactory::get().create(_sen_type, _unique_sensor_name, _extrinsics, _intrinsics); + SensorBasePtr sen_ptr = FactorySensor::get().create(_sen_type, _unique_sensor_name, _extrinsics, _intrinsics); sen_ptr->link(getHardware()); return sen_ptr; } @@ -194,7 +194,7 @@ SensorBasePtr Problem::installSensor(const std::string& _sen_type, // if (_intrinsics_filename != "") { assert(file_exists(_intrinsics_filename) && "Cannot install sensor: intrinsics' YAML file does not exist."); - ParamsSensorBasePtr intr_ptr = ParamsSensorFactory::get().create(_sen_type, _intrinsics_filename); + ParamsSensorBasePtr intr_ptr = FactoryParamsSensor::get().create(_sen_type, _intrinsics_filename); return installSensor(_sen_type, _unique_sensor_name, _extrinsics, intr_ptr); } else @@ -206,7 +206,7 @@ SensorBasePtr Problem::installSensor(const std::string& _sen_type, // const std::string& _unique_sensor_name, // const ParamsServer& _server) { - SensorBasePtr sen_ptr = AutoConfSensorFactory::get().create(_sen_type, _unique_sensor_name, _server); + SensorBasePtr sen_ptr = AutoConfFactorySensor::get().create(_sen_type, _unique_sensor_name, _server); sen_ptr->link(getHardware()); return sen_ptr; } @@ -223,7 +223,7 @@ ProcessorBasePtr Problem::installProcessor(const std::string& _prc_type, // return ProcessorBasePtr(); } - ProcessorBasePtr prc_ptr = ProcessorFactory::get().create(_prc_type, _unique_processor_name, _prc_params); + ProcessorBasePtr prc_ptr = FactoryProcessor::get().create(_prc_type, _unique_processor_name, _prc_params); //Dimension check int prc_dim = prc_ptr->getDim(); @@ -253,7 +253,7 @@ ProcessorBasePtr Problem::installProcessor(const std::string& _prc_type, // else { assert(file_exists(_params_filename) && "Cannot install processor: parameters' YAML file does not exist."); - ParamsProcessorBasePtr prc_params = ParamsProcessorFactory::get().create(_prc_type, _params_filename); + ParamsProcessorBasePtr prc_params = FactoryParamsProcessor::get().create(_prc_type, _params_filename); return installProcessor(_prc_type, _unique_processor_name, sen_ptr, prc_params); } } @@ -267,7 +267,7 @@ ProcessorBasePtr Problem::installProcessor(const std::string& _prc_type, // 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!"); - ProcessorBasePtr prc_ptr = AutoConfProcessorFactory::get().create(_prc_type, _unique_processor_name, _server); + ProcessorBasePtr prc_ptr = AutoConfFactoryProcessor::get().create(_prc_type, _unique_processor_name, _server); //Dimension check int prc_dim = prc_ptr->getDim(); diff --git a/src/processor/processor_diff_drive.cpp b/src/processor/processor_diff_drive.cpp index f8c5c8c0ab3fa62991ca4f0e0c7a4d47cc61c9e5..ea18e433486117e2e4c16376e11c0cdfaf016e5d 100644 --- a/src/processor/processor_diff_drive.cpp +++ b/src/processor/processor_diff_drive.cpp @@ -174,7 +174,7 @@ FactorBasePtr ProcessorDiffDrive::emplaceFactor(FeatureBasePtr _feature, // Register in the ProcessorFactory -#include "core/processor/processor_factory.h" +#include "core/processor/factory_processor.h" namespace wolf { WOLF_REGISTER_PROCESSOR("ProcessorDiffDrive", ProcessorDiffDrive); WOLF_REGISTER_PROCESSOR_AUTO("ProcessorDiffDrive", ProcessorDiffDrive); diff --git a/src/processor/processor_odom_2d.cpp b/src/processor/processor_odom_2d.cpp index 12266db4b2de21aed5eaa3cdcceebacbd22e9633..b5814ab2a685357eb5fc58f06aa79dba2ae5775b 100644 --- a/src/processor/processor_odom_2d.cpp +++ b/src/processor/processor_odom_2d.cpp @@ -171,7 +171,7 @@ FeatureBasePtr ProcessorOdom2d::emplaceFeature(CaptureMotionPtr _capture_motion) } /* namespace wolf */ // Register in the ProcessorFactory -#include "core/processor/processor_factory.h" +#include "core/processor/factory_processor.h" namespace wolf { WOLF_REGISTER_PROCESSOR("ProcessorOdom2d", ProcessorOdom2d); WOLF_REGISTER_PROCESSOR_AUTO("ProcessorOdom2d", ProcessorOdom2d); diff --git a/src/processor/processor_odom_3d.cpp b/src/processor/processor_odom_3d.cpp index cca930aec5cf2fa924a1c119ec2111c8fa338aed..4ed5bbc0e5b55cdc7af7068f000e69d2b5ca7930 100644 --- a/src/processor/processor_odom_3d.cpp +++ b/src/processor/processor_odom_3d.cpp @@ -247,7 +247,7 @@ FactorBasePtr ProcessorOdom3d::emplaceFactor(FeatureBasePtr _feature_motion, Cap } // Register in the SensorFactory -#include "core/processor/processor_factory.h" +#include "core/processor/factory_processor.h" namespace wolf { WOLF_REGISTER_PROCESSOR("ProcessorOdom3d", ProcessorOdom3d); WOLF_REGISTER_PROCESSOR_AUTO("ProcessorOdom3d", ProcessorOdom3d); diff --git a/src/sensor/sensor_diff_drive.cpp b/src/sensor/sensor_diff_drive.cpp index ae48fcceb261da67fa2b940aa06248b3d5006e48..6655edcd46708e459e9f7d8bde4ee3a23a1511e9 100644 --- a/src/sensor/sensor_diff_drive.cpp +++ b/src/sensor/sensor_diff_drive.cpp @@ -48,7 +48,7 @@ SensorDiffDrive::~SensorDiffDrive() } /* namespace wolf */ // Register in the SensorFactory -#include "core/sensor/sensor_factory.h" +#include "core/sensor/factory_sensor.h" namespace wolf { WOLF_REGISTER_SENSOR("SensorDiffDrive", SensorDiffDrive); WOLF_REGISTER_SENSOR_AUTO("SensorDiffDrive", SensorDiffDrive); diff --git a/src/sensor/sensor_odom_2d.cpp b/src/sensor/sensor_odom_2d.cpp index 57af930f6724980d49209aaf1ece6b6762556adc..7b019ae7dbda9b3d76f9518699824cae211af854 100644 --- a/src/sensor/sensor_odom_2d.cpp +++ b/src/sensor/sensor_odom_2d.cpp @@ -37,7 +37,7 @@ double SensorOdom2d::getRotVarToRotNoiseFactor() const } // Register in the SensorFactory -#include "core/sensor/sensor_factory.h" +#include "core/sensor/factory_sensor.h" namespace wolf { WOLF_REGISTER_SENSOR("SensorOdom2d", SensorOdom2d); WOLF_REGISTER_SENSOR_AUTO("SensorOdom2d", SensorOdom2d); diff --git a/src/sensor/sensor_odom_3d.cpp b/src/sensor/sensor_odom_3d.cpp index a79995b85e11a3c248be1f19d4c69514cd6483d8..179b55e455f3d4b5c1d0b8f8989dd51aee453003 100644 --- a/src/sensor/sensor_odom_3d.cpp +++ b/src/sensor/sensor_odom_3d.cpp @@ -40,7 +40,7 @@ SensorOdom3d::~SensorOdom3d() } // namespace wolf // Register in the SensorFactory -#include "core/sensor/sensor_factory.h" +#include "core/sensor/factory_sensor.h" namespace wolf { WOLF_REGISTER_SENSOR("SensorOdom3d", SensorOdom3d); WOLF_REGISTER_SENSOR_AUTO("SensorOdom3d", SensorOdom3d); diff --git a/src/yaml/processor_odom_3d_yaml.cpp b/src/yaml/processor_odom_3d_yaml.cpp index bd05bf3300e9598e6059d39ffa75a5cf228adf26..0a0884454f126a46e169c5edc25d26b3bb04ef64 100644 --- a/src/yaml/processor_odom_3d_yaml.cpp +++ b/src/yaml/processor_odom_3d_yaml.cpp @@ -47,8 +47,8 @@ static ParamsProcessorBasePtr createProcessorOdom3dParams(const std::string & _f return nullptr; } -// Register in the SensorFactory -const bool WOLF_UNUSED registered_prc_odom_3d = ParamsProcessorFactory::get().registerCreator("ProcessorOdom3d", createProcessorOdom3dParams); +// Register in the FactorySensor +const bool WOLF_UNUSED registered_prc_odom_3d = FactoryParamsProcessor::get().registerCreator("ProcessorOdom3d", createProcessorOdom3dParams); } // namespace [unnamed] diff --git a/src/yaml/sensor_odom_2d_yaml.cpp b/src/yaml/sensor_odom_2d_yaml.cpp index d59cd4decfb77338a0b3bb4ba17c607e03f847c1..b8ef1a083111a877b5b283c13d751df88a5af20d 100644 --- a/src/yaml/sensor_odom_2d_yaml.cpp +++ b/src/yaml/sensor_odom_2d_yaml.cpp @@ -39,8 +39,8 @@ static ParamsSensorBasePtr createParamsSensorOdom2d(const std::string & _filenam return nullptr; } -// Register in the SensorFactory -const bool WOLF_UNUSED registered_odom_2d_intr = ParamsSensorFactory::get().registerCreator("SensorOdom2d", createParamsSensorOdom2d); +// Register in the FactorySensor +const bool WOLF_UNUSED registered_odom_2d_intr = FactoryParamsSensor::get().registerCreator("SensorOdom2d", createParamsSensorOdom2d); } // namespace [unnamed] diff --git a/src/yaml/sensor_odom_3d_yaml.cpp b/src/yaml/sensor_odom_3d_yaml.cpp index e437bedcbf00257068bfea07830caa9f8224e7c9..5b700eb8210b337d59f1186be90b869fe123874f 100644 --- a/src/yaml/sensor_odom_3d_yaml.cpp +++ b/src/yaml/sensor_odom_3d_yaml.cpp @@ -41,8 +41,8 @@ static ParamsSensorBasePtr createParamsSensorOdom3d(const std::string & _filenam return nullptr; } -// Register in the SensorFactory -const bool WOLF_UNUSED registered_odom_3d_intr = ParamsSensorFactory::get().registerCreator("SensorOdom3d", createParamsSensorOdom3d); +// Register in the FactorySensor +const bool WOLF_UNUSED registered_odom_3d_intr = FactoryParamsSensor::get().registerCreator("SensorOdom3d", createParamsSensorOdom3d); } // namespace [unnamed] diff --git a/test/dummy/processor_tracker_feature_dummy.cpp b/test/dummy/processor_tracker_feature_dummy.cpp index 4c7636e1b963fc44be6f7b26a45623f0653e0bb8..4693ff76fb3bf38ad5a52d6a6754383e9601dbe0 100644 --- a/test/dummy/processor_tracker_feature_dummy.cpp +++ b/test/dummy/processor_tracker_feature_dummy.cpp @@ -111,7 +111,7 @@ ProcessorBasePtr ProcessorTrackerFeatureDummy::create(const std::string& _unique } // namespace wolf // Register in the ProcessorFactory -#include "core/processor/processor_factory.h" +#include "core/processor/factory_processor.h" namespace wolf { WOLF_REGISTER_PROCESSOR("ProcessorTrackerFeatureDummy", ProcessorTrackerFeatureDummy) } // namespace wolf diff --git a/test/gtest_problem.cpp b/test/gtest_problem.cpp index 01c361d8c991c17af61c1079fea195f39b0b7212..187c0994b10a60820eb009e7de5366a354bea62d 100644 --- a/test/gtest_problem.cpp +++ b/test/gtest_problem.cpp @@ -32,7 +32,7 @@ using namespace Eigen; // Register in the ProcessorFactory -#include "core/processor/processor_factory.h" +#include "core/processor/factory_processor.h" namespace wolf { WOLF_REGISTER_PROCESSOR("TRACKER FEATURE DUMMY", ProcessorTrackerFeatureDummy) } // namespace wolf diff --git a/test/gtest_processor_base.cpp b/test/gtest_processor_base.cpp index a9a178e093dc21ea6da2d3785a24c3ad6878d6e4..f41c0dec436396a0dafffe3a4e549bfcd739c2b0 100644 --- a/test/gtest_processor_base.cpp +++ b/test/gtest_processor_base.cpp @@ -25,7 +25,7 @@ using namespace Eigen; // Register in the ProcessorFactory -#include "core/processor/processor_factory.h" +#include "core/processor/factory_processor.h" namespace wolf { WOLF_REGISTER_PROCESSOR("TRACKER FEATURE DUMMY", ProcessorTrackerFeatureDummy) } // namespace wolf diff --git a/test/gtest_processor_tracker_feature_dummy.cpp b/test/gtest_processor_tracker_feature_dummy.cpp index db3d2195490675d5eb00162b9ee48019eb3b8469..f7579f2cd0dd93b403b363afcfe9d4bc8e5aad77 100644 --- a/test/gtest_processor_tracker_feature_dummy.cpp +++ b/test/gtest_processor_tracker_feature_dummy.cpp @@ -1,7 +1,7 @@ // wolf includes #include "core/utils/utils_gtest.h" -#include "core/sensor/sensor_factory.h" +#include "core/sensor/factory_sensor.h" #include "dummy/processor_tracker_feature_dummy.h" #include "core/capture/capture_void.h" diff --git a/test/gtest_processor_tracker_landmark_dummy.cpp b/test/gtest_processor_tracker_landmark_dummy.cpp index 3eb37a026f4d9b147a0adde53bffdcee40bf8139..8963211c45c292341d3754e83579f8bf9738a752 100644 --- a/test/gtest_processor_tracker_landmark_dummy.cpp +++ b/test/gtest_processor_tracker_landmark_dummy.cpp @@ -1,7 +1,7 @@ // wolf includes #include "core/utils/utils_gtest.h" -#include "core/sensor/sensor_factory.h" +#include "core/sensor/factory_sensor.h" #include "dummy/processor_tracker_landmark_dummy.h" #include "core/capture/capture_void.h" diff --git a/test/yaml/processor_odom_3d.yaml b/test/yaml/processor_odom_3d.yaml index 65b00b967a1b3c1ed870f979479db930caf78b5e..672421b5d074b7fd627bf955a879e3f10a3544e0 100644 --- a/test/yaml/processor_odom_3d.yaml +++ b/test/yaml/processor_odom_3d.yaml @@ -1,4 +1,4 @@ -type: "ProcessorOdom3d" # This must match the KEY used in the SensorFactory. Otherwise it is an error. +type: "ProcessorOdom3d" # This must match the KEY used in the FactorySensor. Otherwise it is an error. time_tolerance: 0.01 # seconds diff --git a/test/yaml/sensor_odom_2d.yaml b/test/yaml/sensor_odom_2d.yaml index 0841d40b310d90064de6131e32ccaee189ab104c..2d26af901956a324988ac86a67a78dacb5ae8a67 100644 --- a/test/yaml/sensor_odom_2d.yaml +++ b/test/yaml/sensor_odom_2d.yaml @@ -1,4 +1,4 @@ -type: "SensorOdom2d" # This must match the KEY used in the SensorFactory. Otherwise it is an error. +type: "SensorOdom2d" # This must match the KEY used in the FactorySensor. Otherwise it is an error. k_disp_to_disp: 0.02 # m^2 / m k_rot_to_rot: 0.01 # rad^2 / rad diff --git a/test/yaml/sensor_odom_3d.yaml b/test/yaml/sensor_odom_3d.yaml index 58db1c088fbc80339a78ba815fddbaf69674d3b6..8eb2b235011cb3cfe4f35b1f73da6344991af0da 100644 --- a/test/yaml/sensor_odom_3d.yaml +++ b/test/yaml/sensor_odom_3d.yaml @@ -1,4 +1,4 @@ -type: "SensorOdom3d" # This must match the KEY used in the SensorFactory. Otherwise it is an error. +type: "SensorOdom3d" # This must match the KEY used in the FactorySensor. Otherwise it is an error. k_disp_to_disp: 0.02 # m^2 / m k_disp_to_rot: 0.02 # rad^2 / m