rofunc.learning.RofuncRL.tasks.isaacgymenv.base.vec_task#

1.  Module Contents#

1.1.  Classes#

Env

VecTask

1.2.  Functions#

get_attr_val_from_sample

Retrieves param value for the given prop and attr from the sample.

1.3.  Data#

EXISTING_SIM

SCREEN_CAPTURE_RESOLUTION

1.4.  API#

rofunc.learning.RofuncRL.tasks.isaacgymenv.base.vec_task.EXISTING_SIM = None#
rofunc.learning.RofuncRL.tasks.isaacgymenv.base.vec_task.SCREEN_CAPTURE_RESOLUTION = (1027, 768)#
class rofunc.learning.RofuncRL.tasks.isaacgymenv.base.vec_task.Env(config: Dict[str, Any], rl_device: str, sim_device: str, graphics_device_id: int, headless: bool)[source]#

Bases: abc.ABC

abstract allocate_buffers()[source]#

Create torch buffers for observations, rewards, actions dones and any additional data.

abstract step(actions: torch.Tensor) Tuple[Dict[str, torch.Tensor], torch.Tensor, torch.Tensor, Dict[str, Any]][source]#

Step the physics of the environment.

Args:

actions: actions to apply

Returns:

Observations, rewards, resets, info Observations are dict of observations (currently only one member called ‘obs’)

abstract reset() Dict[str, torch.Tensor][source]#

Reset the environment. Returns:

Observation dictionary

abstract reset_idx(env_ids: torch.Tensor)[source]#

Reset environments having the provided indices. Args:

env_ids: environments to reset

property observation_space: gym.Space#

Get the environment’s observation space.

property action_space: gym.Space#

Get the environment’s action space.

property num_envs: int#

Get the number of environments.

property num_acts: int#

Get the number of actions in the environment.

property num_obs: int#

Get the number of observations in the environment.

class rofunc.learning.RofuncRL.tasks.isaacgymenv.base.vec_task.VecTask(config, rl_device, sim_device, graphics_device_id, headless, virtual_screen_capture: bool = False, force_render: bool = False)[source]#

Bases: rofunc.learning.RofuncRL.tasks.isaacgymenv.base.vec_task.Env

metadata = None#
set_viewer()[source]#

Create the viewer.

allocate_buffers()[source]#

Allocate the observation, states, etc. buffers.

These are what is used to set observations and states in the environment classes which inherit from this one, and are read in step and other related functions.

set_sim_params_up_axis(sim_params: isaacgym.gymapi.SimParams, axis: str) int[source]#

Set gravity based on up axis and return axis index.

Args:

sim_params: sim params to modify the axis for. axis: axis to set sim params for.

Returns:

axis index for up axis.

create_sim(compute_device: int, graphics_device: int, physics_engine, sim_params: isaacgym.gymapi.SimParams)[source]#

Create an Isaac Gym sim object.

Args:

compute_device: ID of compute device to use. graphics_device: ID of graphics device to use. physics_engine: physics engine to use (gymapi.SIM_PHYSX or gymapi.SIM_FLEX) sim_params: sim params to use.

Returns:

the Isaac Gym sim object.

get_state()[source]#

Returns the state buffer of the environment (the privileged observations for asymmetric training).

abstract pre_physics_step(actions: torch.Tensor)[source]#

Apply the actions to the environment (eg by setting torques, position targets).

Args:

actions: the actions to apply

abstract post_physics_step()[source]#

Compute reward and observations, reset any environments that require it.

step(actions: torch.Tensor) Tuple[Dict[str, torch.Tensor], torch.Tensor, torch.Tensor, Dict[str, Any]][source]#

Step the physics of the environment.

Args:

actions: actions to apply

Returns:

Observations, rewards, resets, info Observations are dict of observations (currently only one member called ‘obs’)

zero_actions() torch.Tensor[source]#

Returns a buffer with zero actions.

Returns:

A buffer of zero torch actions

reset_idx(env_idx)[source]#

Reset environment with indces in env_idx. Should be implemented in an environment class inherited from VecTask.

reset()[source]#

Is called only once when environment starts to provide the first observations. Doesn’t calculate observations. Actual reset and observation calculation need to be implemented by user. Returns:

Observation dictionary

reset_done()[source]#

Reset the environment. Returns:

Observation dictionary, indices of environments being reset

render(mode='rgb_array')[source]#

Draw the frame to the viewer, and check for keyboard events.

get_actor_params_info(dr_params: Dict[str, Any], env)[source]#

Generate a flat array of actor params, their names and ranges.

Returns:

The array

apply_randomizations(dr_params)[source]#

Apply domain randomizations to the environment.

Note that currently we can only apply randomizations only on resets, due to current PhysX limitations

Args:

dr_params: parameters for domain randomization to use.

rofunc.learning.RofuncRL.tasks.isaacgymenv.base.vec_task.get_attr_val_from_sample(sample, offset, prop, attr)[source]#

Retrieves param value for the given prop and attr from the sample.