Factor class - code review
Some comments we have came through here when I was working on FactorIMU
.
Currently, most Constraint classes are used with operator() method that is using a template argument T. Then, the arguments are mapped into whatever you need. But the argument of type 'const T* const' could be anything.
so : some things I have done in FactorIMU
and I consider to do in the other constraint methods :
- replace 'const T const'* by 'const T &' (should be exactly the same just makes the code more readable)
- have stronger conditions on input arguments (if possible)
- try to avoid the use of maps --> problems are detected only while running. This goes with the point just above.
- if asserts are needed, try to use static_asserts from Eigen that will detect possible problems at compilation.
I did this for the expectation() method in FactorIMU
.
Any comment ?
Edited by Joan Vallvé Navarro