diff --git a/include/core/common/factory.h b/include/core/common/factory.h index 358c86895c1c8fcfdf026548925e5d290640ca7b..c4f3822569b8ea6cf274f17a2fa209e6f008094c 100644 --- a/include/core/common/factory.h +++ b/include/core/common/factory.h @@ -30,9 +30,6 @@ #include <iostream> #include <iomanip> -// yaml -#include <yaml-cpp/yaml.h> - namespace wolf { @@ -47,7 +44,10 @@ namespace wolf * * - The class is templatized on the class of the produced objects, __TypeBase__. * The produced objects are always of a class deriving from TypeBase. - * The returned data is always a shared pointer to TypeBase. + * The returned data is an object of type __TypeBase__. If you want a shared pointer to an object, + * then __TypeBase__ must be the desired shared pointer. + * + * From now on we will assume that a typedef is defined: ````std::shared_ptr<Type>```` as ````TypePtr````. * * For example, you may use as __TypeBase__ the following types: * - LandmarkBase: the Factory creates landmarks deriving from LandmarkBase and returns base pointers ````LandmarkBasePtr```` to them @@ -55,38 +55,12 @@ namespace wolf * - XxxBase: the Factory creates objects deriving from XxxBase and returns pointers ````XxxBasePtr```` to them. * * - The class is variadic-templatized on the types of the input parameter of the creator, __TypeInput__: - * - ````std::string```` is used when the input parameter is a file name from which to read data (typically a YAML file). - * - ````std::string, wolf::ParamsServer``` is used when nodes are build from parameters in the ParamsServer - * - ````YAML::Node```` is used when the input parameter is a YAML node with structured data. + * - ````std::string```` is used when the input parameter is a file name from which to read data (typically a YAML file). + * - ````std::string, YAML::Node``` is used when nodes are build from parameters in a YAML node. * - Any other variadic list of inputs is possible. * - * - Examples of specific factories existing in Wolf are: - * \code - * - * // FactorySensor - * typedef Factory<SensorBase, // Type of objects to be returned: SensorBasePtr - * const std::string&, // Type of the sensor: name of the derived sensor class - * const Eigen::VectorXd&, // Sensor extrinsics - * const ParamsSensorBasePtr> // Sensor parameters - * FactorySensor; - * - * // FactoryProcessor - * typedef Factory<ProcessorBase, // Type of object returned: ProcessorBasePtr - * const std::string&, // Type of the processor: name of the derived processor class - * const ParamsProcessorBasePtr> // Parameters for creating the processor - * FactoryProcessor; - * - * // AutoConfProcessorFactory - * typedef Factory<ProcessorBase, // Type of object returned: ProcessorBasePtr - * const std::string&, // Type of the processor: name of the derived processor class - * const ParamsServer> // Parameters for creating the processor - * AutoConfProcessorFactory; - * - * // Landmarks from YAML - * typedef Factory<LandmarkBase, // Type of node created: LandmarkBasePtr - * const YAML::Node&> // YAML node with the lmk params - * LandmarkFactory; - * \endcode + * - Examples of specific factories existing in Wolf are in ````factory_landmark.h````, ````factory_map.h````, + * ````factory_processor.h````, ````factory_sensor.h````, ````factory_solver.h````, ````factory_state_block.h````, ````factory_tree_manager.h```` * * ### Operation of the factory * @@ -94,7 +68,7 @@ namespace wolf * * Once specialized, this factory can create objects of classes deriving from TypeBase. * - * > For example, if you want to make a Landmark factory, set TypeBase = LandmarkBase.\n + * > For example, if you want to make a Landmark factory, set TypeBase = LandmarkBasePtr.\n * > Then, the factory will create specific landmarks deriving from LandmarkBase.\n * > The specific type of landmark (e.g. LandmarkCorner2d, LandmarkAHP, LandmarkPolyline2d, etc) is indicated by a string that we call TYPE in this documentation. * @@ -127,13 +101,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> FactoryParamsSensor; - * typedef Factory<ParamsProcessorBase, std::string> FactoryParamsProcessor; - * typedef Factory<LandmarkBase, YAML::Node> FactoryLandmark; - * typedef Factory<SensorBase, - * const std::string&, - * const Eigen::VectorXd&, - * const ParamsSensorBasePtr> FactorySensor; + * typedef Factory<LandmarkBasePtr, const YAML::Node&> FactoryLandmark; + * typedef Factory<StateBlockPtr, const Eigen::VectorXd&, bool> FactoryStateBlock; * * \endcode * @@ -162,17 +131,15 @@ namespace wolf * The API puts into play the two template parameters: * * \code - * static TypeBase* create( const TypeInput& ); + * static std::shared_ptr<TypeBase> create( const TypeInput& ); * \endcode * - * This API includes an element of type TypeInput, which might be either a std::string, or a YAML::node: - * - ````std::string```` is used to indicate the name of a configuration file. These files are usually YAML files containing configuration data to create your object. - * - ````YAML::Node```` is used to access parts of a YAML file already encoded as nodes, such as when loading landmarks from a SLAM map stored as a YAML file. + * This API includes elements defined as TypeInput, which might be one or more inputs. * - * Two examples: + * For the two examples introduced before, the corresponding creators would be: * * \code - * static ParamsSensorBasePtr create(const std::string& _intrinsics_dot_yaml) + * static StateBlockPtr create(const Eigen::VectorXd& _state, bool _fixed) * static LandmarkBasePtr create(const YAML::Node& _lmk_yaml_node) * \endcode * @@ -231,7 +198,7 @@ namespace wolf * You can find this code in the landmark_polyline_2d.cpp file. * * \code - * // Creator (this method is static): + * // Creator (this method is static): * LandmarkBasePtr LandmarkPolyline2d::create(const YAML::Node& _lmk_node) * { * // Parse YAML node with lmk info and data @@ -260,10 +227,10 @@ namespace wolf * * \code * // Register landmark creator (put the register code inside an unnamed namespace): - * namespace - * { - * const bool registered_lmk_polyline_2d = FactoryLandmark::registerCreator("LandmarkPolyline2d", LandmarkPolyline2d::create); - * } + * namespace + * { + * const bool registered_lmk_polyline_2d = FactoryLandmark::registerCreator("LandmarkPolyline2d", LandmarkPolyline2d::create); + * } * * \endcode * diff --git a/include/core/common/wolf.h b/include/core/common/wolf.h index eda4914d26f887017074d5f52da1fec6ab7eeabe..82f3f1ea1869bdbec0235024b98978174305f355 100644 --- a/include/core/common/wolf.h +++ b/include/core/common/wolf.h @@ -256,7 +256,6 @@ WOLF_STRUCT_PTR_TYPEDEFS(ParamsProcessorBase); // Trajectory WOLF_PTR_TYPEDEFS(TrajectoryBase); - // - Frame WOLF_PTR_TYPEDEFS(FrameBase); WOLF_LIST_TYPEDEFS(FrameBase); diff --git a/include/core/frame/frame_base.h b/include/core/frame/frame_base.h index 5c138e018d5d5a9fc7df08fa6efa3675763f968a..8a366ebccad93c0f26f0368238e84f2e93b6ce51 100644 --- a/include/core/frame/frame_base.h +++ b/include/core/frame/frame_base.h @@ -70,28 +70,6 @@ class FrameBase : public NodeBase, public HasStateBlocks, public std::enable_sha StateBlockPtr _o_ptr = nullptr, StateBlockPtr _v_ptr = nullptr); - // /** \brief Constructor with type, time stamp and state pointer - // * - // * Constructor with type, time stamp and state pointer - // * \param _ts is the time stamp associated to this frame, provided in seconds - // * \param _frame_structure StateKeys (string) with the state keys - // * \param _state VectorComposite containing the state of each key - // **/ - // FrameBase(const TimeStamp& _ts, - // const StateKeys& _frame_structure, - // const VectorComposite& _state); - - // /** \brief Constructor with type, time stamp and state pointer - // * - // * Constructor with type, time stamp and state pointer - // * \param _ts is the time stamp associated to this frame, provided in seconds - // * \param _frame_structure StateKeys (string) with the state keys - // * \param _vectors std::list of VectorXd containing the state of each key - // **/ - // FrameBase(const TimeStamp& _ts, - // const StateKeys& _frame_structure, - // const std::list<VectorXd>& _vectors); - /** \brief Constructor time stamp and specs composite * * Constructor with time stamp and specs composite diff --git a/include/core/landmark/factory_landmark.h b/include/core/landmark/factory_landmark.h index 5e162739e35601302db94a26fd31c246f5a52b97..8d8783ff2ba5e734eb7f3c3705a3eb54c1304411 100644 --- a/include/core/landmark/factory_landmark.h +++ b/include/core/landmark/factory_landmark.h @@ -21,13 +21,6 @@ //--------LICENSE_END-------- #pragma once -namespace wolf -{ -class LandmarkBase; -} - -#include <unordered_map> - // wolf #include "core/common/factory.h" @@ -78,7 +71,7 @@ namespace wolf * auto corner_ptr = FactoryLandmark::create("LandmarkCorner", _node); * \endcode * - * We RECOMMEND using the macro WOLF_LANDMARK_CREATE(LandmarkClass) to automatically add the landmark creator, provided in 'landmark_base.h'. + * We RECOMMEND using the macro ````WOLF_LANDMARK_CREATE(LandmarkClass)```` to automatically add the landmark creator, provided in ````landmark_base.h````. * * To do so, you should implement a constructor with the API: * @@ -119,7 +112,7 @@ namespace wolf * \endcode * * Automatic registration is recommended in wolf, and implemented in the classes shipped with it using the macro - * WOLF_REGISTER_LANDMARK(LandmarkType). + * ````WOLF_REGISTER_LANDMARK(LandmarkType)```` in ````landmark_base.h````. * You are free to comment out these lines and place them wherever you consider it more convenient for your design. * * #### Example 2: creating landmarks @@ -151,7 +144,7 @@ namespace wolf * \endcode */ -typedef Factory<std::shared_ptr<LandmarkBase>, +typedef Factory<LandmarkBasePtr, const YAML::Node&> FactoryLandmark; template<> diff --git a/include/core/landmark/landmark_base.h b/include/core/landmark/landmark_base.h index 57c8f0da040893f2b2663fa61ac401320ed8c03c..ae001390ec1a4a6b0b2bfb84e45040567f5b7b12 100644 --- a/include/core/landmark/landmark_base.h +++ b/include/core/landmark/landmark_base.h @@ -21,11 +21,11 @@ //--------LICENSE_END-------- #pragma once -// Fwd references -namespace wolf{ -class MapBase; -class StateBlock; -} +// // Fwd references +// namespace wolf{ +// class MapBase; +// class StateBlock; +// } //Wolf includes #include "core/common/wolf.h" diff --git a/include/core/map/factory_map.h b/include/core/map/factory_map.h index 8ce6f81e875742a3db35253a44c881da4fcf58b1..74fca7e2f34829ecb624337535ffbf80e6fa186d 100644 --- a/include/core/map/factory_map.h +++ b/include/core/map/factory_map.h @@ -21,11 +21,6 @@ //--------LICENSE_END-------- #pragma once -namespace wolf -{ -class MapBase; -} - // wolf #include "core/common/factory.h" @@ -58,19 +53,16 @@ namespace wolf * Map creators have the following API: * * \code - * static MapBasePtr create(ParamsMapBasePtr _params_map); + * static MapBasePtr create(const YAML::Node& _params_node); * \endcode * * They follow the general implementation shown below: * * \code - * static MapBasePtr create(ParamsMapBasePtr _params_map) + * static MapBasePtr create(const YAML::Node& _params_node) * { - * // cast map parameters to good type --- example: ParamsMapGrid - * auto params_ptr = std::static_pointer_cast<ParamsMapGrid>(_params_map); - * * // Do create the Map object --- example: MapGrid - * return map_ptr = std::make_shared<MapGrid>(params_ptr); + * return map_ptr = std::make_shared<MapGrid>(_params_node); * } * \endcode * @@ -81,31 +73,7 @@ namespace wolf * To create e.g. a MapGrid, you type: * * \code - * auto grid_ptr = FactoryMap::create("MapGrid", params_grid); - * \endcode - * - * #### See also - * - FactoryParamsMap: to create parameter structs deriving from ParamsMapBase directly from YAML files. - * - * #### Example 1: writing a MapGrid creator - * Here is an example of MapGrid::create() extracted from map_grid.cpp: - * - * \code - * static MapBasePtr create(const std::string& _unique_name, Eigen::VectorXd& _extrinsics_pq, ParamsMapBasePtr _intrinsics) - * { - * // check extrinsics vector - * assert(_extrinsics_pq.size() == 7 && "Bad extrinsics vector length. Should be 7 for 3d."); - * - * // cast instrinsics to good type - * auto intrinsics_ptr = std::static_pointer_cast<ParamsMapGrid>(_intrinsics); - * - * // Do create the MapGrid object, and complete its setup - * auto sen_ptr = std::make_shared<MapGrid>(_extrinsics_pq, intrinsics_ptr); - * - * sen_ptr->setName(_unique_name); - * - * return sen_ptr; - * } + * auto grid_ptr = FactoryMap::create("MapGrid", _params_node); * \endcode * * #### Example 2: registering a map creator into the factory @@ -138,37 +106,8 @@ namespace wolf * Automatic registration is recommended in wolf, and implemented in the classes shipped with it. * You are free to comment out these lines and place them wherever you consider it more convenient for your design. * - * #### Example 2: creating maps - * We finally provide the necessary steps to create a map of class MapGrid in our application: - * - * \code - * #include "core/map/factory_map.h" - * #include "core/map/map_grid.h" // provides MapGrid - * - * // Note: MapGrid::create() is already registered, automatically. - * - * using namespace wolf; - * int main() { - * - * // To create a grid, provide: - * // a type = "MapGrid" and - * // a pointer to the intrinsics struct: - * - * // Create a pointer to the struct of map parameters stored in a YAML file ( see FactoryParamsMap ) - * ParamsMapGridPtr params_1 = - * FactoryParamsMap::create("ParamsMapGrid", - * grid_1.yaml); - * - * MapBasePtr grid_1_ptr = - * FactoryMap::create ( "MapGrid" , - * params_1 ); - * - * return 0; - * } - * \endcode - * */ -typedef Factory<std::shared_ptr<MapBase>, const YAML::Node&> FactoryMap; +typedef Factory<MapBasePtr, const YAML::Node&> FactoryMap; template<> inline std::string FactoryMap::getClass() const diff --git a/include/core/processor/factory_processor.h b/include/core/processor/factory_processor.h index 9ce372e6503f37423f9e7237aa64e14e133b8bfa..190268a72d07f1e1f737ead266c2c6452f55dc9a 100644 --- a/include/core/processor/factory_processor.h +++ b/include/core/processor/factory_processor.h @@ -21,22 +21,17 @@ //--------LICENSE_END-------- #pragma once -namespace wolf -{ -class ProcessorBase; -struct ParamsProcessorBase; -} - // wolf #include "core/common/factory.h" -// std +// yaml +#include "yaml-cpp/yaml.h" namespace wolf { /** \brief Processor factory class * - * This factory can create objects of classes deriving from ProcessorBase. + * In this file, two factories are defined that can create objects of classes deriving from ProcessorBase. * * Specific object creation is invoked by create(TYPE, params), and the TYPE of processor is identified with a string. * For example, the following processor types are implemented, @@ -60,24 +55,41 @@ namespace wolf * Processor creators have the following API: * * \code - * static ProcessorBasePtr create(const std::string& _name, ParamsProcessorBasePtr _params_processor); + * static ProcessorBasePtr create(const YAML::Node& _server); + * static ProcessorBasePtr create(const std::string& _schema, + * const std::string& _yaml_filepath, + * std::vector<std::string>& _folders_schema); * \endcode * * They follow the general implementation shown below: * * \code - * static ProcessorBasePtr create(const std::string& _unique_name, ParamsProcessorBasePtr _params_processor) + * static ProcessorBasePtr create(const YAML::Node& _server) * { - * // cast processor parameters to good type --- example: ParamsProcessorOdom3d - * auto params_processor_ptr = std::static_pointer_cast<ParamsProcessorOdom3d>(_params_processor); - * + * // Do create the Processor Parameters --- example: ParamsProcessorOdom3d + * auto params = std::make_shared<ParamsProcessorOdom3d>(_server); + * * // Do create the Processor object --- example: ProcessorOdom3d - * auto prc_ptr = std::make_shared<ProcessorOdom3d>(params_processor_ptr); - * - * // Complete the processor setup with a unique name identifying the processor - * prc_ptr->setName(_unique_name); - * - * return prc_ptr; + * return std::make_shared<ProcessorOdom3d>(params); + * } + * static ProcessorBasePtr create(const std::string& _schema, + * const std::string& _yaml_filepath, + * std::vector<std::string>& _folders_schema) + * { + * // parse the yaml file + * auto server = yaml_schema_cpp::YamlServer(_folders_schema, _yaml_filepath); + * + * // Check that the yaml has all necessary inforamtion + * if (not server.applySchema(_schema)) + * { + * throw std::runtime_error(server.getLog()); + * } + * + * // Do create the Processor Parameters --- example: ParamsProcessorOdom3d + * auto params = std::make_shared<ParamsProcessorOdom3d>(server.getNode()); + * + * // Do create the Processor object --- example: ProcessorOdom3d + * return std::make_shared<ProcessorOdom3d>(params); * } * \endcode * @@ -88,36 +100,20 @@ namespace wolf * To create a ProcessorOdom2d, you type: * * \code - * auto prc_odom2d_ptr = FactoryProcessor::create("ProcessorOdom2d", "main odometry", params_ptr); + * auto camera_ptr = FactoryProcessor::create("ProcessorOdom2d", yaml_node); * \endcode * - * #### Example 1 : Create a sensor and its processor - * We provide the necessary steps to create a processor of class ProcessorOdom2d in our application, - * and bind it to a SensorOdom2d: + * or: * * \code - * #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 FactorySensor for details) - * SensorBasePtr sensor_ptr = FactorySensor::create ( "SensorOdom2d" , "Main odometer" , extrinsics , &intrinsics ); - * - * // To create a odometry integrator, provide a type="ProcessorOdom2d", a name="main odometry", and a pointer to the parameters struct: - * - * auto params = make_shared<ParamsProcessorOdom2d>({...}); // fill in the derived struct (note: ProcessorOdom2d actually has no input params) - * - * ProcessorBasePtr processor_ptr = - * FactoryProcessor::create ( "ProcessorOdom2d" , "main odometry" , params ); - * - * // Bind processor to sensor - * sensor_ptr->addProcessor(processor_ptr); + * auto camera_ptr = FactoryProcessorYaml::create("ProcessorOdom2d", "path_of_params_file.yaml", schema_folders_vector); * \endcode + * + * We RECOMMEND using the macro ````WOLF_PROCESSOR_CREATE(ProcessorClass, ParamsProcessorClass)```` to automatically + * generate the processor creators, provided in 'processor_base.h'. * */ -typedef Factory<std::shared_ptr<ProcessorBase>, +typedef Factory<ProcessorBasePtr, const YAML::Node&> FactoryProcessor; template<> inline std::string FactoryProcessor::getClass() const diff --git a/include/core/sensor/factory_sensor.h b/include/core/sensor/factory_sensor.h index 9980b4c6c08434b4fdb84eb3c596b3508e5d6bf7..4dfd6801fc182fb009fbacefea1d8ea9b5751d35 100644 --- a/include/core/sensor/factory_sensor.h +++ b/include/core/sensor/factory_sensor.h @@ -105,6 +105,9 @@ namespace wolf * * // Do create the Sensor Parameters --- example: ParamsSensorCamera * auto params = std::make_shared<ParamsSensorCamera>(server.getNode()); + * + * // Do create the Sensor States priors + * auto priors = SpecSensorComposite(_server["states"]); * * // Do create the Sensor object --- example: SensorCamera * auto sensor = std::make_shared<SensorCamera>(params, priors); @@ -123,18 +126,19 @@ namespace wolf * To create e.g. a SensorCamera in 3D, you type: * * \code - * auto camera_ptr = FactorySensor::create("SensorCamera", param_server); + * auto camera_ptr = FactorySensor::create("SensorCamera", yaml_node); * \endcode * * or: * * \code - * auto camera_ptr = FactorySensorYaml::create("SensorCamera", yaml_filepath); + * auto camera_ptr = FactorySensorYaml::create("SensorCamera", "path_of_params_file.yaml", schema_folders_vector); * \endcode * * where ABSOLUTELY ALL input parameters are important. DO NOT USE IT WITH DUMMY PARAMETERS! * - * We RECOMMEND using the macro WOLF_SENSOR_CREATE(SensorClass, ParamsSensorClass) to automatically add the sensor creator, provided in 'sensor_base.h'. + * We RECOMMEND using the macro ````WOLF_SENSOR_CREATE(SensorClass, ParamsSensorClass)```` to automatically + * generate the sensor creators, provided in 'sensor_base.h'. * * To do so, you should implement a constructor with the API: * diff --git a/include/core/sensor/sensor_base.h b/include/core/sensor/sensor_base.h index 0627f903b9762b64eb451b30747df5008e3981aa..1d95026379e6ffc8284ae3e675847e473f590a77 100644 --- a/include/core/sensor/sensor_base.h +++ b/include/core/sensor/sensor_base.h @@ -51,9 +51,7 @@ namespace wolf { * In order to use this macro, the derived sensor class, SensorClass, * must have two constructors available with the API: * - * SensorClass(const std::string& _unique_name, - * SizeEigen _dim, - * ParamsSensorClassPtr _params, + * SensorClass(ParamsSensorClassPtr _params, * const SpecSensorComposite& _priors) * * Also, there should be the schema file 'SensorClass.schema' containing the specifications diff --git a/include/core/state_block/factory_state_block.h b/include/core/state_block/factory_state_block.h index 31b87e960309f464278f202f1c0557730948e611..12c1b8e0601eb2abc322898247c288a789f1e331 100644 --- a/include/core/state_block/factory_state_block.h +++ b/include/core/state_block/factory_state_block.h @@ -35,18 +35,12 @@ namespace wolf * and the TYPE of state block is identified with a string. * For example, the following processor types are implemented, * - "StateBlock" for StateBlock + * - "StatePoint3d" for StatePoint3d + * - "StatePoint2d" for StatePoint2d * - "StateQuaternion" for StateQuaternion * - "StateAngle" for StateAngle * - "StateHomogeneous3d" for StateHomogeneous3d * - * The factory also creates state blocks according to the block key used in to identify state blocks in each Wolf node. - * These keys are single-letter strings. The following letters are implemented - * - "O" for 2d orientation, creates StateAngle - * - "O" for 3d orientation, creates StateQuaternion - * - "H" crestes StateHomogeneous3d - * - * Any other letter creates the base StateBlock. - * * Find general Factory documentation in class Factory: * - Access the factory * - Register/unregister creators @@ -72,11 +66,7 @@ namespace wolf * } * \endcode * - * #### Creating processors - * Note: Prior to invoking the creation of a processor of a derived type, - * you must register the creator for this type into the factory. - * - * Note: State blocks of the base type do not need to be registered. + * #### Examples: * * To create a StateQuaternion, you type: * @@ -84,42 +74,13 @@ namespace wolf * auto sq_ptr = FactoryStateBlock::create("StateQuaternion", Vector4d(1,0,0,0), false); * \endcode * - * If your problem has dimension 3 (e.g. is 3D), you can use the key "O" to create a StateQuaternion, - * - * \code - * auto sq_ptr = FactoryStateBlock::create("O", Vector4d(1,0,0,0), false); - * \endcode - * - * However if your problem has dimension 2 (e.g. is 2D), the key "O" will create a StateAngle, - * - * \code - * auto sa_ptr = FactoryStateBlock::create("O", Vector1d(angle_in_radians), false); - * \endcode - * - * Note: It is an error to provide state vectors of the wrong size (4 for 3D orientation, 1 for 2D). - * * To create StateBlocks to store 2D position and velocity, you type: * * \code - * auto sp2_ptr = FactoryStateBlock::create("StateBlock", Vector2d(1,2), false); - * auto sv2_ptr = FactoryStateBlock::create("StateBlock", Vector2d(1,2), false); - * \endcode - * - * To create StateBlocks to store 2D position and velocity, you can also use the key letters: - * - * \code - * auto sp2_ptr = FactoryStateBlock::create("P", Vector2d(1,2), false); - * auto sv2_ptr = FactoryStateBlock::create("V", Vector2d(1,2), false); + * auto sp2_ptr = FactoryStateBlock::create("StatePoint2d", Vector2d(1,2), false); + * auto sv2_ptr = FactoryStateBlock::create("StateVector2d", Vector2d(1,2), false); * \endcode * - * To create StateBlocks to store 3D position and velocity, you type: - * - * \code - * auto sp3_ptr = FactoryStateBlock::create("P", Vector3d(1,2,3), false); - * auto sv3_ptr = FactoryStateBlock::create("V", Vector3d(1,2,3), false); - * \endcode - * - * Note: for base state blocks, the size is determined by the size of the provided vector parameter `VectorXd& _state`. */ typedef Factory<std::shared_ptr<StateBlock>, const Eigen::VectorXd&, bool> FactoryStateBlock; template<> @@ -140,14 +101,14 @@ inline std::string FactoryStateBlockIdentityVector::getClass() const return "FactoryStateBlockIdentityVector"; } -#define WOLF_REGISTER_STATEBLOCK(StateBlockType) \ - namespace \ - { \ - const bool WOLF_UNUSED StateBlockType##Registered = \ - FactoryStateBlock::registerCreator(#StateBlockType, StateBlockType::create); \ - const bool WOLF_UNUSED StateBlockType##IdentityRegistered = \ - FactoryStateBlockIdentity::registerCreator(#StateBlockType, StateBlockType::createIdentity); \ - const bool WOLF_UNUSED StateBlockType##IdentityVectorRegistered = \ - FactoryStateBlockIdentityVector::registerCreator(#StateBlockType, StateBlockType::Identity); \ - } +#define WOLF_REGISTER_STATEBLOCK(StateBlockType) \ +namespace \ +{ \ +const bool WOLF_UNUSED StateBlockType##Registered = \ + FactoryStateBlock::registerCreator(#StateBlockType, StateBlockType::create); \ +const bool WOLF_UNUSED StateBlockType##IdentityRegistered = \ + FactoryStateBlockIdentity::registerCreator(#StateBlockType, StateBlockType::createIdentity); \ +const bool WOLF_UNUSED StateBlockType##IdentityVectorRegistered = \ + FactoryStateBlockIdentityVector::registerCreator(#StateBlockType, StateBlockType::Identity); \ +} } \ No newline at end of file diff --git a/include/core/tree_manager/factory_tree_manager.h b/include/core/tree_manager/factory_tree_manager.h index 8c3df91f865ae1136d97a495452dff1f550910ba..b4feeb0d04829f59cb486b343e3094cf5f0e27cd 100644 --- a/include/core/tree_manager/factory_tree_manager.h +++ b/include/core/tree_manager/factory_tree_manager.h @@ -21,16 +21,11 @@ //--------LICENSE_END-------- #pragma once -namespace wolf -{ -class TreeManagerBase; -struct ParamsTreeManagerBase; -} - // wolf #include "core/common/factory.h" // std +#include "yaml-cpp/yaml.h" namespace wolf { diff --git a/include/core/tree_manager/tree_manager_base.h b/include/core/tree_manager/tree_manager_base.h index 3217b1268ba4fee62ba65b80743d4f87650393af..6317f37b7ce45a93c39c14e9dbd56facd3cf866b 100644 --- a/include/core/tree_manager/tree_manager_base.h +++ b/include/core/tree_manager/tree_manager_base.h @@ -57,7 +57,7 @@ static TreeManagerBasePtr create(const std::string& _yaml_filepath, \ if (not server.applySchema(#TreeManagerClass)) \ { \ - WOLF_ERROR(server.getLog()); \ + WOLF_ERROR(server.getLog()); \ return nullptr; \ } \ auto params = std::make_shared<ParamsTreeManagerClass>(server.getNode()); \ diff --git a/src/feature/feature_base.cpp b/src/feature/feature_base.cpp index fcef79178934508f840a2a2d51b918b85827c1af..777e9188ec11195cc4a6568c1b4cf44f5f7b2bac 100644 --- a/src/feature/feature_base.cpp +++ b/src/feature/feature_base.cpp @@ -139,7 +139,7 @@ bool FeatureBase::hasFactor(FactorBaseConstPtr _factor) const void FeatureBase::getFactorList(FactorBaseConstPtrList & _fac_list) const { - // FIXME + // FIXME? _fac_list.insert(_fac_list.end(), factor_list_.begin(), factor_list_.end()); }