Skip to content

Commit ff27aa4

Browse files
authored
Merge pull request #610 from JuliaRobotics/hotfix/3Q20/608
add filters for listSolveKeys
2 parents f145c5b + 5e9f8b7 commit ff27aa4

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

src/services/AbstractDFG.jl

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,23 @@ listVariables(dfg, r"l", tags=[:APRILTAG;])
484484
Related:
485485
- ls
486486
"""
487-
function listVariables(dfg::G, regexFilter::Union{Nothing, Regex}=nothing; tags::Vector{Symbol}=Symbol[], solvable::Int=0) where G <: AbstractDFG
487+
function listVariables(dfg::AbstractDFG,
488+
regexFilter::Union{Nothing, Regex}=nothing;
489+
tags::Vector{Symbol}=Symbol[],
490+
solvable::Int=0 )
491+
#
488492
vars = getVariables(dfg, regexFilter, tags=tags, solvable=solvable)
489-
return map(v -> v.label, vars)
493+
return map(v -> v.label, vars)::Vector{Symbol}
494+
end
495+
496+
# to be consolidated, see #612
497+
function listVariables(dfg::AbstractDFG,
498+
typeFilter::Type{<:InferenceVariable};
499+
tags::Vector{Symbol}=Symbol[],
500+
solvable::Int=0 )
501+
#
502+
retlist::Vector{Symbol} = ls(dfg, typeFilter)
503+
0 < length(tags) || solvable != 0 ? intersect(retlist, ls(dfg, tags=tags, solvable=solvable)) : retlist
490504
end
491505

492506
"""
@@ -495,7 +509,7 @@ Get a list of the IDs (labels) of the DFGFactors in the DFG.
495509
Optionally specify a label regular expression to retrieves a subset of the factors.
496510
"""
497511
function listFactors(dfg::G, regexFilter::Union{Nothing, Regex}=nothing; tags::Vector{Symbol}=Symbol[], solvable::Int=0)::Vector{Symbol} where G <: AbstractDFG
498-
return map(f -> f.label, getFactors(dfg, regexFilter, tags=tags, solvable=solvable))
512+
return map(f -> f.label, getFactors(dfg, regexFilter, tags=tags, solvable=solvable))
499513
end
500514

501515
"""
@@ -506,9 +520,14 @@ Related
506520
507521
listSupersolves, getSolverDataDict, listVariables
508522
"""
509-
function listSolveKeys(dfg::AbstractDFG)
523+
function listSolveKeys(dfg::AbstractDFG,
524+
fltr::Union{Type{<:InferenceVariable},Regex, Nothing}=nothing;
525+
tags::Vector{Symbol}=Symbol[],
526+
solvable::Int=0 )
527+
#
510528
skeys = Set{Symbol}()
511-
for vs in listVariables(dfg), ky in keys(getSolverDataDict(getVariable(dfg, vs)))
529+
varList = listVariables(dfg, fltr, tags=tags, solvable=solvable)
530+
for vs in varList, ky in keys(getSolverDataDict(getVariable(dfg, vs)))
512531
push!(skeys, ky)
513532
end
514533
return skeys

test/runtests.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,10 @@ if get(ENV, "IIF_TEST", "") == "true"
8585

8686
using IncrementalInference
8787

88-
apis = [
89-
# GraphsDFG{SolverParams}(),
90-
LightDFG(solverParams=SolverParams(), userId="testUserId"),
91-
CloudGraphsDFG(solverParams=SolverParams(), userId="testUserId")
92-
]
88+
apis = [LightDFG(solverParams=SolverParams(), userId="testUserId")]
89+
haskey(ENV, "SKIP_CGDFG_TESTS") && ENV["SKIP_CGDFG_TESTS"] != "true" ? push!(apis, CloudGraphsDFG(solverParams=SolverParams(), userId="testUserId") ) : nothing
90+
# GraphsDFG{SolverParams}()
91+
9392
for api in apis
9493
@testset "Testing Driver: $(typeof(api))" begin
9594
@info "Testing Driver: $(api)"

0 commit comments

Comments
 (0)