Skip to content
Snippets Groups Projects
Commit ceb1af00 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

New macro for createAutoConf()

parent 38eaf282
No related branches found
No related tags found
2 merge requests!313WIP: Resolve "Processor constructors and creators requiring a sensor pointer?",!305WIP: Resolve "Do not use default YAML params"
This commit is part of merge request !305. Comments created here will be created in the context of that merge request.
......@@ -18,6 +18,34 @@ class StateBlock;
namespace wolf {
/*
* Macro for defining Autoconf sensor creator.
*
* In order to use this macro, the derived sensor class, SensorClass, must have a constructor available like so:
*
* SensorClass(const VectorXs & _extrinsics, const IntrinsicsClassPtr _intrinsics);
*
*/
#define WOLF_CREATE_SENSOR_AUTO(SensorClass, IntrinsicsClass, ExtrinsicsSize) \
static SensorBasePtr createAutoConf(const std::string& _unique_name, const ParamsServer& _server) \
{ \
Eigen::VectorXs extrinsics = _server.template getParam<Eigen::VectorXs>(_unique_name + "/extrinsic/pose"); \
\
assert(extrinsics.size() == ExtrinsicsSize && "Bad extrinsics vector length."); \
\
IntrinsicsClass##Ptr params = std::make_shared<IntrinsicsClass>(_unique_name, _server); \
\
SensorClass##Ptr sensor = std::make_shared<SensorClass>(extrinsics, params); \
\
sensor ->setName(_unique_name); \
\
return sensor; \
}
/** \brief base struct for intrinsic sensor parameters
*
* Derive from this struct to create structs of sensor intrinsic parameters.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment