Skip to content

Commit ed89ad1

Browse files
authored
Merge pull request #1672 from JuliaRobotics/23Q1/enh/metaprior
add MetaPrior for 0 numeric cases (ie model priors etc)
2 parents 487f099 + 1ede511 commit ed89ad1

File tree

7 files changed

+28
-1
lines changed

7 files changed

+28
-1
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The list below highlights breaking changes according to normal semver workflow -
2121
- Refactored, consolidated, and added more in-place operations in surrounding `ccw.measurement`.
2222
- Refactor `CommonConvWrapper` to a not non-mutable struct, with several cleanups and some updated compat requirements.
2323
- Refactor interal hard type `HypoRecipe`.
24+
- Add `MetaPrior` for adding meta data but not influencing the numerical solution.
2425

2526
# Changes in v0.31
2627
- `FactorMetaData` is deprecated and replaced by `CalcFactor`.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
4646
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
4747

4848
[compat]
49-
ApproxManifoldProducts = "0.6"
49+
ApproxManifoldProducts = "0.6.3"
5050
BSON = "0.2, 0.3"
5151
Combinatorics = "1.0"
5252
DataStructures = "0.16, 0.17, 0.18"

src/ExportAPI.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,4 +356,6 @@ export appendSeparatorToClique!
356356
export buildTreeFromOrdering! # TODO make internal and deprecate external use to only `buildTreeReset!``
357357
export makeSolverData!
358358

359+
export MetaPrior
360+
359361
#

src/Factors/MetaPrior.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Meta prior brings additional information not necessarily numerical prior
2+
3+
Base.@kwdef struct MetaPrior{T} <: AbstractPrior
4+
data::T
5+
partial::Vector{Int} = Int[]
6+
end
7+
MetaPrior(data) = MetaPrior(;data)
8+
9+
getManifold(::MetaPrior) = TranslationGroup(0)
10+
getMeasurementParametric(::MetaPrior) = MvNormal(zeros(0))
11+
12+
getSample(cf::CalcFactor{<:MetaPrior}) = SVector()

src/IncrementalInference.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ include("VariableStatistics.jl")
134134

135135
# factors needed for belief propagation on the tree
136136
include("Factors/MsgPrior.jl")
137+
include("Factors/MetaPrior.jl")
137138

138139
include("entities/CliqueTypes.jl")
139140
include("entities/JunctionTreeTypes.jl")

src/ParametricUtils.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ end
201201
function calcFactorMahalanobisDict(fg)
202202
calcFactors = OrderedDict{Symbol, CalcFactorMahalanobis}()
203203
for fct in getFactors(fg)
204+
# skip non-numeric prior
205+
getFactorType(fct) isa MetaPrior ? continue : nothing
204206
calcFactors[fct.label] = CalcFactorMahalanobis(fg, fct)
205207
end
206208
return calcFactors

test/testBasicGraphs.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,16 @@ X0reset = pts |> deepcopy
354354
end
355355

356356

357+
@testset "Test MetaPrior" begin
357358

359+
fg = generateGraph_Kaess()
360+
361+
addFactor!(fg, [:x1], MetaPrior(nothing))
362+
363+
solveGraph!(fg)
364+
IIF.solveGraphParametric!(fg)
365+
366+
end
358367

359368

360369
#

0 commit comments

Comments
 (0)