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
4384a99a
Commit
4384a99a
authored
3 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
mostly doc
parent
ae8b2c50
No related branches found
No related tags found
1 merge request
!448
Draft: Resolve "Implementation of new nodes creation"
Pipeline
#11170
failed
3 years ago
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/core/sensor/factory_sensor.h
+38
-15
38 additions, 15 deletions
include/core/sensor/factory_sensor.h
include/core/sensor/sensor_base.h
+21
-21
21 additions, 21 deletions
include/core/sensor/sensor_base.h
with
59 additions
and
36 deletions
include/core/sensor/factory_sensor.h
+
38
−
15
View file @
4384a99a
...
...
@@ -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 implementation
s
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;
* }
...
...
This diff is collapsed.
Click to expand it.
include/core/sensor/sensor_base.h
+
21
−
21
View file @
4384a99a
...
...
@@ -58,27 +58,27 @@ namespace wolf {
* ParamsSensorClassPtr _params)
*
*/
#define WOLF_SENSOR_CREATE(SensorClass, ParamsSensorClass) \
static SensorBasePtr create(const std::string& _unique_name, SizeEigen _dim, const ParamsServer& _server) \
{ \
auto params = std::make_shared<ParamsSensorClass>(_unique_name, _server); \
\
auto sensor = std::make_shared<SensorClass>(_unique_name, _dim, params, _server); \
\
return sensor; \
} \
static SensorBasePtr create(const std::string& _unique_name, SizeEigen _dim, const std::string& _yaml_file) \
{ \
auto parser = ParserYaml(_yaml_file, "", true); \
\
auto server = ParamsServer(parser.getParams()); \
\
auto params = std::make_shared<ParamsSensorClass>(_unique_name, server); \
\
auto sensor = std::make_shared<SensorClass>(_unique_name, _dim, params, server); \
\
return sensor; \
} \
#define WOLF_SENSOR_CREATE(SensorClass, ParamsSensorClass)
\
static SensorBasePtr create(const std::string& _unique_name, SizeEigen _dim, const ParamsServer& _server)
\
{
\
auto params = std::make_shared<ParamsSensorClass>(_unique_name, _server);
\
\
auto sensor = std::make_shared<SensorClass>(_unique_name, _dim, params, _server);
\
\
return sensor;
\
}
\
static SensorBasePtr create(const std::string& _unique_name, SizeEigen _dim, const std::string& _yaml_file
path
) \
{
\
auto parser = ParserYaml(_yaml_file
path
, "", true); \
\
auto server = ParamsServer(parser.getParams());
\
\
auto params = std::make_shared<ParamsSensorClass>(_unique_name, server);
\
\
auto sensor = std::make_shared<SensorClass>(_unique_name, _dim, params, server);
\
\
return sensor;
\
}
\
/** \brief base struct for intrinsic sensor parameters
*
...
...
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