You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# If the action to stop is taken by the robot, the human stops at a probability of p_stop this distribution needs to be returned for both stop action and go action.
if a == 0
if r == 0 && h == 0
return SparseCat([driveObservation(0,0,a), driveObservation(1,0,a)], [p_stop, 1-p_stop])
else
return Deterministic(1.0e-9)
end
elseif a == 1
if r == 0 && h == 0
return SparseCat([driveObservation(0,1,a), driveObservation(1,1,a)], [p_stop, 1-p_stop])
else
return Deterministic(1.0e-9)
end
else
return Deterministic(1.0e-9)
end
end
But when I try to solve using the pomcpow library, I get an error like this-
I get the following stack trace which has to do with driveObservation - MethodError: Cannot convert an object of type Float64 to an object of type driveObservation
Closest candidates are:
convert(::Type{T}, !Matched::T) where T
@ Base Base.jl:84
driveObservation(::Any, !Matched::Any, !Matched::Any)
@ Main ~/Fall23/aizen/pomdp_test/drive_test_jl.ipynb:2
Please check this file for how I try to create and then use POMCPOW - https://github.com/Bala-1998/pomdp_jl/blob/main/discrete_drive_pomdp/drive_test_jl.ipynb
I have defined a structure for the observation as:
struct driveObservation
h::Int
r::Int
a::Int
end
and I have defined the observation model as this -
function POMDPs.observation(pomdp::drivePOMDP, act::Int64, state::driveState)
h, r, z, phi = state.h, state.r, state.z, state.phi
a = act
p_stop = human_policy(h, r, z)
end
But when I try to solve using the pomcpow library, I get an error like this-
I get the following stack trace which has to do with driveObservation - MethodError: Cannot
convert
an object of type Float64 to an object of type driveObservationClosest candidates are:
convert(::Type{T}, !Matched::T) where T
@ Base Base.jl:84
driveObservation(::Any, !Matched::Any, !Matched::Any)
@ Main ~/Fall23/aizen/pomdp_test/drive_test_jl.ipynb:2
Stacktrace:
[1] push!(a::Vector{driveObservation}, item::Float64)
@ Base ./array.jl:1118
[2] insert_obs_node!(t::BasicPOMCP.POMCPTree{Int64, driveObservation}, pomdp::drivePOMDP, ha::Int64, sp::driveState, o::Float64)
@ BasicPOMCP ~/.julia/packages/BasicPOMCP/ba47d/src/BasicPOMCP.jl:183
[3] simulate(p::POMCPPlanner{drivePOMDP, BasicPOMCP.SolvedPORollout{RandomPolicy{Random._GLOBAL_RNG, drivePOMDP, NothingUpdater}, NothingUpdater, Random._GLOBAL_RNG}, Random._GLOBAL_RNG}, s::driveState, hnode::BasicPOMCP.POMCPObsNode{Int64, driveObservation}, steps::Int64)
@ BasicPOMCP ~/.julia/packages/BasicPOMCP/ba47d/src/solver.jl:94
[4] search(p::POMCPPlanner{drivePOMDP, BasicPOMCP.SolvedPORollout{RandomPolicy{Random._GLOBAL_RNG, drivePOMDP, NothingUpdater}, NothingUpdater, Random._GLOBAL_RNG}, Random._GLOBAL_RNG}, b::SparseCat{Vector{driveState}, Vector{Float64}}, t::BasicPOMCP.POMCPTree{Int64, driveObservation}, info::Dict{Symbol, Any})
@ BasicPOMCP ~/.julia/packages/BasicPOMCP/ba47d/src/solver.jl:32
[5] action_info(p::POMCPPlanner{drivePOMDP, BasicPOMCP.SolvedPORollout{RandomPolicy{Random._GLOBAL_RNG, drivePOMDP, NothingUpdater}, NothingUpdater, Random._GLOBAL_RNG}, Random._GLOBAL_RNG}, b::SparseCat{Vector{driveState}, Vector{Float64}}; tree_in_info::Bool)
@ BasicPOMCP ~/.julia/packages/BasicPOMCP/ba47d/src/solver.jl:6
[6] action_info
@ BasicPOMCP ~/.julia/packages/BasicPOMCP/ba47d/src/solver.jl:1 [inlined]
[7] action(p::POMCPPlanner{drivePOMDP, BasicPOMCP.SolvedPORollout{RandomPolicy{Random._GLOBAL_RNG, drivePOMDP, NothingUpdater}, NothingUpdater, Random._GLOBAL_RNG}, Random._GLOBAL_RNG}, b::SparseCat{Vector{driveState}, Vector{Float64}})
@ BasicPOMCP ~/.julia/packages/BasicPOMCP/ba47d/src/solver.jl:19
[8] top-level scope
@ ~/Fall23/aizen/pomdp_test/drive_test_jl.ipynb:2
How Do I solve this method error mismatch?
The text was updated successfully, but these errors were encountered: