Skip to content
Snippets Groups Projects

Draft: Resolve "Implementation of new nodes creation"

Open Joan Vallvé Navarro requested to merge 454-implementation-of-new-nodes-creation into devel
2 files
+ 59
36
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -70,9 +70,10 @@ namespace wolf
*
* \code
* static SensorBasePtr create(const std::string& _unique_name, SizeEigen _dim, const ParamsServer& _server);
* static SensorBasePtr create(const std::string& _unique_name, SizeEigen _dim, const std::string& _yaml_filepath);
* \endcode
*
* They follow the general implementation shown below:
* They follow the general implementations shown below:
*
* \code
* static SensorBasePtr create(const std::string& _unique_name, SizeEigen _dim, const ParamsServer& _server)
@@ -85,6 +86,22 @@ namespace wolf
*
* return sensor;
* }
* static SensorBasePtr create(const std::string& _unique_name, SizeEigen _dim, const std::string& _yaml_filepath)
* {
* // parse the yaml file
* auto parser = ParserYaml(_yaml_filepath, "", true);
*
* // load the parameters
* auto server = ParamsServer(parser.getParams());
*
* // Do create the Sensor Parameters --- example: ParamsSensorCamera
* auto params = std::make_shared<ParamsSensorCamera>(_unique_name, server);
*
* // Do create the Sensor object --- example: SensorCamera
* auto sensor = std::make_shared<SensorCamera>(_unique_name, _dim, params, server);
*
* return sensor;
* }
* \endcode
*
* #### Creating sensors
@@ -97,6 +114,12 @@ namespace wolf
* auto camera_ptr = FactorySensor::create("SensorCamera", "Front-left camera", 3, param_server);
* \endcode
*
* or:
*
* \code
* auto camera_ptr = FactorySensorYaml::create("SensorCamera", "Front-left camera", 3, yaml_filepath);
* \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!
*
@@ -121,12 +144,16 @@ namespace wolf
* namespace {
* const bool registered_camera = FactorySensor::registerCreator("SensorCamera", SensorCamera::create);
* }
* namespace {
* const bool registered_camera_yaml = FactorySensorYaml::registerCreator("SensorCamera", SensorCamera::create);
* }
* main () { ... }
* \endcode
* or inside your main(), where a direct call is possible:
* \code
* main () {
* FactorySensor::registerCreator("SensorCamera", SensorCamera::create);
* FactorySensor::registerCreatorYaml("SensorCamera", SensorCamera::create);
* ...
* }
* \endcode
@@ -136,9 +163,11 @@ namespace wolf
* \code
* namespace {
* const bool registered_camera = FactorySensor::registerCreator("SensorCamera", SensorCamera::create);
* const bool registered_camera_yaml = FactorySensorYaml::registerCreator("SensorCamera", SensorCamera::create);
* }
* \endcode
* Automatic registration is recommended in wolf, and implemented in the classes shipped with it using the macro WOLF_REGISTER_SENSOR(SensorType).
* Automatic registration is recommended in wolf, and implemented in the classes shipped with it using the macros
* WOLF_REGISTER_SENSOR(SensorType) and WOLF_REGISTER_SENSOR_YAML(SensorType).
* You are free to comment out these lines and place them wherever you consider it more convenient for your design.
*
* #### Example 2: creating sensors
@@ -160,24 +189,18 @@ namespace wolf
* // the parameter server or a yaml file
*
* SensorBasePtr camera_1_ptr =
* FactorySensor::create ( "SensorCamera" ,
* "Front-left camera" ,
* extrinsics_1 ,
* intrinsics_1 );
* FactorySensor::create ( "SensorCamera",
* "Front-left camera" ,
* 3 ,
* parameter_server );
*
* // A second camera... with a different name!
*
* Eigen::VectorXd extrinsics_2(7);
*
* ParamsSensorCameraPtr intrinsics_2 =
* FactoryParamsSensor::create("ParamsSensorCamera",
* camera_2.yaml);
*
* SensorBasePtr camera_2_ptr =
* FactorySensor::create( "SensorCamera" ,
* "Front-right camera" ,
* extrinsics_2 ,
* intrinsics_2 );
* "Front-right camera" ,
* 3 ,
* yaml_filename );
*
* return 0;
* }
Loading