diff --git a/include/core/sensor/factory_sensor.h b/include/core/sensor/factory_sensor.h index 92f21ad2234dc39457335772803a733320f39876..3e787dd56cf710390cce53ed81d3b3800b2445b6 100644 --- a/include/core/sensor/factory_sensor.h +++ b/include/core/sensor/factory_sensor.h @@ -27,27 +27,21 @@ namespace wolf * * Specific object creation is invoked by `create(TYPE, params ... )`, and the TYPE of sensor is identified with a string. * Currently, the following sensor types are implemented, - * - "SensorOdom2d" for SensorOdom2d - * - "SensorOdom3d" for SensorOdom3d + * - "SensorOdom2d" for SensorOdom2d + * - "SensorOdom3d" for SensorOdom3d * - "SensorDiffDrive" for SensorDiffDrive - * - "SensorCamera" for SensorCamera // in plugin 'vision' - * - "SensorLaser2d" for SensorLaser2d // in plugin 'laser' + * - "SensorCamera" for SensorCamera // in plugin 'vision' + * - "SensorLaser2d" for SensorLaser2d // in plugin 'laser' * - * among others + * among others. * - * TYPE is always a std::string with literally the same text as the derived class name, e.g.: - * - SensorCamera -> `"SensorCamera"` - * - SensorLaser2d -> `"SensorLaser2d"` - * - etc. + * Find general Factory documentation in class Factory: + * - Access the factory + * - Register/unregister creators + * - Invoke object creation * - * The methods to create specific sensors are called __creators__. - * Creators must be registered to the factory before they can be invoked for sensor creation. - * - * Find general Factory documentation in class Factory. - * - * This documentation shows you how to: + * This documentation shows you how to use the FactorySensor specifically: * - Write sensor creators. - * - Register and unregister creators * - Create sensors * * #### Write sensor creators @@ -57,7 +51,7 @@ namespace wolf * static SensorBasePtr create(const std::string& _name, Eigen::VectorXd& _params_extrinsics, ParamsSensorBasePtr _params_sensor); * \endcode * - * The follow the general implementation shown below: + * They follow the general implementation shown below: * * \code * static SensorBasePtr create(const std::string& _unique_name, Eigen::VectorXd& _params_extrinsics, ParamsSensorBasePtr _params_sensor) @@ -78,40 +72,6 @@ namespace wolf * } * \endcode * - * - * - * #### Registering sensor creators - * Prior to invoking the creation of a sensor of a particular type, - * you must register the creator for this type into the factory. - * - * Registering sensor creators into the factory is done through registerCreator(). - * You provide a sensor type string (above), and a pointer to a static method - * that knows how to create your specific sensor, e.g.: - * - * \code - * FactorySensor::get().registerCreator("SensorCamera", SensorCamera::create); - * \endcode - * - * The method SensorCamera::create(...) is the creator written in the previous section. - * - * #### Achieving automatic registration - * Currently, registering is performed in each specific SensorXxxx source file, sensor_xxxx.cpp. - * For example, in sensor_camera.cpp we find the line: - * - * \code - * const bool registered_camera = FactorySensor::get().registerCreator("SensorCamera", SensorCamera::create); - * \endcode - * - * which is a static invocation (i.e., it is placed at global scope outside of the SensorCamera class). - * Therefore, at application level, all sensors that have a .cpp file compiled are automatically registered. - * - * #### Unregistering sensor creators - * The method unregisterCreator() unregisters the SensorXxx::create() method. It only needs to be passed the string of the sensor type. - * - * \code - * FactorySensor::get().unregisterCreator("SensorCamera"); - * \endcode - * * #### Creating sensors * Note: Prior to invoking the creation of a sensor of a particular type, * you must register the creator for this type into the factory. @@ -119,7 +79,7 @@ namespace wolf * To create e.g. a SensorCamera, you type: * * \code - * FactorySensor::get().create("SensorCamera", "Front-left camera", params_extrinsics, params_camera); + * auto camera_ptr = FactorySensor::get().create("SensorCamera", "Front-left camera", params_extrinsics, params_camera); * \endcode * * where ABSOLUTELY ALL input parameters are important. In particular, the sensor name "Front-left camera" will be used to identify this camera @@ -130,7 +90,7 @@ namespace wolf * - 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 + * #### Example 1: writing a SensorCamera creator * Here is an example of SensorCamera::create() extracted from sensor_camera.cpp: * * \code