import{S as Ne,i as Fe,s as qe,e as r,k as i,w as S,t as u,M as Me,c as a,d as n,m as c,a as o,x as A,h as f,b as s,G as t,g as E,y as V,L as We,q as k,o as U,B as C,v as Be}from"../../chunks/vendor-hf-doc-builder.js";import{D as M}from"../../chunks/Docstring-hf-doc-builder.js";import{I as He}from"../../chunks/IconCopyLink-hf-doc-builder.js";function Je(Pe){let h,K,v,g,W,w,oe,B,se,Q,l,L,le,G,ie,D,ce,pe,_,O,me,H,de,ue,b,R,fe,J,he,ve,$,P,ge,j,_e,X,p,T,be,N,$e,x,ye,Ee,y,I,we,z,Le,Y,F,De,Z;return w=new He({}),L=new M({props:{name:"class simulate.RLEnv",anchor:"simulate.RLEnv",parameters:[{name:"scene_or_map_fn",val:": typing.Union[typing.Callable, simulate.scene.Scene]"},{name:"n_maps",val:": typing.Optional[int] = 1"},{name:"n_show",val:": typing.Optional[int] = 1"},{name:"time_step",val:": typing.Optional[float] = 0.03333333333333333"},{name:"frame_skip",val:": typing.Optional[int] = 4"},{name:"**engine_kwargs",val:""}],source:"https://github.com/huggingface/simulate/blob/vr_294/src/simulate/rl/rl_env.py#L40"}}),O=new M({props:{name:"reset",anchor:"simulate.RLEnv.reset",parameters:[],source:"https://github.com/huggingface/simulate/blob/vr_294/src/simulate/rl/rl_env.py#L188",returnDescription:`
<p>the observation of the environment after reset.</p>
`,returnType:`
<p>obs (<code>Dict</code>)</p>
`}}),R=new M({props:{name:"sample_action",anchor:"simulate.RLEnv.sample_action",parameters:[],source:"https://github.com/huggingface/simulate/blob/vr_294/src/simulate/rl/rl_env.py#L223",returnDescription:`
<p>TODO</p>
`,returnType:`
<p>action</p>
`}}),P=new M({props:{name:"step",anchor:"simulate.RLEnv.step",parameters:[{name:"action",val:": typing.Union[typing.Dict, typing.List, numpy.ndarray]"}],parametersDescription:[{anchor:"simulate.RLEnv.step.action",description:"<strong>action</strong> (<code>Dict</code> or <code>List</code>) &#x2014; TODO verify, a dict with actuator tags as keys and as values a Tensor of shape (n_show, n_actors, n_actions)",name:"action"}],source:"https://github.com/huggingface/simulate/blob/vr_294/src/simulate/rl/rl_env.py#L113",returnDescription:`
<p>TODO
reward (<code>float</code>): TODO
done (<code>bool</code>): TODO
info: TODO</p>
`,returnType:`
<p>observation (<code>Dict</code>)</p>
`}}),T=new M({props:{name:"class simulate.ParallelRLEnv",anchor:"simulate.ParallelRLEnv",parameters:[{name:"env_fn",val:": typing.Callable"},{name:"n_parallel",val:": int"},{name:"starting_port",val:": int = 55001"}],parametersDescription:[{anchor:"simulate.ParallelRLEnv.env_fn",description:"<strong>env_fn</strong> (<code>Callable</code>) &#x2014; a generator function that returns a RLEnv for generating instances of the desired environment.",name:"env_fn"},{anchor:"simulate.ParallelRLEnv.n_parallel",description:"<strong>n_parallel</strong> (<code>int</code>) &#x2014; the number of executable instances to create.",name:"n_parallel"},{anchor:"simulate.ParallelRLEnv.starting_port",description:"<strong>starting_port</strong> (`int) &#x2014; initial communication port for spawned executables.",name:"starting_port"}],source:"https://github.com/huggingface/simulate/blob/vr_294/src/simulate/rl/parallel_rl_env.py#L33"}}),I=new M({props:{name:"step",anchor:"simulate.ParallelRLEnv.step",parameters:[{name:"actions",val:": typing.Union[<built-in function array>, NoneType] = None"}],parametersDescription:[{anchor:"simulate.ParallelRLEnv.step.actions",description:"<strong>actions</strong> (<code>Dict</code> or <code>List</code>) &#x2014; TODO verify, a dict with actuator tags as keys and as values a Tensor of shape (n_show, n_actors, n_actions)",name:"actions"}],source:"https://github.com/huggingface/simulate/blob/vr_294/src/simulate/rl/parallel_rl_env.py#L62",returnDescription:`
<p>TODO
all_reward (<code>float</code>): TODO
all_done (<code>bool</code>): TODO
all_info: TODO</p>
`,returnType:`
<p>all_observation (<code>Dict</code>)</p>
`}}),{c(){h=r("meta"),K=i(),v=r("h1"),g=r("a"),W=r("span"),S(w.$$.fragment),oe=i(),B=r("span"),se=u("RL Environment Wrappers"),Q=i(),l=r("div"),S(L.$$.fragment),le=i(),G=r("p"),ie=u(`RL environment wrapper for Simulate scene. Uses functionality from the VecEnv in stable baselines 3
For more information on VecEnv, see the source
`),D=r("a"),ce=u("https://stable-baselines3.readthedocs.io/en/master/guide/vec_envs.html"),pe=i(),_=r("div"),S(O.$$.fragment),me=i(),H=r("p"),de=u("Resets the actors and the scene of the environment."),ue=i(),b=r("div"),S(R.$$.fragment),fe=i(),J=r("p"),he=u("Samples an action from the actors in the environment. This function loads the configuration of maps and actors to return the correct shape across multiple configurations."),ve=i(),$=r("div"),S(P.$$.fragment),ge=i(),j=r("p"),_e=u("The step function for the environment, follows the API from OpenAI Gym."),X=i(),p=r("div"),S(T.$$.fragment),be=i(),N=r("p"),$e=u(`Parallel RL environment wrapper for Simulate scene. Spawns multiple backend executables to run in parallel, in addition to the optionality of multiple maps.
Uses functionality from the VecEnv in stable baselines 3. For more information on VecEnv, see the source
`),x=r("a"),ye=u("https://stable-baselines3.readthedocs.io/en/master/guide/vec_envs.html"),Ee=i(),y=r("div"),S(I.$$.fragment),we=i(),z=r("p"),Le=u("The step function for the environment, follows the API from OpenAI Gym."),Y=i(),F=r("p"),De=u("Under construction \u{1F6A7}."),this.h()},l(e){const m=Me('[data-svelte="svelte-1phssyn"]',document.head);h=a(m,"META",{name:!0,content:!0}),m.forEach(n),K=c(e),v=a(e,"H1",{class:!0});var ee=o(v);g=a(ee,"A",{id:!0,class:!0,href:!0});var Te=o(g);W=a(Te,"SPAN",{});var xe=o(W);A(w.$$.fragment,xe),xe.forEach(n),Te.forEach(n),oe=c(ee),B=a(ee,"SPAN",{});var Ie=o(B);se=f(Ie,"RL Environment Wrappers"),Ie.forEach(n),ee.forEach(n),Q=c(e),l=a(e,"DIV",{class:!0});var d=o(l);A(L.$$.fragment,d),le=c(d),G=a(d,"P",{});var Oe=o(G);ie=f(Oe,`RL environment wrapper for Simulate scene. Uses functionality from the VecEnv in stable baselines 3
For more information on VecEnv, see the source
`),D=a(Oe,"A",{href:!0,rel:!0});var Se=o(D);ce=f(Se,"https://stable-baselines3.readthedocs.io/en/master/guide/vec_envs.html"),Se.forEach(n),Oe.forEach(n),pe=c(d),_=a(d,"DIV",{class:!0});var te=o(_);A(O.$$.fragment,te),me=c(te),H=a(te,"P",{});var Ae=o(H);de=f(Ae,"Resets the actors and the scene of the environment."),Ae.forEach(n),te.forEach(n),ue=c(d),b=a(d,"DIV",{class:!0});var ne=o(b);A(R.$$.fragment,ne),fe=c(ne),J=a(ne,"P",{});var Ve=o(J);he=f(Ve,"Samples an action from the actors in the environment. This function loads the configuration of maps and actors to return the correct shape across multiple configurations."),Ve.forEach(n),ne.forEach(n),ve=c(d),$=a(d,"DIV",{class:!0});var re=o($);A(P.$$.fragment,re),ge=c(re),j=a(re,"P",{});var ke=o(j);_e=f(ke,"The step function for the environment, follows the API from OpenAI Gym."),ke.forEach(n),re.forEach(n),d.forEach(n),X=c(e),p=a(e,"DIV",{class:!0});var q=o(p);A(T.$$.fragment,q),be=c(q),N=a(q,"P",{});var Re=o(N);$e=f(Re,`Parallel RL environment wrapper for Simulate scene. Spawns multiple backend executables to run in parallel, in addition to the optionality of multiple maps.
Uses functionality from the VecEnv in stable baselines 3. For more information on VecEnv, see the source
`),x=a(Re,"A",{href:!0,rel:!0});var Ue=o(x);ye=f(Ue,"https://stable-baselines3.readthedocs.io/en/master/guide/vec_envs.html"),Ue.forEach(n),Re.forEach(n),Ee=c(q),y=a(q,"DIV",{class:!0});var ae=o(y);A(I.$$.fragment,ae),we=c(ae),z=a(ae,"P",{});var Ce=o(z);Le=f(Ce,"The step function for the environment, follows the API from OpenAI Gym."),Ce.forEach(n),ae.forEach(n),q.forEach(n),Y=c(e),F=a(e,"P",{});var Ge=o(F);De=f(Ge,"Under construction \u{1F6A7}."),Ge.forEach(n),this.h()},h(){s(h,"name","hf:doc:metadata"),s(h,"content",JSON.stringify(je)),s(g,"id","simulate.RLEnv"),s(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(g,"href","#simulate.RLEnv"),s(v,"class","relative group"),s(D,"href","https://stable-baselines3.readthedocs.io/en/master/guide/vec_envs.html"),s(D,"rel","nofollow"),s(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),s(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),s($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),s(l,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),s(x,"href","https://stable-baselines3.readthedocs.io/en/master/guide/vec_envs.html"),s(x,"rel","nofollow"),s(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),s(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,m){t(document.head,h),E(e,K,m),E(e,v,m),t(v,g),t(g,W),V(w,W,null),t(v,oe),t(v,B),t(B,se),E(e,Q,m),E(e,l,m),V(L,l,null),t(l,le),t(l,G),t(G,ie),t(G,D),t(D,ce),t(l,pe),t(l,_),V(O,_,null),t(_,me),t(_,H),t(H,de),t(l,ue),t(l,b),V(R,b,null),t(b,fe),t(b,J),t(J,he),t(l,ve),t(l,$),V(P,$,null),t($,ge),t($,j),t(j,_e),E(e,X,m),E(e,p,m),V(T,p,null),t(p,be),t(p,N),t(N,$e),t(N,x),t(x,ye),t(p,Ee),t(p,y),V(I,y,null),t(y,we),t(y,z),t(z,Le),E(e,Y,m),E(e,F,m),t(F,De),Z=!0},p:We,i(e){Z||(k(w.$$.fragment,e),k(L.$$.fragment,e),k(O.$$.fragment,e),k(R.$$.fragment,e),k(P.$$.fragment,e),k(T.$$.fragment,e),k(I.$$.fragment,e),Z=!0)},o(e){U(w.$$.fragment,e),U(L.$$.fragment,e),U(O.$$.fragment,e),U(R.$$.fragment,e),U(P.$$.fragment,e),U(T.$$.fragment,e),U(I.$$.fragment,e),Z=!1},d(e){n(h),e&&n(K),e&&n(v),C(w),e&&n(Q),e&&n(l),C(L),C(O),C(R),C(P),e&&n(X),e&&n(p),C(T),C(I),e&&n(Y),e&&n(F)}}}const je={local:"simulate.RLEnv",title:"RL Environment Wrappers"};function ze(Pe){return Be(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ye extends Ne{constructor(h){super();Fe(this,h,ze,Je,qe,{})}}export{Ye as default,je as metadata};
