Skip to content

navrl_terrain_cfg

NavRL-style discrete obstacles terrain with probability-weighted height intervals.

Extends IsaacLab's height-field terrain to support obstacle_height_mode="range", where obstacle heights are sampled from probability-weighted intervals defined by obstacle_height_range (N+1 boundary values) and obstacle_height_probability (N probabilities summing to 1).

Classes:

Name Description
HfDiscreteObstaclesNavRLTerrainCfg

Configuration for discrete obstacles terrain with NavRL-style "range" height mode.

Functions:

Name Description
discrete_obstacles_terrain

Generate a terrain with randomly placed discrete obstacles (pillars).

HfDiscreteObstaclesNavRLTerrainCfg

Bases: HfTerrainBaseCfg

Configuration for discrete obstacles terrain with NavRL-style "range" height mode.

Inherits all base height-field parameters from :class:HfTerrainBaseCfg.

The obstacle_height_mode field selects how obstacle heights are sampled:

  • "choice": randomly pick from [-h, -h/2, h/2, h] (IsaacLab default).
  • "fixed": always use positive h.
  • "range": select an interval from obstacle_height_range based on obstacle_height_probability, then sample uniformly within that interval. In this mode, obstacle_height_range must be a list of N+1 boundary values and obstacle_height_probability a list of N probabilities summing to 1.

Attributes:

Name Type Description
obstacle_height_mode str

The mode to use for obstacle height. Defaults to "range".

obstacle_width_range tuple[float, float]

The minimum and maximum width of the obstacles (in m).

obstacle_height_range list

Obstacle height specification.

obstacle_height_probability list

Probability for each interval in "range" mode. Must sum to 1 and have

num_obstacles int

The number of obstacles to generate.

platform_width float

The width of the square platform at the center of the terrain. Defaults to 0.0.

obstacle_height_mode class-attribute instance-attribute

obstacle_height_mode: str = 'range'

The mode to use for obstacle height. Defaults to "range".

Supported modes: "choice", "fixed", "range".

obstacle_width_range class-attribute instance-attribute

obstacle_width_range: tuple[float, float] = MISSING

The minimum and maximum width of the obstacles (in m).

obstacle_height_range class-attribute instance-attribute

obstacle_height_range: list = MISSING

Obstacle height specification.

  • For "choice"/"fixed" mode: a 2-element [min, max] in metres.
  • For "range" mode: a list of N+1 boundary values (e.g. [1.0, 1.5, 2.0, 4.0, 6.0]).

obstacle_height_probability class-attribute instance-attribute

obstacle_height_probability: list = MISSING

Probability for each interval in "range" mode. Must sum to 1 and have length len(obstacle_height_range) - 1. Ignored for other modes.

num_obstacles class-attribute instance-attribute

num_obstacles: int = MISSING

The number of obstacles to generate.

platform_width class-attribute instance-attribute

platform_width: float = 0.0

The width of the square platform at the center of the terrain. Defaults to 0.0.

discrete_obstacles_terrain

discrete_obstacles_terrain(difficulty: float, cfg: HfDiscreteObstaclesNavRLTerrainCfg) -> np.ndarray

Generate a terrain with randomly placed discrete obstacles (pillars).

Supports three obstacle height modes:

  • "choice": randomly pick from [-h, -h/2, h/2, h] (IsaacLab default).
  • "fixed": always use positive h.
  • "range" (NavRL): select an interval from obstacle_height_range based on obstacle_height_probability, then sample height uniformly within that interval.

Parameters:

Name Type Description Default

difficulty

float

Terrain difficulty in [0, 1].

required

cfg

HfDiscreteObstaclesNavRLTerrainCfg

Terrain configuration.

required

Returns:

Type Description
ndarray

Height field as a 2D int16 numpy array (width_pixels, length_pixels).