rlmesh::env::Env
One environment in Gymnasium shape.
trait Envreset returns (observation, info) and step returns (observation, reward, terminated, truncated, info), as Gymnasium’s do. The server
reads the spaces, render_mode, metadata and id once, when it is
built.
A failure is an Error: return
Error::environment_recoverable
to fail one request and keep the client’s session; any other error ends
it, and the client reads [INTERNAL] {op} failed: {message}.
Also available as rlmesh::Env.
Required methods
Provided methods
- render()The current frame as an image value (cast to uint8;
[H, W, 3],[H, W, 4],[3, H, W],[4, H, W]or[H, W]are encoded, any other shape gives no frame). - close()Release the env's resources.
- render_mode()The render mode;
Noneby default. - metadata()The metadata dictionary;
Noneby default. - id()The environment identifier;
Noneserves"UnknownEnv-v1".
observation_space
required method[source]fn observation_space(&self) -> SpaceThe space observations belong to.
action_space
required method[source]fn action_space(&self) -> SpaceThe space actions belong to.
reset
required method[source]fn reset(
&mut self,
seed: Option<i64>,
options: Option<&InfoDict>,
) -> Result<(Value, InfoDict)>Start an episode with an optional seed and reset options.
step
required method[source]fn step(
&mut self,
action: Option<Value>,
) -> Result<(Value, f64, bool, bool, InfoDict)>Apply one action. The action is None when the request carries none.
render
provided method[source]fn render(&mut self) -> Result<Option<Value>>The current frame as an image value (cast to uint8; [H, W, 3],
[H, W, 4], [3, H, W], [4, H, W] or [H, W] are encoded, any other
shape gives no frame). None (the default) is no frame.
close
provided method[source]fn close(&mut self) -> Result<()>Release the env’s resources. The default does nothing, as
gymnasium.Env.close does.
render_mode
provided method[source]fn render_mode(&self) -> Option<String>The render mode; None by default.
metadata
provided method[source]fn metadata(&self) -> Option<Metadata>The metadata dictionary; None by default. Its autoreset_mode key
sets the served autoreset mode.
id
provided method[source]fn id(&self) -> Option<String>The environment identifier; None serves "UnknownEnv-v1".