@@ -45,100 +45,52 @@ Defaults to find the parametric measurement at field `Z` followed by `z`.
4545Notes
4646- Users should overload this method should their factor not default to `.Z<:ParametricType` or `.z<:ParametricType`
4747"""
48- function getParametricMeasurement end
48+ function getMeasurementParametric end
4949
50- function getParametricMeasurement (Z)
50+ function getMeasurementParametric (Z)
5151 error (" $(typeof (Z)) is not supported, please use non-parametric or open an issue if it should be" )
5252end
5353
54- function getParametricMeasurement ( Z:: Normal )
54+ function getMeasurementParametric (M :: AbstractManifold , Z:: Normal )
5555 meas = mean (Z)
5656 iσ = 1 / std (Z)^ 2
5757 return [meas], reshape ([iσ],1 ,1 )
5858end
5959
60- function getParametricMeasurement ( Z:: MvNormal )
60+ function getMeasurementParametric (M :: AbstractManifold , Z:: MvNormal )
6161 meas = mean (Z)
6262 iΣ = invcov (Z)
63- return meas, iΣ
63+ p_μ = exp (M, identity_element (M), hat (M, identity_element (M), meas))
64+ return p_μ, iΣ
6465end
6566
67+ getMeasurementParametric (Z:: Normal ) = getMeasurementParametric (TranslationGroup (1 ), Z)
68+ getMeasurementParametric (Z:: MvNormal ) = getMeasurementParametric (TranslationGroup (length (mean (Z))), Z)
69+
6670# the point `p` on the manifold is the mean
67- function getParametricMeasurement (s:: ManifoldPrior )
71+ function getMeasurementParametric (s:: ManifoldPrior )
6872 meas = s. p
6973 iΣ = invcov (s. Z)
7074 return meas, iΣ
7175end
72-
73- function getParametricMeasurement (s:: FunctorInferenceType )
76+
77+ function getMeasurementParametric (s:: AbstractFactor )
7478 if hasfield (typeof (s), :Zij )
7579 Z = s. Zij
76- @info " getParametricMeasurement falls back to using field `.Zij` by default. Extend it for more complex factors." maxlog= 1
80+ @info " getMeasurementParametric falls back to using field `.Zij` by default. Extend it for more complex factors." maxlog= 1
7781 elseif hasfield (typeof (s), :Z )
7882 Z = s. Z
79- @info " getParametricMeasurement falls back to using field `.Z` by default. Extend it for more complex factors." maxlog= 1
83+ @info " getMeasurementParametric falls back to using field `.Z` by default. Extend it for more complex factors." maxlog= 1
8084 elseif hasfield (typeof (s), :z )
8185 Z = s. z
82- @info " getParametricMeasurement falls back to using field `.z` by default. Extend it for more complex factors." maxlog= 1
86+ @info " getMeasurementParametric falls back to using field `.z` by default. Extend it for more complex factors." maxlog= 1
8387 else
8488 error (" $(typeof (s)) not supported, please use non-parametric or open an issue if it should be" )
8589 end
86- return getParametricMeasurement (Z)
90+ return getMeasurementParametric (Z)
8791end
8892
8993
90- # # ================================================================================================
91- # # Parametric binary factor utility function, used by DRT
92- # # ================================================================================================
93-
94- """
95- $SIGNATURES
96-
97- Helper function to propagate a parametric estimate along a factor chain.
98-
99- Notes
100- - Not used during mmisam inference.
101- - Expected uses are for user analysis of factors and estimates.
102- - real-time dead reckoning chain prediction.
103-
104- DevNotes
105- - FIXME consolidate with `approxConv`
106-
107- Related:
108-
109- [`getParametricMeasurement`](@ref), [`approxConv`](@ref), [`accumulateFactorMeans`](@ref), [`MutablePose2Pose2Gaussian`](@ref)
110- """
111- function solveBinaryFactorParameteric (dfg:: AbstractDFG ,
112- fct:: DFGFactor ,
113- currval:: Vector{Float64} ,
114- srcsym:: Symbol ,
115- trgsym:: Symbol ):: Vector{Float64}
116- #
117- outdims = getVariableDim (getVariable (dfg, trgsym))
118- meas = getFactorType (fct)
119- mea, = getParametricMeasurement (meas)
120- # mea = getFactorMean(fct)
121- mea_ = Vector {Vector{Float64}} ()
122- push! (mea_, mea)
123- measT = (mea_,)
124-
125- # upgrade part of #639
126- varSyms = getVariableOrder (fct)
127- Xi = getVariable .(dfg, varSyms) # (v->getVariable(dfg, v)).(varSyms)
128-
129- # calculate the projection
130- varmask = (1 : 2 )[varSyms .== trgsym][1 ]
131-
132- fmd = FactorMetadata (Xi, getLabel .(Xi), Vector {Vector{Vector{Float64}}} (), :null , nothing )
133- currval_ = Vector {Vector{Float64}} ()
134- push! (currval_, currval)
135- pts_ = approxConvBinary ( currval_, meas, outdims, fmd, measT, varidx= varmask )
136-
137- # return the result
138- @assert length (pts_[1 ]) == outdims
139- return pts_[1 ]
140- end
141-
14294
14395# # ================================================================================================
14496# # Parametric solve with Mahalanobis distance - CalcFactor
@@ -153,7 +105,7 @@ function CalcFactorMahalanobis(fct::DFGFactor)
153105 cf = getFactorType (fct)
154106 varOrder = getVariableOrder (fct)
155107
156- _meas, _iΣ = getParametricMeasurement (cf)
108+ _meas, _iΣ = getMeasurementParametric (cf)
157109 meas = typeof (_meas) <: Tuple ? _meas : (_meas,)
158110 iΣ = typeof (_iΣ) <: Tuple ? _iΣ : (_iΣ,)
159111
@@ -694,9 +646,9 @@ struct MaxMixture
694646 choice:: Base.RefValue{Int}
695647end
696648
697- function getParametricMeasurement (s:: Mixture{N,F,S,T} ) where {N,F,S,T}
698- meas = map (c-> getParametricMeasurement (c)[1 ], values (s. components))
699- iΣ = map (c-> getParametricMeasurement (c)[2 ], values (s. components))
649+ function getMeasurementParametric (s:: Mixture{N,F,S,T} ) where {N,F,S,T}
650+ meas = map (c-> getMeasurementParametric (c)[1 ], values (s. components))
651+ iΣ = map (c-> getMeasurementParametric (c)[2 ], values (s. components))
700652 return meas, iΣ
701653end
702654
0 commit comments