Table of Contents

Class HumanoidStandupEnvV5

Namespace
Gym.Environments.Envs.MuJoCo
Assembly
Gym.Environments.dll

HumanoidStandup-v5: the humanoid lying on the ground, rewarded for raising its torso. The reward pays the torso's height over the time step plus 1, and charges the squared controls and the external contact forces; the episode never ends on its own (make's 1000-step limit truncates it). Byte for byte what Gymnasium's HumanoidStandup-v5 computes on MuJoCo 4.0.0 (DR-61, DR-64).

[PyName("HumanoidStandupEnv")]
public class HumanoidStandupEnvV5 : MujocoEnv, IEnv, IDisposable, IDynamicAttributes
Inheritance
HumanoidStandupEnvV5
Implements
Inherited Members
Extension Methods

Remarks

Observation: as HumanoidEnvV5's, 348 values by default. Reward: z / timestep - ctrl_cost_weight * sum(ctrl**2) - clip(impact_cost_weight * sum(cfrc_ext**2), *impact_cost_range) + 1, all float64. uph_cost_weight is taken and kept but never used, as in Gymnasium. Info: x_position, y_position, z_distance_from_origin, tendon_length, tendon_velocity, reward_linup, reward_quadctrl, reward_impact; the reset's info holds the first five.

Not thread-safe. Reference: gymnasium/envs/mujoco/humanoidstandup_v5.py.

Its info reads typed (DR-91): HumanoidStandupInfoV5 info = step.Info; (HumanoidStandupInfoV5), with the dict's own values still behind the indexer.

Constructors

HumanoidStandupEnvV5(HumanoidStandupEnvV5Options)

Builds the instance from its options record: the properties set, the constructor's defaults for the rest.

public HumanoidStandupEnvV5(HumanoidStandupEnvV5Options options)

Parameters

options HumanoidStandupEnvV5Options

The options.

Exceptions

ArgumentNullException

Thrown when options is null.

HumanoidStandupEnvV5(RenderMode, string, int, IReadOnlyDictionary<string, object?>?, double, double, double, (double Low, double High)?, double, bool, bool, bool, bool, bool, int, int, int?, string?, int, IReadOnlyDictionary<int, bool>?, EnvViewerFactory?)

Builds the env with the render mode given as the RenderMode enum (DR-84, DR-93), as HumanoidStandupEnvV5(string, int, IReadOnlyDictionary<string, object?>?, double, double, double, (double Low, double High)?, double, bool, bool, bool, bool, bool, string?, int, int, int?, string?, int, IReadOnlyDictionary<int, bool>?, EnvViewerFactory?) builds it from the mode's string: new HumanoidStandupEnvV5(RenderMode.RgbArray) builds what new HumanoidStandupEnvV5(renderMode: "rgb_array") builds, the member reaching the env as Gymnasium's string (Name(RenderMode)), which its RenderMode property then holds.

public HumanoidStandupEnvV5(RenderMode renderMode, string xmlFile = "humanoidstandup.xml", int frameSkip = 5, IReadOnlyDictionary<string, object?>? defaultCameraConfig = null, double uphCostWeight = 1, double ctrlCostWeight = 0.1, double impactCostWeight = 5E-07, (double Low, double High)? impactCostRange = null, double resetNoiseScale = 0.01, bool excludeCurrentPositionsFromObservation = true, bool includeCinertInObservation = true, bool includeCvelInObservation = true, bool includeQfrcActuatorInObservation = true, bool includeCfrcExtInObservation = true, int width = 480, int height = 480, int? cameraId = null, string? cameraName = null, int maxGeom = 1000, IReadOnlyDictionary<int, bool>? visualOptions = null, EnvViewerFactory? viewerFactory = null)

Parameters

renderMode RenderMode

The render mode, which the env must list in its metadata["render_modes"] as for the string; it behaves exactly as its Gymnasium string does in the other constructor.

xmlFile string

The model: a bundled file name (xml_file, DR-63).

frameSkip int

Physics steps per env step (frame_skip).

defaultCameraConfig IReadOnlyDictionary<string, object>

The free camera's settings (default_camera_config); null is Gymnasium's default (tracking body 1 from 4 m, looking at (0, 0, 0.8925), 20° from above), and an empty dictionary leaves MuJoCo's camera as it is.

uphCostWeight double

The weight Gymnasium documents for the height term (uph_cost_weight); kept, never used.

ctrlCostWeight double

The weight of the squared controls (ctrl_cost_weight).

impactCostWeight double

The weight of the squared external forces (impact_cost_weight).

impactCostRange (double hx, double hy)?

The range the impact cost is clipped to (impact_cost_range); null is (-inf, 10.0).

resetNoiseScale double

The scale of the reset's noise (reset_noise_scale).

excludeCurrentPositionsFromObservation bool

Whether the root's x and y leave the observation (exclude_current_positions_from_observation).

includeCinertInObservation bool

Whether the bodies' inertias join the observation (include_cinert_in_observation).

includeCvelInObservation bool

Whether the bodies' velocities join the observation (include_cvel_in_observation).

includeQfrcActuatorInObservation bool

Whether the actuator forces join the observation (include_qfrc_actuator_in_observation).

includeCfrcExtInObservation bool

Whether the external forces join the observation (include_cfrc_ext_in_observation).

width int

The rendered frame's width (width).

height int

The rendered frame's height (height).

cameraId int?

The camera to render from (camera_id).

cameraName string

The camera to render from by name (camera_name).

maxGeom int

The most geoms a frame draws (max_geom).

visualOptions IReadOnlyDictionary<int, bool>

MuJoCo visual flags to switch (visual_options).

viewerFactory EnvViewerFactory

Gym.NET's viewer_factory (DR-20) for human mode.

Remarks

The mode is required and comes first, so new HumanoidStandupEnvV5() keeps meaning the other constructor, without a mode; leave the mode out there for no rendering. Every other parameter means what it means there.

Exceptions

ArgumentOutOfRangeException

Thrown for a value RenderMode does not declare (a cast integer such as (RenderMode)99).

NotSupportedException

xmlFile is not a bundled model.

OverflowError

A frame skip of 0 (Python's OverflowError deriving the frame rate).

ValueError

Both a camera id and a camera name.

HumanoidStandupEnvV5(string, int, IReadOnlyDictionary<string, object?>?, double, double, double, (double Low, double High)?, double, bool, bool, bool, bool, bool, string?, int, int, int?, string?, int, IReadOnlyDictionary<int, bool>?, EnvViewerFactory?)

Creates the env (Gymnasium's HumanoidStandupEnv.init): the model, its spaces and the frame rate the time step gives.

public HumanoidStandupEnvV5(string xmlFile = "humanoidstandup.xml", int frameSkip = 5, IReadOnlyDictionary<string, object?>? defaultCameraConfig = null, double uphCostWeight = 1, double ctrlCostWeight = 0.1, double impactCostWeight = 5E-07, (double Low, double High)? impactCostRange = null, double resetNoiseScale = 0.01, bool excludeCurrentPositionsFromObservation = true, bool includeCinertInObservation = true, bool includeCvelInObservation = true, bool includeQfrcActuatorInObservation = true, bool includeCfrcExtInObservation = true, string? renderMode = null, int width = 480, int height = 480, int? cameraId = null, string? cameraName = null, int maxGeom = 1000, IReadOnlyDictionary<int, bool>? visualOptions = null, EnvViewerFactory? viewerFactory = null)

Parameters

xmlFile string

The model: a bundled file name (xml_file, DR-63).

frameSkip int

Physics steps per env step (frame_skip).

defaultCameraConfig IReadOnlyDictionary<string, object>

The free camera's settings (default_camera_config); null is Gymnasium's default (tracking body 1 from 4 m, looking at (0, 0, 0.8925), 20° from above), and an empty dictionary leaves MuJoCo's camera as it is.

uphCostWeight double

The weight Gymnasium documents for the height term (uph_cost_weight); kept, never used.

ctrlCostWeight double

The weight of the squared controls (ctrl_cost_weight).

impactCostWeight double

The weight of the squared external forces (impact_cost_weight).

impactCostRange (double hx, double hy)?

The range the impact cost is clipped to (impact_cost_range); null is (-inf, 10.0).

resetNoiseScale double

The scale of the reset's noise (reset_noise_scale).

excludeCurrentPositionsFromObservation bool

Whether the root's x and y leave the observation (exclude_current_positions_from_observation).

includeCinertInObservation bool

Whether the bodies' inertias join the observation (include_cinert_in_observation).

includeCvelInObservation bool

Whether the bodies' velocities join the observation (include_cvel_in_observation).

includeQfrcActuatorInObservation bool

Whether the actuator forces join the observation (include_qfrc_actuator_in_observation).

includeCfrcExtInObservation bool

Whether the external forces join the observation (include_cfrc_ext_in_observation).

renderMode string

Gymnasium's render_mode: human, rgb_array, depth_array, rgbd_tuple or null.

width int

The rendered frame's width (width).

height int

The rendered frame's height (height).

cameraId int?

The camera to render from (camera_id).

cameraName string

The camera to render from by name (camera_name).

maxGeom int

The most geoms a frame draws (max_geom).

visualOptions IReadOnlyDictionary<int, bool>

MuJoCo visual flags to switch (visual_options).

viewerFactory EnvViewerFactory

Gym.NET's viewer_factory (DR-20) for human mode.

Exceptions

NotSupportedException

xmlFile is not a bundled model.

OverflowError

A frame skip of 0 (Python's OverflowError deriving the frame rate).

ValueError

Both a camera id and a camera name.

Properties

ClassMetadata

Gymnasium's class attribute metadata: the four render modes, the frame rate set per instance. A new dict on every read.

public static Metadata ClassMetadata { get; }

Property Value

Metadata

CtrlCostWeight

The weight of the squared controls (_ctrl_cost_weight), read every step.

[PyName("_ctrl_cost_weight")]
public double CtrlCostWeight { get; set; }

Property Value

double

ExcludeCurrentPositionsFromObservation

Whether the root's x and y leave the observation (_exclude_current_positions_from_observation). Footgun: this and the four Include... flags change the observation's length when changed after construction, but not the observation space, as in Gymnasium.

[PyName("_exclude_current_positions_from_observation")]
public bool ExcludeCurrentPositionsFromObservation { get; set; }

Property Value

bool

ImpactCostRange

The range the impact cost is clipped to (_impact_cost_range).

[PyName("_impact_cost_range")]
public (double Low, double High) ImpactCostRange { get; set; }

Property Value

(double From, double To)

ImpactCostWeight

The weight of the squared external forces (_impact_cost_weight), read every step.

[PyName("_impact_cost_weight")]
public double ImpactCostWeight { get; set; }

Property Value

double

IncludeCfrcExtInObservation

Whether the external forces join the observation (_include_cfrc_ext_in_observation).

[PyName("_include_cfrc_ext_in_observation")]
public bool IncludeCfrcExtInObservation { get; set; }

Property Value

bool

IncludeCinertInObservation

Whether the bodies' inertias join the observation (_include_cinert_in_observation).

[PyName("_include_cinert_in_observation")]
public bool IncludeCinertInObservation { get; set; }

Property Value

bool

IncludeCvelInObservation

Whether the bodies' velocities join the observation (_include_cvel_in_observation).

[PyName("_include_cvel_in_observation")]
public bool IncludeCvelInObservation { get; set; }

Property Value

bool

IncludeQfrcActuatorInObservation

Whether the actuator forces join the observation (_include_qfrc_actuator_in_observation).

[PyName("_include_qfrc_actuator_in_observation")]
public bool IncludeQfrcActuatorInObservation { get; set; }

Property Value

bool

ObservationStructure

How the observation is laid out (observation_structure): skipped_qpos, qpos, qvel, cinert, cvel, qfrc_actuator, cfrc_ext, and 0 for ten_length and ten_velocity.

public Info ObservationStructure { get; }

Property Value

Info

ResetNoiseScale

The scale of the reset's noise (_reset_noise_scale), read every reset.

[PyName("_reset_noise_scale")]
public double ResetNoiseScale { get; set; }

Property Value

double

UphCostWeight

The documented weight of the height term (_uph_cost_weight): stored, never read, as in Gymnasium.

[PyName("_uph_cost_weight")]
public double UphCostWeight { get; set; }

Property Value

double

Methods

GetResetInfo()

The reset's info (_get_reset_info): x_position, y_position, z_distance_from_origin, and copies of tendon_length and tendon_velocity.

protected override Info GetResetInfo()

Returns

Info

The info.

ResetModel()

The episode's start (reset_model): positions init_qpos + uniform(-scale, scale, nq), then velocities init_qvel + uniform(-scale, scale, nv), drawn in that order.

protected override NDArray ResetModel()

Returns

NDArray

The first observation.

Step(NDArray)

Applies action for FrameSkip physics steps and reports the transition (step).

public override StepResult<NDArray> Step(NDArray action)

Parameters

action NDArray

The 17 controls, any real dtype (stored as float64).

Returns

StepResult<NDArray>

The observation, the float64 reward, terminated=False, truncated=False and the info.

Exceptions

ArgumentNullException

action is null.

ValueError

The action is not of shape (17,), with Gymnasium's message.