JuliaPlanners / PDDLViz.jl

A library for visualizing and animating PDDL domains.
Apache License 2.0
10 stars 1 forks source link

Rendering error with door-key-gem domain when the "walls" problem object contains all zeros #26

Closed prizzorome closed 2 months ago

prizzorome commented 2 months ago

In the door-key-gem domain, if one starts from an initial state with no obstacles, i.e., where the "walls" contain all zeros (i.e., there are no obstacles), and the goal of having gem3 or gem1, the error "type PathNode has no field parent_id" occurs when rendering the solution, as shown in the two traces below.

Please notice that the renderer works fine with the trajectory, as shown by the attached screenshot, i.e., by executing the following instructions: plan = collect(sol) trajectory = PDDL.simulate(domain, state, plan) canvas = renderer(domain, trajectory)

has gem1 plan trajectory visible on canvas (small)

In summary, the issue specifically concerns the instruction "canvas = renderer(domain, state, sol)" executed in the conditions described above.

# error 1 Julia> sol = astar(domain, state, pddl"(has gem3)") # gem3 is in the bottom right corner PathSearchSolution{GenericState, DataStructures.PriorityQueue{UInt64, Tuple{Float32, Float32, Int64}, Base.Order.ForwardOrdering}} status: :success plan: 8-element Vector{Term} (right) (right) (right) (right) (right) (right) (right) (pickup gem3)

Julia> canvas = renderer(domain, state, sol) ERROR: type PathNode has no field parent_id Stacktrace: [1] getproperty @ .\Base.jl:37 [inlined] [2] (::PDDLViz.var"#275#291"{GridworldRenderer, Vector{Observable{Vector{Point{2, Float32}}}}, Vector{Observable{Vector{Point{2, Float32}}}}, Vector{Const}})(sol::PathSearchSolution{GenericState, DataStructures.PriorityQueue{UInt64, Tuple{Float32, Float32, Int64}, Base.Order.ForwardOrdering}}) @ PDDLViz C:\Users\a.julia\packages\PDDLViz\DEHUI\src\renderers\gridworld\path_search.jl:49 [3] on(f::Any, observable::Observables.AbstractObservable; weak::Bool, priority::Int64, update::Bool) @ Observables C:\Users\a.julia\packages\Observables\YdEbO\src\Observables.jl:368 [4] on @ C:\Users\a.julia\packages\Observables\YdEbO\src\Observables.jl:361 [inlined] [5] render_sol!(canvas::Canvas, renderer::GridworldRenderer, domain::GenericDomain, state::Observable{GenericState}, sol::Observable{PathSearchSolution{GenericState, DataStructures.PriorityQueue{UInt64, Tuple{Float32, Float32, Int64}, Base.Order.ForwardOrdering}}}; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ PDDLViz C:\Users\a.julia\packages\PDDLViz\DEHUI\src\renderers\gridworld\path_search.jl:31 [6] render_sol! @ C:\Users\a.julia\packages\PDDLViz\DEHUI\src\renderers\gridworld\path_search.jl:1 [inlined] [7] #render_sol!#116 @ C:\Users\a.julia\packages\PDDLViz\DEHUI\src\render.jl:137 [inlined] [8] render_sol! @ C:\Users\a.julia\packages\PDDLViz\DEHUI\src\render.jl:133 [inlined] [9] #render_sol#115 @ C:\Users\a.julia\packages\PDDLViz\DEHUI\src\render.jl:123 [inlined] [10] rendersol @ C:\Users\a.julia\packages\PDDLViz\DEHUI\src\render.jl:119 [inlined] [11] ##99 @ C:\Users\a.julia\packages\PDDLViz\DEHUI\src\interface.jl:104 [inlined] [12] (::GridworldRenderer)(domain::GenericDomain, state::GenericState, sol::PathSearchSolution{GenericState, DataStructures.PriorityQueue{UInt64, Tuple{Float32, Float32, Int64}, Base.Order.ForwardOrdering}}) @ PDDLViz C:\Users\a.julia\packages\PDDLViz\DEHUI\src\interface.jl:99 [13] top-level scope @ REPL[380]:1

# error 2 julia> sol = astar(domain, state, pddl"(has gem1)") # gem1 is in the top left corner PathSearchSolution{GenericState, DataStructures.PriorityQueue{UInt64, Tuple{Float32, Float32, Int64}, Base.Order.ForwardOrdering}} status: :success plan: 8-element Vector{Term} (up) (up) (up) (up) (up) (up) (up) (pickup gem1)

julia> canvas = renderer(domain, state, sol) ERROR: type PathNode has no field parent_id Stacktrace: [1] getproperty @ .\Base.jl:37 [inlined] [2] (::PDDLViz.var"#275#291"{GridworldRenderer, Vector{Observable{Vector{Point{2, Float32}}}}, Vector{Observable{Vector{Point{2, Float32}}}}, Vector{Const}})(sol::PathSearchSolution{GenericState, DataStructures.PriorityQueue{UInt64, Tuple{Float32, Float32, Int64}, Base.Order.ForwardOrdering}}) @ PDDLViz C:\Users\a.julia\packages\PDDLViz\DEHUI\src\renderers\gridworld\path_search.jl:49 [3] on(f::Any, observable::Observables.AbstractObservable; weak::Bool, priority::Int64, update::Bool) @ Observables C:\Users\a.julia\packages\Observables\YdEbO\src\Observables.jl:368 [4] on @ C:\Users\a.julia\packages\Observables\YdEbO\src\Observables.jl:361 [inlined] [5] render_sol!(canvas::Canvas, renderer::GridworldRenderer, domain::GenericDomain, state::Observable{GenericState}, sol::Observable{PathSearchSolution{GenericState, DataStructures.PriorityQueue{UInt64, Tuple{Float32, Float32, Int64}, Base.Order.ForwardOrdering}}}; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ PDDLViz C:\Users\a.julia\packages\PDDLViz\DEHUI\src\renderers\gridworld\path_search.jl:31 [6] render_sol! @ C:\Users\a.julia\packages\PDDLViz\DEHUI\src\renderers\gridworld\path_search.jl:1 [inlined] [7] #render_sol!#116 @ C:\Users\a.julia\packages\PDDLViz\DEHUI\src\render.jl:137 [inlined] [8] render_sol! @ C:\Users\a.julia\packages\PDDLViz\DEHUI\src\render.jl:133 [inlined] [9] #render_sol#115 @ C:\Users\a.julia\packages\PDDLViz\DEHUI\src\render.jl:123 [inlined] [10] rendersol @ C:\Users\a.julia\packages\PDDLViz\DEHUI\src\render.jl:119 [inlined] [11] ##99 @ C:\Users\a.julia\packages\PDDLViz\DEHUI\src\interface.jl:104 [inlined] [12] (::GridworldRenderer)(domain::GenericDomain, state::GenericState, sol::PathSearchSolution{GenericState, DataStructures.PriorityQueue{UInt64, Tuple{Float32, Float32, Int64}, Base.Order.ForwardOrdering}}) @ PDDLViz C:\Users\a.julia\packages\PDDLViz\DEHUI\src\interface.jl:99 [13] top-level scope @ REPL[382]:1

ztangent commented 2 months ago

Thanks for catching this! Will look into it.

ztangent commented 2 months ago

Okay I think this might be an issue due to a version mismatch between SymbolicPlanners.jl and PDDLViz.jl --- you should upgrade to the latest version of PDDLViz (v0.1.12) for compatibility with the latest version of SymbolicPlanners.jl (v0.1.24).

prizzorome commented 2 months ago

Thank you for looking into this. I have seen that I was already using the latest version of PDDLViz (v0.1.12) and the latest version of SymbolicPlanners.jl (v0.1.24). Anyway, today I have not been able to replicate the problem, so I'm afraid the latter may have been affected by some changes I did in the problem (e.g., additional objects not displayed on the grid) while I was carrying out several tests, so I am closing the issue. Thank you!