Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
122a3384
Commit
122a3384
authored
5 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Document FactorySensor
parent
50c40374
No related branches found
No related tags found
1 merge request
!350
Resolve "Factory documentation"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/core/sensor/factory_sensor.h
+13
-53
13 additions, 53 deletions
include/core/sensor/factory_sensor.h
with
13 additions
and
53 deletions
include/core/sensor/factory_sensor.h
+
13
−
53
View file @
122a3384
...
@@ -27,27 +27,21 @@ namespace wolf
...
@@ -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.
* 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,
* Currently, the following sensor types are implemented,
* - "SensorOdom2d" for SensorOdom2d
* - "SensorOdom2d"
for SensorOdom2d
* - "SensorOdom3d" for SensorOdom3d
* - "SensorOdom3d"
for SensorOdom3d
* - "SensorDiffDrive" for SensorDiffDrive
* - "SensorDiffDrive" for SensorDiffDrive
* - "SensorCamera" for SensorCamera // in plugin 'vision'
* - "SensorCamera"
for SensorCamera
// in plugin 'vision'
* - "SensorLaser2d" for SensorLaser2d // in plugin 'laser'
* - "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.
:
*
Find general Factory documentation in class Factory
:
* -
SensorCamera -> `"SensorCamera"`
* -
Access the factory
* -
SensorLaser2d -> `"SensorLaser2d"`
* -
Register/unregister creators
* -
etc.
* -
Invoke object creation
*
*
* The methods to create specific sensors are called __creators__.
* This documentation shows you how to use the FactorySensor specifically:
* 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:
* - Write sensor creators.
* - Write sensor creators.
* - Register and unregister creators
* - Create sensors
* - Create sensors
*
*
* #### Write sensor creators
* #### Write sensor creators
...
@@ -57,7 +51,7 @@ namespace wolf
...
@@ -57,7 +51,7 @@ namespace wolf
* static SensorBasePtr create(const std::string& _name, Eigen::VectorXd& _params_extrinsics, ParamsSensorBasePtr _params_sensor);
* static SensorBasePtr create(const std::string& _name, Eigen::VectorXd& _params_extrinsics, ParamsSensorBasePtr _params_sensor);
* \endcode
* \endcode
*
*
* The follow the general implementation shown below:
* The
y
follow the general implementation shown below:
*
*
* \code
* \code
* static SensorBasePtr create(const std::string& _unique_name, Eigen::VectorXd& _params_extrinsics, ParamsSensorBasePtr _params_sensor)
* static SensorBasePtr create(const std::string& _unique_name, Eigen::VectorXd& _params_extrinsics, ParamsSensorBasePtr _params_sensor)
...
@@ -78,40 +72,6 @@ namespace wolf
...
@@ -78,40 +72,6 @@ namespace wolf
* }
* }
* \endcode
* \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
* #### Creating sensors
* Note: Prior to invoking the creation of a sensor of a particular type,
* Note: Prior to invoking the creation of a sensor of a particular type,
* you must register the creator for this type into the factory.
* you must register the creator for this type into the factory.
...
@@ -119,7 +79,7 @@ namespace wolf
...
@@ -119,7 +79,7 @@ namespace wolf
* To create e.g. a SensorCamera, you type:
* To create e.g. a SensorCamera, you type:
*
*
* \code
* \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
* \endcode
*
*
* where ABSOLUTELY ALL input parameters are important. In particular, the sensor name "Front-left camera" will be used to identify this camera
* 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
...
@@ -130,7 +90,7 @@ namespace wolf
* - FactoryProcessor: to create processors that will be bound to sensors.
* - FactoryProcessor: to create processors that will be bound to sensors.
* - Problem::installSensor() : to install sensors in WOLF Problem.
* - 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:
* Here is an example of SensorCamera::create() extracted from sensor_camera.cpp:
*
*
* \code
* \code
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment