# Unitree RL训练报错RuntimeError: normal expects std >=。

> 原文链接：https://robotics.hellobike.com/pitfalls/2026-09-29-unitree-rl-lab-101
> 频道：pitfalls | 更新日期：2026-09-29 | 标签：auto, github-issue, unitree_rl_lab
> 核心摘要：RL训练中因高度扫描观测值含NaN/Inf导致std异常，需在MDP项中添加nan_to_num及clip处理。

# Unitree RL训练报错RuntimeError: normal expects std &gt;=。

::: v-pre
> 本文由 AI 根据公开内容整理，可能有误，请以原文为准：[RuntimeError: normal expects all elements of std &gt;= 0.0](https://github.com/unitreerobotics/unitree_rl_lab/issues/101)（GitHub unitreerobotics/unitree_rl_lab #101）

**状态**：已解决

## 问题

在 unitree_rl_lab 进行强化学习训练时（约29782次迭代），Value Function Loss 变为 inf，随后抛出 RuntimeError: normal expects all elements of std &gt;= 0.0。该错误与GPU、CUDA版本无关，主要出现在粗糙地形训练场景。

## 环境

NVIDIA RTX 4090, Driver 570.195.03, CUDA 11.5, Isaac Sim 4.5.0, unitree_rl_lab, Python 3.11

## 解决办法

1. 确认训练配置中是否启用了 height-scan 传感器，该问题通常由 ray-caster 穿透三角网格地形（tri-mesh/random rough）产生无效观测值引起。
2. 在 height-scan 传感器相关的 MDP term 代码中，强制添加 nan_to_num 操作以清洗观测数据中的 NaN 和 Inf。
3. 在同一 MDP term 中对高度扫描输出增加 clip 限制，防止极端数值传入策略网络导致标准差计算异常。
4. 若使用 USD 或 URDF 加载模型，确保地形碰撞体设置正确，减少射线穿透概率作为辅助优化。

讨论原作者：@Tigran-Chen 等，版权归原作者所有。
:::

## 原始参考来源 (Sources)

- [GitHub unitreerobotics/unitree_rl_lab #101：RuntimeError: normal expects all elements of std >= 0.0](https://github.com/unitreerobotics/unitree_rl_lab/issues/101)