diff --git a/src/entities/Factor.jl b/src/entities/Factor.jl index e5af5d04..843fb09e 100644 --- a/src/entities/Factor.jl +++ b/src/entities/Factor.jl @@ -128,6 +128,26 @@ function FactorDFG( timestamp = TimeDateZone(timestamp.utc_datetime) end + #TODO move to core constructor + if !isempty(multihypo) && length(multihypo) != length(variableorder) + throw( + ArgumentError( + "multihypo length ($(length(multihypo))) must match the number of variables ($(length(variableorder))). " * + "See fractional data-association uncertainty docs.", + ), + ) + end + if length(variableorder) == 1 && observation isa AbstractRelativeObservation + throw( + ArgumentError( + "Relative observation $(typeof(observation)) requires at least two variables, but only one was provided: $variableorder. Use a subtype of AbstractPriorObservation for single-variable factors.", + ), + ) + end + allunique(variableorder) || throw( + ArgumentError("Variable order must be unique, got duplicates in $variableorder"), + ) + # create factor data hyper = Recipehyper(; multihypo, nullhypo, inflation) state = Recipestate() diff --git a/src/entities/Variable.jl b/src/entities/Variable.jl index 71e22328..b4d18ca6 100644 --- a/src/entities/Variable.jl +++ b/src/entities/Variable.jl @@ -124,6 +124,7 @@ function VariableDFG( if solvable isa Int solvable = Ref(solvable) end + tags = tags isa Set ? tags : Set{Symbol}(tags) union!(tags, [:VARIABLE]) P = getPointType(T) diff --git a/src/services/compare.jl b/src/services/compare.jl index 20a25a68..6d6516ac 100644 --- a/src/services/compare.jl +++ b/src/services/compare.jl @@ -215,7 +215,11 @@ function compareVariable( union!(skiplist, skip) # TP = TP && compareAll(A.states, B.states; skip = skiplist, show = show) - Ad = getState(A, :default) #FIXME why onlly comparing default? + #FIXME why only comparing hardcoded default? + if !hasState(A, :default) && !hasState(B, :default) + return false + end + Ad = getState(A, :default) Bd = getState(B, :default) # TP = TP && compareAll(A.attributes, B.attributes, skip=[:variableType;], show=show)