Processor constructors and creators requiring a sensor pointer?
In processors, we have the following:
// Factory methods
static ProcessorBasePtr create(..., const SensorBasePtr sensor_ptr = nullptr);
static ProcessorBasePtr createAutoConf(..., const SensorBasePtr sensor_ptr = nullptr);
But the only processor using the sensor pointer in ProcessorXxx::create()
is ProcessorOdom3D
. This is so because the constructor of ProcessorOdom3D
wants a pointer to the sensor.
And no one uses it in createAutoConf()
.
For me, this raises an old topic: should constructors systematically require a pointer to the parent in the wolf tree?
Since we now arranged the linking through emplace
, I think having the constructor accept a pointer to parent is now mostly unnecessary.
So the answer to the question above is NO. At least in the general case, for all nodes except Processors.
For processors, however, there is this need of accessing sensor parameters for configuration. This is now done through prc->configure(sensor)
, but @joanvallve was proposing to make it otherwise with a emplaceDerived
(if I remember well).
So the answer for processors is, again, NO.
So I suggest to remove this part of the API and have processor constructors and creators free from the sensor pointer.
The API for create()
and createAutoConf()
would be:
// Factory methods
static ProcessorBasePtr create(const std::string& _unique_name, const ProcessorParamsBasePtr _params);
static ProcessorBasePtr createAutoConf(const std::string& _unique_name, const ParamsServer& _server);