Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weirdly stuck during access KeyEvent #30

Open
sprhawk opened this issue Jul 26, 2021 · 0 comments
Open

Weirdly stuck during access KeyEvent #30

sprhawk opened this issue Jul 26, 2021 · 0 comments

Comments

@sprhawk
Copy link

sprhawk commented Jul 26, 2021

I tried to load some complex model like this, below is code:

using LyceumBase, LyceumMuJoCo, LyceumMuJoCoViz

struct Husky{ S <: MJSim } <: AbstractMuJoCoEnvironment
    sim::S
end

LyceumMuJoCo.getsim(env::Husky) = env.sim

Husky() = first(tconstruct(Husky, 1))
function LyceumBase.tconstruct(::Type{Husky}, N::Integer)
    modelpath = joinpath(@__DIR__, "dual_ur5_husky/mobile_pick_and_place.xml")
    Tuple(Husky(s) for s in tconstruct(MJSim, N, modelpath, skip=1)) 
end

LyceumMuJoCo.getreward(state, action, obs, env::Husky) = 1.0
LyceumMuJoCo.geteval(state, action, obs, env::Husky) = 1.0

function husky_controller(env)
    setaction!(env, rand(actionspace(env)))
end
function husky_sim()
    env = Husky()
    visualize(env,
              controller = husky_controller
              )
    return env
end

Running like:

JULIA_NUM_THREADS=4 julia --project=.  -e 'include("husky.jl")' -e "husky_sim()" 

I'm using a Dell G15 (Intel i7-11800H with RTX 3060, Debian bullseye distribution)

When I run husky_sim(), most of time, after showing help message 'Press "F1" to show the help message.', then the visualize window will stuck, some time showed no scene some time showed right scene but still stuck, and I have to use many ctrl-c in julia to kill the process. and the julia process will use CPU 100% in one single thread.

I have no idea how it is happening


updated:
I run husky_sim(), it will start / show Visualization UI, and fresh rate is being updated, but except using ESC to quit, any other Key Stroke will stuck the UI, and have to use Ctrl-C in julia REPL kill julia process. But after using ESC to quit, then re-run husky_sim, it will run normally.

Updated: the LyceumMuJoCoViz.jl has version: "0.2.5"
And I tried to use pkg> dev ./LyceumMuJoCoViz.jl/ to use latest master (ee007ab) also has same behavior ( stuck )

Updated:
I added multiple printlns, and I find when stuck, it stuck at GLFW.PollEvents() here

Updated:
I don't know whether I find is correct: I found it is blocked during send event, it stuck inside on(h, obs) ( in glfw.jl ), I tried

on(obs) do val
    ....
    println(val)
    h(val)
end

It seems whenever I access val, it is blocked.

Updated:
When I access here

ev = KeyEvent(key, action, time())

if i println("event key: ", ev.key) or println("event action: ", ev.action), it will print the key value and action, and stuck during println("event: ", ev). But if I println("event time: ", ev.time), the program is not only blocked, even all other println I added for debug purpose will not be shown after shown "Press "F1" to show the help message. "

@sprhawk sprhawk changed the title visualize stuck after startup Weirdly stuck during print KeyEvent Jul 28, 2021
@sprhawk sprhawk changed the title Weirdly stuck during print KeyEvent Weirdly stuck during access KeyEvent Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant