Top level API for wolf
Created by: joansola
EDIT: The keys to factories are strings, and the sensor params to be passed to the factory methods are filenames, so that we can pass YAML files directly
We need to create a WOLF api for users. A minimal skeleton of the ROS node starts by configuring the problem, as follows:
Problem problem;
problem.addSensor("SENSOR TYPE 1", "SensorName1", "sen1/params/filename");
problem.addSensor("SENSOR TYPE 2", "SensorName2", "sen2/params/filename");
[... more sensors ...];
problem.addProcessor("PROCESSOR TYPE 1", "ProcName1", "SenName1", "prc1/params1/filename");
problem.addProcessor("PROCESSOR TYPE 2", "ProcName2", "SenName2", "prc2/params2/filename");
[... more processors ...];
The methods addSensor()
and addProcessor()
act as factories. Their design is as follows.
- First, put two factories in Problem:
````
Problem::addSensor(string _type, string _sensor_name, string _params_filename)
{
SensorBase* sen_ptr = sensor_factory.createSensor( _type, _sensor_name, _params_filename);
this->addSensor(sen_ptr);
};
Problem::addProcessor(string _type, string _processor_name, string _sensor_name, string _params_filename)
{ idem... };
````
- Then, write individual factory methods
createCamera(), createIMU(), ... etc ...
that will be defined in each specific sensor class, or in the file of that class. - Also,
Problem
needs two methodsregisterSensorFactory()
andregisterProcessorFactory()
, with the appropriate API, that registers thecreateXxxx()
methods of each class that can be created in the factory. EDIT: These are not required. See post below about registering the methods to the factories. - Finally, at any given project, someone has to call, before all configuration starts, all the necessary
registerXxxxxFactory(xxxx)
. EDIT: This is not required. Only #include the desired headers. See post below about registering.