Skip to content

[Question] How to access terrain height features without adding height scanner under ManagerBasedRLEnv #1366

@securityCFS

Description

@securityCFS

Problem

While trying to migrate my RL training codes from legged_gym env to isaaclab env, I found it difficult to access features like height_field in legged_gym to monitor height of certain robot components above ground without sensors. For instance, I tried to use feet height to design a certain reward function that penalizes unbalanced behavior between legs. Since the height information is required by reward function only, adding an additional observation (like height scanner) might be unnecessary. Under flat terrains, I could use scene.data.root_state_w[:,:,2] as replacement, but I couldn't find a way to subtract terrain height under other terrains.

Question

Is there a way to read terrain height, given certain point under world coordinates? Like

asset = env.scene[asset_cfg.name]
coords = asset.data.root_state_w[:, asset_cfg.body_ids, :2]
heights = get_terrain_heights(coords)

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions