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
optionsHumanoidStandupEnvV5OptionsThe options.
Exceptions
- ArgumentNullException
Thrown when
optionsis 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
renderModeRenderModeThe 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.xmlFilestringThe model: a bundled file name (
xml_file, DR-63).frameSkipintPhysics steps per env step (
frame_skip).defaultCameraConfigIReadOnlyDictionary<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.uphCostWeightdoubleThe weight Gymnasium documents for the height term (
uph_cost_weight); kept, never used.ctrlCostWeightdoubleThe weight of the squared controls (
ctrl_cost_weight).impactCostWeightdoubleThe 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).resetNoiseScaledoubleThe scale of the reset's noise (
reset_noise_scale).excludeCurrentPositionsFromObservationboolWhether the root's x and y leave the observation (
exclude_current_positions_from_observation).includeCinertInObservationboolWhether the bodies' inertias join the observation (
include_cinert_in_observation).includeCvelInObservationboolWhether the bodies' velocities join the observation (
include_cvel_in_observation).includeQfrcActuatorInObservationboolWhether the actuator forces join the observation (
include_qfrc_actuator_in_observation).includeCfrcExtInObservationboolWhether the external forces join the observation (
include_cfrc_ext_in_observation).widthintThe rendered frame's width (
width).heightintThe rendered frame's height (
height).cameraIdint?The camera to render from (
camera_id).cameraNamestringThe camera to render from by name (
camera_name).maxGeomintThe most geoms a frame draws (
max_geom).visualOptionsIReadOnlyDictionary<int, bool>MuJoCo visual flags to switch (
visual_options).viewerFactoryEnvViewerFactoryGym.NET's
viewer_factory(DR-20) forhumanmode.
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
xmlFileis not a bundled model.- OverflowError
A frame skip of 0 (Python's
OverflowErrorderiving 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
xmlFilestringThe model: a bundled file name (
xml_file, DR-63).frameSkipintPhysics steps per env step (
frame_skip).defaultCameraConfigIReadOnlyDictionary<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.uphCostWeightdoubleThe weight Gymnasium documents for the height term (
uph_cost_weight); kept, never used.ctrlCostWeightdoubleThe weight of the squared controls (
ctrl_cost_weight).impactCostWeightdoubleThe 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).resetNoiseScaledoubleThe scale of the reset's noise (
reset_noise_scale).excludeCurrentPositionsFromObservationboolWhether the root's x and y leave the observation (
exclude_current_positions_from_observation).includeCinertInObservationboolWhether the bodies' inertias join the observation (
include_cinert_in_observation).includeCvelInObservationboolWhether the bodies' velocities join the observation (
include_cvel_in_observation).includeQfrcActuatorInObservationboolWhether the actuator forces join the observation (
include_qfrc_actuator_in_observation).includeCfrcExtInObservationboolWhether the external forces join the observation (
include_cfrc_ext_in_observation).renderModestringGymnasium's
render_mode:human,rgb_array,depth_array,rgbd_tupleor null.widthintThe rendered frame's width (
width).heightintThe rendered frame's height (
height).cameraIdint?The camera to render from (
camera_id).cameraNamestringThe camera to render from by name (
camera_name).maxGeomintThe most geoms a frame draws (
max_geom).visualOptionsIReadOnlyDictionary<int, bool>MuJoCo visual flags to switch (
visual_options).viewerFactoryEnvViewerFactoryGym.NET's
viewer_factory(DR-20) forhumanmode.
Exceptions
- NotSupportedException
xmlFileis not a bundled model.- OverflowError
A frame skip of 0 (Python's
OverflowErrorderiving 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
CtrlCostWeight
The weight of the squared controls (_ctrl_cost_weight), read every step.
[PyName("_ctrl_cost_weight")]
public double CtrlCostWeight { get; set; }
Property Value
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
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
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
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
IncludeCinertInObservation
Whether the bodies' inertias join the observation (_include_cinert_in_observation).
[PyName("_include_cinert_in_observation")]
public bool IncludeCinertInObservation { get; set; }
Property Value
IncludeCvelInObservation
Whether the bodies' velocities join the observation (_include_cvel_in_observation).
[PyName("_include_cvel_in_observation")]
public bool IncludeCvelInObservation { get; set; }
Property Value
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
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
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
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
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
actionNDArrayThe 17 controls, any real dtype (stored as float64).
Returns
- StepResult<NDArray>
The observation, the float64 reward,
terminated=False,truncated=Falseand the info.
Exceptions
- ArgumentNullException
actionis null.- ValueError
The action is not of shape
(17,), with Gymnasium's message.