Closed varunagrawal closed 2 years ago
We could also maybe add an OptionalFactor
to gtsam/hybrid
which serves as a wrapper around regular factors and provides the enforce_
flag. That way the signature would be DCMixtureFactor<OptionalFactor<ContactEqualityFactor>>
.
Hmmm, not loving it, and the OptionalFactor goes towards the better way to handle in hybrid. Maybe it is even better to just have the ability to have a nullptr as component in a mixture? No need for extra c++ hassle (OptionalFactor), as long as we document it well?
That sounds doable. An alternative I was thinking of was doing was using the base Factor
class, so we could do DCMixtureFactor<Factor>
and have one component be JacobianFactor(key1, Matrix::Zero(), b1, key2, Matrix::Zero(), b2)
.
A nullptr
is a billion dollar mistake after all.
That sounds doable. An alternative I was thinking of was doing was using the base
Factor
class, so we could doDCMixtureFactor<Factor>
and have one component beJacobianFactor(key1, Matrix::Zero(), b1, key2, Matrix::Zero(), b2)
.A
nullptr
is a billion dollar mistake after all.
We already explicitly allow nullptrs in Factor graphs. As long as you document and test well this is the cleanest solution, and it is also the fastest in terms of computation time. No need for dummy factors that output zero.
@dellaert I've removed the enforce_equality
flag. I'll be using just a large covariance value for the noise model.
The
ContactEqualityFactor
is a bit half-baked (which is my fault) so making amends with this PR. Added traits and a bunch of other niceties to make it work in proper optimization.~~The most important change is the flag
enforce_equality_
which if set to true activates the factor, else returns error zero. This is so that it can be used directly with theDCMixtureFactor
where it is set to true for stance feet and false for everything else.~~