@@ -17,7 +17,7 @@ using DocStringExtensions
17
17
18
18
export DERelative
19
19
20
- import Manifolds: allocate
20
+ import Manifolds: allocate, compose, hat, Identity, vee, log
21
21
22
22
23
23
getManifold (de:: DERelative{T} ) where {T} = getManifold (de. domain)
@@ -67,7 +67,7 @@ function DERelative(
67
67
# backward time problem
68
68
bproblem = problemType (f, state1, (tspan[2 ], tspan[1 ]), datatuple; dt = - dt)
69
69
# build the IIF recognizable object
70
- return DERelative (domain, fproblem, bproblem, datatuple, getSample)
70
+ return DERelative (domain, fproblem, bproblem, datatuple) # , getSample)
71
71
end
72
72
73
73
function DERelative (
@@ -88,11 +88,11 @@ function DERelative(
88
88
domain,
89
89
f,
90
90
data;
91
- dt = dt ,
92
- state0 = state0 ,
93
- state1 = state1 ,
94
- tspan = tspan ,
95
- problemType = problemType ,
91
+ dt,
92
+ state0,
93
+ state1,
94
+ tspan,
95
+ problemType,
96
96
)
97
97
end
98
98
#
162
162
function (cf:: CalcFactor{<:DERelative} )(measurement, X... )
163
163
#
164
164
meas1 = measurement[1 ]
165
- diffOp = measurement[2 ]
165
+ M = measurement[2 ]
166
+ # diffOp = measurement[2]
166
167
167
168
oderel = cf. factor
168
169
@@ -193,12 +194,15 @@ function (cf::CalcFactor{<:DERelative})(measurement, X...)
193
194
# # FIXME , obviously this is not going to work for more compilcated groups/manifolds -- must fix this soon!
194
195
# @show cf._sampleIdx, solveforIdx, meas1
195
196
196
- # FIXME
197
- res = zeros (size (X[2 ], 1 ))
198
- for i = 1 : size (X[2 ], 1 )
199
- # diffop( reference?, test? ) <===> ΔX = test \ reference
200
- res[i] = diffOp[i](X[solveforIdx][i], meas1[i])
201
- end
197
+ res_ = compose (M, inv (M, X[solveforIdx]), meas1)
198
+ res = vee (M, Identity (M), log (M, Identity (M), res_))
199
+
200
+ # #FIXME 0
201
+ # res = zeros(size(X[2], 1))
202
+ # for i = 1:size(X[2], 1)
203
+ # # diffop( reference?, test? ) <===> ΔX = test \ reference
204
+ # res[i] = diffOp[i](X[solveforIdx][i], meas1[i])
205
+ # end
202
206
return res
203
207
end
204
208
@@ -260,23 +264,25 @@ function IncrementalInference.sampleFactor(cf::CalcFactor{<:DERelative}, N::Int
260
264
261
265
# pick forward or backward direction
262
266
# set boundary condition
263
- u0pts = if cf. solvefor == 1
267
+ u0pts, M = if cf. solvefor == 1
264
268
# backward direction
265
269
prob = oder. backwardProblem
270
+ M_ = getManifold (getVariableType (cf. fullvariables[1 ]))
266
271
addOp, diffOp, _, _ = AMP. buildHybridManifoldCallbacks (
267
- convert (Tuple, getManifold ( getVariableType (cf . fullvariables[ 1 ])) ),
272
+ convert (Tuple, M_ ),
268
273
)
269
274
# getBelief(cf.fullvariables[2]) |> getPoints
270
- cf. _legacyParams[2 ]
275
+ cf. _legacyParams[2 ], M_
271
276
else
272
277
# forward backward
273
278
prob = oder. forwardProblem
279
+ M_ = getManifold (getVariableType (cf. fullvariables[2 ]))
274
280
# buffer manifold operations for use during factor evaluation
275
281
addOp, diffOp, _, _ = AMP. buildHybridManifoldCallbacks (
276
- convert (Tuple, getManifold ( getVariableType (cf . fullvariables[ 2 ])) ),
282
+ convert (Tuple, M_ ),
277
283
)
278
284
# getBelief(cf.fullvariables[1]) |> getPoints
279
- cf. _legacyParams[1 ]
285
+ cf. _legacyParams[1 ], M_
280
286
end
281
287
282
288
# solve likely elements
@@ -287,7 +293,8 @@ function IncrementalInference.sampleFactor(cf::CalcFactor{<:DERelative}, N::Int
287
293
# _solveFactorODE!(meas, prob, u0pts, i, _maketuplebeyond2args(cf._legacyParams...)...)
288
294
end
289
295
290
- return map (x -> (x, diffOp), meas)
296
+ # return meas, M
297
+ return map (x -> (x, M), meas)
291
298
end
292
299
# getDimension(oderel.domain)
293
300
0 commit comments