Skip to content

Commit 05bf861

Browse files
authored
Merge pull request #1802 from JuliaRobotics/23Q4/enh/derelins
DERelative Manifolds fixes
2 parents 542445f + eb17dad commit 05bf861

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

ext/IncrInfrDiffEqFactorExt.jl

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module IncrInfrDiffEqFactorExt
22

33
@info "IncrementalInference.jl is loading extensions related to DifferentialEquations.jl"
44

5+
import Base: show
6+
57
using DifferentialEquations
68
import DifferentialEquations: solve
79

@@ -15,6 +17,7 @@ using DocStringExtensions
1517

1618
export DERelative
1719

20+
import Manifolds: allocate
1821

1922

2023
getManifold(de::DERelative{T}) where {T} = getManifold(de.domain)
@@ -100,11 +103,12 @@ function _solveFactorODE!(measArr, prob, u0pts, Xtra...)
100103
# happens when more variables (n-ary) must be included in DE solve
101104
for (xid, xtra) in enumerate(Xtra)
102105
# update the data register before ODE solver calls the function
103-
prob.p[xid + 1][:] = xtra[:]
106+
prob.p[xid + 1][:] = xtra[:] # FIXME, unlikely to work with ArrayPartition, maybe use MArray and `.=`
104107
end
105108

106109
# set the initial condition
107-
prob.u0[:] = u0pts[:]
110+
prob.u0 .= u0pts
111+
108112
sol = DifferentialEquations.solve(prob)
109113

110114
# extract solution from solved ode
@@ -249,8 +253,10 @@ function IncrementalInference.sampleFactor(cf::CalcFactor{<:DERelative}, N::Int
249253
oder = cf.factor
250254

251255
# how many trajectories to propagate?
252-
# @show getLabel(cf.fullvariables[2]), getDimension(cf.fullvariables[2])
253-
meas = [zeros(getDimension(cf.fullvariables[2])) for _ = 1:N]
256+
#
257+
v2T = getVariableType(cf.fullvariables[2])
258+
meas = [allocate(getPointIdentity(v2T)) for _ = 1:N]
259+
# meas = [zeros(getDimension(cf.fullvariables[2])) for _ = 1:N]
254260

255261
# pick forward or backward direction
256262
# set boundary condition
@@ -287,7 +293,15 @@ end
287293

288294

289295

296+
function Base.show(io::IO, ::Union{<:DERelative{T,O},Type{<:DERelative{T,O}}}) where {T,O}
297+
println(io, " DERelative{")
298+
println(io, " ", T)
299+
println(io, " ", O.name.name)
300+
println(io, " }")
301+
nothing
302+
end
290303

304+
Base.show(io::IO, ::MIME"text/plain", der::DERelative) = show(io, der)
291305

292306
## the function
293307
# ode.problem.f.f

src/ExportAPI.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# the IncrementalInference API
22

3+
4+
# reexport
5+
export ℝ, AbstractManifold
6+
export Identity, hat , vee, ArrayPartition, exp!, exp, log!, log
7+
# common groups -- preferred defaults at this time.
8+
export TranslationGroup, RealCircleGroup
9+
# common non-groups -- TODO still teething problems to sort out in IIF v0.25-v0.26.
10+
export Euclidean, Circle
11+
312
# DFG SpecialDefinitions
413
export AbstractDFG,
514
getSolverParams,

src/IncrementalInference.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@ using FiniteDifferences
1919

2020
using OrderedCollections: OrderedDict
2121

22-
export ℝ, AbstractManifold
23-
# export ProductRepr
24-
# common groups -- preferred defaults at this time.
25-
export TranslationGroup, RealCircleGroup
26-
# common non-groups -- TODO still teething problems to sort out in IIF v0.25-v0.26.
27-
export Euclidean, Circle
28-
2922
import Optim
3023

3124
using Dates,

0 commit comments

Comments
 (0)