传感器#

传感器从场景中读取信息,但不改变场景的物理状态。把传感器挂载到连杆上,推进仿真,每一步回读一个张量。关于“挂载—读取”模型、非理想因素、历史数据和批量读取,请参阅 传感器指南。

传感器类型#

用 scene.add_sensor() 创建传感器,并传入 gs.sensors 中的选项对象。该调用返回一个句柄,其 read() 给出测量值,read_ground_truth() 给出无噪声的值,两者形状相同。scene.add_camera() 创建的则是可视化相机,它位于传感器流水线之外;相机传感器 页面说明了二者的区别。

形状采用可选的批量维度写法 ([n_envs,] ...):当场景使用多个环境构建时会带有前导的 n_envs 轴,否则不带。

gs.sensors.*

read() 返回

形状

RasterizerCameraOptions、RaytracerCameraOptions、BatchRendererCameraOptions

CameraReturnType(rgb),rgb 为 uint8

([n_envs,] height, width, 3)

Contact

torch.Tensor(bool)

([n_envs,] 1)

ContactForce

torch.Tensor(float32)

([n_envs,] 3)

IMU

IMUReturnType(lin_acc, ang_vel, mag)(float32)

各为 ([n_envs,] 3)

Raycaster(别名 Lidar)、DepthCamera

RaycasterReturnType(points, distances)(float32)

points 为 ([n_envs,] *pattern_shape, 3),distances 为 ([n_envs,] *pattern_shape)

SurfaceDistanceProbe

torch.Tensor(float32)距离

([n_envs,] n_probes)

ContactProbe

torch.Tensor(bool)

([n_envs,] n_probes)

ContactDepthProbe

torch.Tensor(float32)穿透深度

([n_envs,] n_probes)

KinematicTaxel

KinematicTaxelReturnType(force, torque)(float32)

各为 ([n_envs,] n_probes, 3)

ElastomerTaxel

torch.Tensor(float32)标记位移

([n_envs,] n_probes, 3)

ProximityTaxel

ProximityTaxelReturnType(force, torque)(float32)

各为 ([n_envs,] n_probes, 3)

TemperatureGrid

torch.Tensor(float32)

([n_envs,] grid_x, grid_y, grid_z)

JointTorque

torch.Tensor(float32)

([n_envs,] n_dofs)

关于返回类型的说明:

  • 相机传感器:read() 返回 CameraReturnType,其中只有一个 rgb 字段。深度、分割和表面法线应通过 scene.add_camera(...).render(...) 获取。

  • SurfaceDistanceProbe:read() 返回探针到表面的距离;对应的最近点可通过 sensor.nearest_points 获取,形状为 ([n_envs,] n_probes, 3)。

  • Raycaster 的模式:pattern_shape 取决于光线模式:例如球形模式为 (n_horizontal, n_vertical),DepthCamera 为 (height, width)。

传感器参考页面#

另请参阅#

  • 传感器:“挂载—读取”模型、非理想因素、历史数据与批量读取。

  • 可视化与渲染:渲染与相机系统。

  • 实体:传感器挂载所依附的实体与连杆。