Last active
November 28, 2018 22:40
-
-
Save klowrey/ced25f2cb73e222665264877f06f696f to your computer and use it in GitHub Desktop.
mujoco.jl rollouts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MuJoCo | |
function dorollout(f, T) | |
pm = mj_loadXML(f) | |
pd = mj_makeData(pm) | |
m = mj.mapmodel(pm) | |
datas = [ mj.mapdata(pm, mj_makeData(pm)) for t=1:Threads.nthreads() ] | |
@time begin | |
Threads.@threads for k=1:Threads.nthreads() | |
for t=1:T | |
mj_step(m, datas[k]) | |
end | |
end | |
end | |
for t=1:Threads.nthreads() | |
println(datas[t].d) | |
mj_deleteData(datas[t]) | |
end | |
mj_deleteModel(m) | |
end | |
f = "models/humanoid.xml" | |
dorollout(f, 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment