[Question] What does the default offset 0.5 mean in official observation function 'height_scan()' ? #774
-
QuestionI was trying to get the terrain height of the rough terrain for RL these days. I found a sensor with an official function called 'height_scan()' in observation, and I found a 0.5 offset by default in the function. Users can directly modify it. The codes are shown below. def height_scan(env: ManagerBasedEnv, sensor_cfg: SceneEntityCfg, offset: float = 0.5) -> torch.Tensor:
"""Height scan from the given sensor w.r.t. the sensor's frame.
The provided offset (Defaults to 0.5) is subtracted from the returned values.
"""
# extract the used quantities (to enable type-hinting)
sensor: RayCaster = env.scene.sensors[sensor_cfg.name]
# height scan: height = sensor_height - hit_point_z - offset
return sensor.data.pos_w[:, 2].unsqueeze(1) - sensor.data.ray_hits_w[..., 2] - offset What does this offset mean? Should I change this value when using different robots? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Good question. We took this hyperparameter from the legged_gym implementation. I suppose the initial motivation was to keep the plane ground at "0" observation value so an offset was added to account for that. Judging that it works for different robots means the policy learns to deal with this bias, and it may not really be necessary. |
Beta Was this translation helpful? Give feedback.
Good question. We took this hyperparameter from the legged_gym implementation. I suppose the initial motivation was to keep the plane ground at "0" observation value so an offset was added to account for that.
Judging that it works for different robots means the policy learns to deal with this bias, and it may not really be necessary.