Skip to content

Commit

Permalink
Merge pull request #168 from JuliaRobotics/maintenance/removewarns
Browse files Browse the repository at this point in the history
fix and remove more warnings
  • Loading branch information
dehann authored Oct 4, 2018
2 parents 1ad390f + 8476d70 commit fc79fbe
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 38 deletions.
2 changes: 1 addition & 1 deletion examples/squarefixedpoint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ end
# frequencies of interest

FR = range(0.5/(2pi),stop=3.0/(2pi), length=8)
# FR = linspace(0.5/(2pi),3.0/(2pi), 8)
# FR = range(0.5/(2pi),stop=3.0/(2pi), length=8)


mc = 3
Expand Down
6 changes: 3 additions & 3 deletions src/DispatchPackedConversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ end

function convert(::Type{PackedFunctionNodeData{P}}, d::FunctionNodeData{T}) where {P <: PackedInferenceType, T <: FunctorInferenceType}
# println("convert(::Type{PackedFunctionNodeData{$P}}, d::FunctionNodeData{$T})")
warn("convert GenericWrapParam is deprecated, use CommonConvWrapper instead.")
@warn "convert GenericWrapParam is deprecated, use CommonConvWrapper instead."
mhstr = packmultihypo(d.fnc)
return PackedFunctionNodeData(d.fncargvID, d.eliminated, d.potentialused, d.edgeIDs,
string(d.frommodule), convert(P, d.fnc.usrfnc!), mhstr)
Expand All @@ -198,7 +198,7 @@ function convert(
::Type{IncrementalInference.GenericFunctionNodeData{IncrementalInference.CommonConvWrapper{F},Symbol}},
d::IncrementalInference.GenericFunctionNodeData{P,String} ) where {F <: FunctorInferenceType, P <: PackedInferenceType}
#
# warn("Unpacking Option 2, F=$(F), P=$(P)")
# @warn "Unpacking Option 2, F=$(F), P=$(P)"
usrfnc = convert(F, d.fnc)
# @show d.multihypo
mhcat = parsemultihypostr(d.multihypo)
Expand Down Expand Up @@ -254,7 +254,7 @@ end
function encodePackedType(topackdata::GenericFunctionNodeData{T, <:AbstractString}) where {T <: PackedInferenceType}
error("IncrementalInference.encodePackedType(::FunctionNodeData{T, <:AbstractString}): Unknown packed type encoding T=$(T) of $(topackdata)")
# @show T, typeof(topackdata)
# warn("Yes, its packed!")
# @warn "Yes, its packed!"
# fnctype = getfnctype(topackdata)
# @show fnc = getfield(getmodule(fnctype), Symbol("Packed$(getname(fnctype))"))
# convert(PackedFunctionNodeData{T}, topackdata)
Expand Down
16 changes: 8 additions & 8 deletions src/FactorGraph01.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function updateFullVert!(fgl::FactorGraph, exvert::ExVertex;
api::DataLayerAPI=IncrementalInference.dlapi,
updateMAPest::Bool=false )
#
warn("use of updateFullVert! should be clarified for local or remote operations.")
@warn "use of updateFullVert! should be clarified for local or remote operations."
api.updatevertex!(fgl, exvert, updateMAPest=updateMAPest)
end

Expand All @@ -139,7 +139,7 @@ function setDefaultNodeData!(v::Graphs.ExVertex,
data = nothing
if initialized
if size(initval,2) < N && size(initval, 1) == dims
warn("setDefaultNodeData! -- deprecated use of stdev.")
@warn "setDefaultNodeData! -- deprecated use of stdev."
p = kde!(initval,diag(stdev));
pN = resample(p,N)
elseif size(initval,2) < N && size(initval, 1) != dims
Expand All @@ -149,7 +149,7 @@ function setDefaultNodeData!(v::Graphs.ExVertex,
pN = kde!(initval)
end
# dims = size(initval,1) # rows indicate dimensions
sp = Int[0;] #round.(Int,linspace(dodims,dodims+dims-1,dims))
sp = Int[0;] #round.(Int,range(dodims,stop=dodims+dims-1,length=dims))
gbw = getBW(pN)[:,1]
gbw2 = Array{Float64}(length(gbw),1)
gbw2[:,1] = gbw[:]
Expand Down Expand Up @@ -283,7 +283,7 @@ end


function getVal(vA::Array{Graphs.ExVertex,1})
warn("getVal(::Vector{ExVertex}) is obsolete, use getVal.(ExVertex) instead.")
@warn "getVal(::Vector{ExVertex}) is obsolete, use getVal.(ExVertex) instead."
len = length(vA)
vals = Array{Array{Float64,2},1}()
cols = Array{Int,1}()
Expand Down Expand Up @@ -697,7 +697,7 @@ function addBayesNetVerts!(fg::FactorGraph, elimOrder::Array{Int,1})
vert.attributes["data"].BayesNetVertID = p
localapi.updatevertex!(fg, vert)
else
warn("addBayesNetVerts -- something is very wrong, should not have a Bayes net vertex")
@warn "addBayesNetVerts -- something is very wrong, should not have a Bayes net vertex"
end
end
end
Expand Down Expand Up @@ -742,7 +742,7 @@ function rmVarFromMarg(fgl::FactorGraph, fromvert::Graphs.ExVertex, gm::Array{Gr
edge = localapi.getedge(fgl, id)
if edge != nothing # hack to avoid dictionary use case
if edge.SourceVertex.exVertexId == m.index || edge.DestVertex.exVertexId == m.index
warn("removing edge $(edge.neo4jEdgeId), between $(m.index) and $(n.index)")
@warn "removing edge $(edge.neo4jEdgeId), between $(m.index) and $(n.index)"
localapi.deleteedge!(fgl, edge)
m.attributes["data"].edgeIDs = alleids[[collect(1:(i-1));collect((i+1):length(alleids))]]
localapi.updatevertex!(fgl, m)
Expand All @@ -753,7 +753,7 @@ function rmVarFromMarg(fgl::FactorGraph, fromvert::Graphs.ExVertex, gm::Array{Gr
end
# if 0 edges, delete the marginal
if length(localapi.outneighbors(fgl, m)) <= 1
warn("removing vertex id=$(m.index)")
@warn "removing vertex id=$(m.index)"
localapi.deletevertex!(fgl,m)
end
end
Expand Down Expand Up @@ -871,7 +871,7 @@ function writeGraphPdf(fgl::FactorGraph;
try
viewerapp != nothing ? (@async run(`$(viewerapp) $(filepath)`)) : nothing
catch e
warn("not able to show $(filepath) with viewerapp=$(viewerapp). Exception e=$(e)")
@warn "not able to show $(filepath) with viewerapp=$(viewerapp). Exception e=$(e)"
end
nothing
end
Expand Down
4 changes: 2 additions & 2 deletions src/FactorGraphTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ mutable struct VariableNodeData
dontmargin::Bool
VariableNodeData() = new()
function VariableNodeData(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11)
warn("Deprecated use of VariableNodeData(11 param), use 13 parameters instead")
@warn "Deprecated use of VariableNodeData(11 param), use 13 parameters instead"
new(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11, nothing, true, false, false) # TODO ensure this is initialized true is working for most cases
end
VariableNodeData(x1::Array{Float64,2},
Expand Down Expand Up @@ -385,7 +385,7 @@ function graphsGetEdge(fgl::FactorGraph, id::Int)
end

function graphsDeleteVertex!(fgl::FactorGraph, vert::Graphs.ExVertex)
warn("graphsDeleteVertex! -- not deleting Graphs.jl vertex id=$(vert.index)")
@warn "graphsDeleteVertex! -- not deleting Graphs.jl vertex id=$(vert.index)"
nothing
end

Expand Down
1 change: 0 additions & 1 deletion src/JunctionTree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ end
function newPotential(tree::BayesTree, fg::FactorGraph, var::Int, prevVar::Int, p::Array{Int,1})
firvert = localapi.getvertex(fg,var)
if (length(getData(firvert).separator) == 0)
# warn("newPotential -- sep length is 0")
if (length(tree.cliques) == 0)
addClique!(tree, fg, var)
else
Expand Down
2 changes: 1 addition & 1 deletion src/SolveTree01.jl
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ function productbelief(fg::FactorGraph,
@info "[drct]"
pGM = getPoints(dens[1])
else
warn("Unknown density product on vertid=$(vertid), lennonp=$(lennonp), lenpart=$(lenpart)")
@warn "Unknown density product on vertid=$(vertid), lennonp=$(lennonp), lenpart=$(lenpart)"
pGM = Array{Float64,2}(0,1)
end

Expand Down
7 changes: 3 additions & 4 deletions src/SolverUtilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,14 @@ function numericRootGenericRandomizedFnc!(
ccwl.cpt[Threads.threadid()].Y[1:ccwl.xDim] = ( r ).zero
else
# TODO print this output as needed
# warn("got NaN, ccwl.cpt[Threads.threadid()].particleidx = $(ccwl.cpt[Threads.threadid()].particleidx), r=$(r)")
str = "ccw.thrid_=$(Threads.threadid()), got NaN, ccwl.cpt[Threads.threadid()].particleidx = $(ccwl.cpt[Threads.threadid()].particleidx), r=$(r)\n"
ccall(:jl_, Nothing, (Any,), str)
ccall(:jl_, Nothing, (Any,), ccwl.usrfnc!)
@info str
for thatlen in 1:length(ccwl.params)
str = "thatlen=$thatlen, ccwl.params[thatlen][:, ccwl.cpt[Threads.threadid()].particleidx]=$(ccwl.params[thatlen][:, ccwl.cpt[Threads.threadid()].particleidx])\n"
ccall(:jl_, Nothing, (Any,), str)
warn(str)
@warn str
end
end
elseif ccwl.partial
Expand Down Expand Up @@ -171,7 +170,7 @@ Update the frozen node
"""
function setfreeze!(fgl::FactorGraph, sym::Symbol)
if !isInitialized(fgl, sym)
warn("Vertex $(sym) is not initialized, and won't be frozen at this time.")
@warn "Vertex $(sym) is not initialized, and won't be frozen at this time."
return nothing
end
vert = getVert(fgl, sym)
Expand All @@ -192,7 +191,7 @@ Future:
"""
function fifoFreeze!(fgl::FactorGraph)
if fgl.qfl == 0
warn("Quasi fixed-lag is enabled buyt QFL horizon is zero. Please set a valid window with FactoGraph.qfl")
@warn "Quasi fixed-lag is enabled buyt QFL horizon is zero. Please set a valid window with FactoGraph.qfl"
end

tofreeze = fgl.fifo[1:(end-fgl.qfl)]
Expand Down
6 changes: 3 additions & 3 deletions test/fourdoortest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ addFactor!(fg,[:x6;:x7], LinearConditional( Normal(60.0,2.0)) )

ensureAllInitialized!(fg)

mlc = MixturePrior(Normal.(doors[1,:], bws[1]), 0.25*ones(4))
global mlc = MixturePrior(Normal.(doors[1,:], bws[1]), 0.25*ones(4))

# getSample(mlc)

Expand All @@ -59,7 +59,7 @@ addFactor!(fg,[:x7], mlc )


# HMM computed ground truth, extended for 7 poses with landmark
gt = Dict{Symbol, Array{Float64,2}}()
global gt = Dict{Symbol, Array{Float64,2}}()
gt[:x0]=reshape(Float64[0.0;1.97304 ],2,1) # -0.0342366
gt[:x2]=reshape(Float64[50.0; 2.83153 ],2,1) # 49.8797
gt[:x3]=reshape(Float64[100.0; 1.65557 ],2,1) # 99.8351
Expand All @@ -70,7 +70,7 @@ gt[:x7]=reshape(Float64[300.0; 2.14353 ],2,1) # 298.467
gt[:l1]=reshape(Float64[165.0; 1.17284 ],2,1) # 164.102


tree = prepBatchTree!(fg, drawpdf=false);
global tree = prepBatchTree!(fg, drawpdf=false);

# list vertices in fg
@show xx,ll = ls(fg)
Expand Down
30 changes: 15 additions & 15 deletions test/testBayesTreeChordalProp.jl
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
using IncrementalInference
# using KernelDensityEstimate, Gadfly # for vstack

fg = emptyFactorGraph()

N=100
global fg = emptyFactorGraph()

doors = [-100.0;0.0;100.0;300.0]'
cov = [3.0]
global N=100

global doors = [-100.0;0.0;100.0;300.0]'
global cov = [3.0]

v1 = addNode!(fg,:x1,ContinuousScalar,N=N)
f1 = addFactor!(fg,[v1], Obsv2(doors, cov', [1.0]))

global v1 = addNode!(fg,:x1,ContinuousScalar,N=N)
global f1 = addFactor!(fg,[v1], Obsv2(doors, cov', [1.0]))

# tem = 2.0*randn(1,N)+getVal(v1)+50.0
v2 = addNode!(fg,:x2, ContinuousScalar, N=N)
global v2 = addNode!(fg,:x2, ContinuousScalar, N=N)
addFactor!(fg,[v1;v2],Odo([50.0]',[2.0]',[1.0]))

v3=addNode!(fg,:x3,ContinuousScalar, N=N)
global v3=addNode!(fg,:x3,ContinuousScalar, N=N)
addFactor!(fg,[v2;v3],Odo([50.0]',[4.0]',[1.0]))

v4=addNode!(fg,:x4,ContinuousScalar, N=N)
global v4=addNode!(fg,:x4,ContinuousScalar, N=N)
addFactor!(fg,[v3;v4],Odo([50.0]',[2.0]',[1.0]))

v5=addNode!(fg,:x5,ContinuousScalar, N=N)
global v5=addNode!(fg,:x5,ContinuousScalar, N=N)
addFactor!(fg,[v4;v5],Odo([50.0]',[2.0]',[1.0]))


l1=addNode!(fg, :l1, ContinuousScalar, N=N)
global l1=addNode!(fg, :l1, ContinuousScalar, N=N)
addFactor!(fg, [v3,l1], Ranged([64.0],[0.5],[1.0]))

l2=addNode!(fg, :l2, ContinuousScalar, N=N)
global l2=addNode!(fg, :l2, ContinuousScalar, N=N)
addFactor!(fg, [v4,l2], Ranged([16.0],[0.5],[1.0]))

l3=addNode!(fg, :l3, ContinuousScalar, N=N)
global l3=addNode!(fg, :l3, ContinuousScalar, N=N)
addFactor!(fg, [v5,l3], Ranged([16.0],[0.5],[1.0]))


# writeGraphPdf(fg);

tree = prepBatchTree!(fg,drawpdf=true);
global tree = prepBatchTree!(fg,drawpdf=true);
# run(`evince bt.pdf`)

# do belief propagation inference over tree once
Expand Down

0 comments on commit fc79fbe

Please sign in to comment.