The factory will be able to create state blocks on the fly given:
a key: string to identify the state block
a Eigen::VectorXd with the state
a bool with fixed/unfixed
Strings will be identified as follows:
"O", a quaternion if Vector::size() == 4;
"O", an angle if Vector::size() == 1;
"O3", "Q", "Quaternion", "StateQuaternion": a state quaternion. The size must be 4.
"O2", "A", "Angle", "StateAngle": a state angle. The size must be 1.
"H3", "Homogeneous3D", a 3D homogeneous vector. The size must be 4.
"P","V","I","W",... and many other letters: a regular SB. The size is that given by the provided Eigen::Vector.
"Base", "Vector": a regular SB . The size is that given by the provided Eigen::Vector.
That is, any string other than "O, O3, Q, Quaternion, StateQuaternion, O2, A, Angle, StateAngle, H3 or Homogeneous3D" will produce a regular state block of the size indicated by the vector, and without local parametrization.
See that for orientations, the size is given as part of the string.
Edited
Designs
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related.
Learn more.
@joanvallve would you have a look at this? I mean, the specification, and the implementation.
I implemented a minimal version of the proposal above:
There are these pre-defined creators, which are already registered when loading WOLF:
"StateQuaternion", "StateAngle" and "StateHomogeneous3d" return the proper class.
"O", returns a quaternion if Vector::size() == 4;
"O", returns an angle if Vector::size() == 1;
"O" throws a std::length_error if the vector size is not 1 or 4.
"H", is TO BE IMPLEMENTED, but will return an homogeneous 3D vector. Not clear what to do for homogeneous 2D vectors, that's why I did not implement it yet.
Then, if calling the Factory with any other string, instead of throwing an error (as other factories do), the return is a valid state block with the provided vector as state:
"StateBlock" returns a regular StateBlock. The size is that given by the provided Eigen::Vector.
"P","V","I","W",... and many other letters: return a regular SB. The size is that given by the provided Eigen::Vector.
"Base", "Vector": a regular SB . The size is that given by the provided Eigen::Vector.
These second group of strings is not defined anywhere. It's just that, by default, regular StateBlocks are created.
Sorry, I have some doubts. Are this letters going to be the key in hasStateBlocks? What about a sensor or a frame containing more than one state block refering to orientation information?
Can we have 2 state blocks of the same type in the same HasStateBlocks object? I guess no since they would have the same key, right? Can a Quaternion have a different key than "O"?
Do we have to register a letter with an specific type of state block if we want a StateAngle/Quaternion/Homogeneous..?
Yes, you can have several SB of the same type with different keys inside StateBlockComposite, which is the main data in HasStateBlocks. You do:
Vector1droll,pitch,yaw;// need Eigen::Vector for the factory below to work// construct the SBsconstauto&SBr=FactoryStateBlock::get().create("StateBlockAngle",roll);constauto&SBp=FactoryStateBlock::get().create("StateBlockAngle",pitch);constauto&SBy=FactoryStateBlock::get().create("StateBlockAngle",yaw);// add it to the stateBlockCompositeFrame/Sensor/Landmark/Capture->addStateBlock("r",SBr);// rollFrame/Sensor/Landmark/Capture->addStateBlock("p",SBp);// pitchFrame/Sensor/Landmark/Capture->addStateBlock("y",SBy);// yaw