其他传感器#

有三个内置传感器不属于接触、触觉、IMU、相机和光线投射这几类:表面距离探针、温度网格和关节力矩传感器。

用 scene.add_sensor() 从各自的 gs.sensors.* 选项对象创建它们;该调用返回传感器句柄,其 read() 给出测量值。关于“挂载—读取”模型、批量读取,以及通过噪声、延迟和历史进行配置,请参阅 传感器总览。

SurfaceDistanceProbe#

报告每个探针点到一组被跟踪刚体连杆网格表面的最近距离;当范围内没有任何物体时,该值会被截断到 probe_radius。对应的最近点可通过 nearest_points 属性获取。参见 表面距离指南。

class genesis.options.sensors.options.SurfaceDistanceProbe(*, history_length: int = 0, delay: float = 0.0, jitter: float = 0.0, draw_debug: bool = False, entity_idx: int = -1, probe_local_pos: tuple[tuple[float, float, float], ...] | tuple[tuple[tuple[float, float, float], ...], ...] = ((0.0, 0.0, 0.0),), probe_radius: tuple[float, ...] | float = 0.5, probe_radius_noise: float = 0.0, debug_probe_color: tuple[float, float, float] = (0.2, 0.4, 1.0), debug_probe_center_radius: float = 0.0008, debug_probe_sphere_opacity: float = 0.3, resolution: tuple[float, ...] | float = 0.0, bias: tuple[float, ...] | float = 0.0, noise: tuple[float, ...] | float = 0.0, random_walk: tuple[float, ...] | float = 0.0, link_idx_local: int = 0, pos_offset: tuple[float, float, float] = (0.0, 0.0, 0.0), euler_offset: tuple[float, float, float] = (0.0, 0.0, 0.0), track_link_idx: tuple[int, ...] = <factory>) → None[source]#

Surface distance probe that reports nearest distances from probe positions to tracked mesh surfaces.

The read() output will provide the distances, and the nearest points can be accessed with sensor.nearest_points.

Attached to a rigid entity link. Takes a list of local probe positions and a list of global link indices to track; for each probe, outputs the distance and nearest point (world frame) to the closest mesh surface among the tracked links. If no mesh is within max_range, reports max_range and the probe position as nearest point.

Parameters:
  • probe_local_pos (array-like[array-like[float, float, float]]) – Probe positions in link-local frame. One (x, y, z) per probe.

  • probe_radius (float | array-like[float]) – Maximum sensing range in meters. When no mesh is within this distance, distance is clamped to the probe radius and nearest points is the probe position. Default: 0.5. Also controls the outer debug sphere.

  • track_link_idx (array-like[int]) – Global link indices (solver link space) whose mesh geoms are used for distance queries.

class genesis.engine.sensors.surface_distance_probe.SurfaceDistanceProbeSensor(options: SurfaceDistanceProbe, idx: int, shared_context, shared_metadata, manager: SensorManager)[source]#

Bases: ProbeSensorMixin[SurfaceDistanceProbeMetadata], RigidSensorMixin[SurfaceDistanceProbeMetadata], SimpleSensor[SurfaceDistanceProbe, None, SurfaceDistanceProbeMetadata, tuple]

Surface distance probe: distance and nearest point from probe positions to tracked mesh surfaces.

build()[source]#

Initialize all shared metadata needed to update all noisy sensors.

Time-related state (delays_ts, jitter_ts) is pushed by Sensor.build(); this method adds the imperfection-parameter state.

classmethod reset(shared_metadata: SurfaceDistanceProbeMetadata, shared_ground_truth_cache: Tensor, envs_idx)[source]#

Reset the sensor.

This method is called by SensorManager when the scene is reset by scene.reset().

Parameters:
  • shared_metadata (SharedSensorMetadata) – The shared metadata for the sensor class.

  • shared_ground_truth_cache (torch.Tensor) – The shared ground truth cache for the sensor class.

  • envs_idx (array_like) – The indices of the environments to reset. The envs_idx should already be sanitized by SensorManager.

property nearest_points: Tensor#

Nearest mesh points for the measured (noisy-radius) query, aligned with read() – a grid probe_local_pos (M, N, 3) reads back as (…, M, N, 3), a flat layout as (…, n_probes, 3).

property nearest_points_ground_truth: Tensor#

Nearest mesh points for the nominal-radius ground-truth query, aligned with read_ground_truth().

TemperatureGrid#

在单个刚体连杆上叠加一个三维体素网格,并报告每个单元的温度(单位为摄氏度)。每个单元的温度会依据接触传导、辐射、对流以及可选的逐单元产热而演化。参见 温度网格指南。

通过 properties_dict 提供材质属性,它把全局的刚体连杆索引映射到一个 TemperatureProperties 条目。

class genesis.options.sensors.options.TemperatureProperties(base_temperature: float = 21.0, conductivity: float = 50.0, density: float = 1000.0, specific_heat: float = 1.0, emissivity: float = 0.9)[source]#

Material properties for temperature sensor.

Parameters:
  • base_temperature (float) – The base temperature of the material in Celsius.

  • conductivity (float) – The conductivity of the material in W/(m*K)

  • density (float) – The density of the material in kilograms per cubic meter.

  • specific_heat (float) – The specific heat of the material in J/(kg*C).

  • emissivity (float) – The emissivity of the material, between 0 and 1.

class genesis.options.sensors.options.TemperatureGrid(*, history_length: int = 0, delay: float = 0.0, jitter: float = 0.0, draw_debug: bool = False, entity_idx: int = -1, resolution: tuple[float, ...] | float = 0.0, bias: tuple[float, ...] | float = 0.0, noise: tuple[float, ...] | float = 0.0, random_walk: tuple[float, ...] | float = 0.0, link_idx_local: int = 0, pos_offset: tuple[float, float, float] = (0.0, 0.0, 0.0), euler_offset: tuple[float, float, float] = (0.0, 0.0, 0.0), properties_dict: dict[int, genesis.options.sensors.options.TemperatureProperties] = <factory>, ambient_temperature: float | None = None, convection_coefficient: float | None = None, simulate_all_link_temperatures: bool = False, grid_size: tuple[int, int, int] = (1, 1, 1), heat_generation: tuple[tuple[tuple[float, ...], ...], ...] | None = None, sensor_time_constant: float = 0.0, contact_depth_weight: float = 1.0, debug_temperature_range: tuple[float, float] = (0.0, 100.0)) → None[source]#

Sensor that returns the temperature in Celsius of the associated RigidLink in its local frame.

Temperature is computed based on object contacts and their material properties provided to these options.

Parameters:
  • properties_dict (dict[int, TemperatureProperties]) – A dictionary which maps link indices to their temperature-related material properties. Key -1 is used as the default for links not present in the dict; if omitted, unlisted links are ignored in contacts. This parameter is shared across all Temperature sensors (dicts will be merged).

  • ambient_temperature (float) – The ambient temperature in Celsius. Default is 21 degrees C. This parameter is shared across all Temperature sensors (the last one set will be used).

  • convection_coefficient (float) – Convection coefficient h in W/(m^2*K) for surface cooling. Default 1.0. This parameter is shared across all Temperature sensors (the last one set will be used).

  • simulate_all_link_temperatures (bool) – If True, the temperatures of all links with temperature properties will be simulated. When False, other links are treated as adiabatic (no heat transfer, always at base temperature). This parameter is shared across all Temperature sensors (setting True for one sets it for all).

  • grid_size (tuple[int, int, int]) – The size of the grid in the x, y, and z directions which determines the sensor resolution by spatially discretizing the bounding box of the rigid entity link.

  • heat_generation (Grid3DFloatType | None) – The heat generation rate in Watts per square meter for each cell in the grid.

  • sensor_time_constant (float) – The time constant of the sensor in seconds.

  • contact_depth_weight (float) – The weight of the contact depth in the temperature calculation.

  • debug_temperature_range (tuple[float, float], optional) – The range of temperatures to visualize in the debug mode. Defaults to (0.0, 100.0).

class genesis.engine.sensors.temperature.TemperatureGridSensor(options: TemperatureGrid, idx: int, shared_context, shared_metadata, manager: SensorManager)[source]#

Bases: RigidSensorMixin[TemperatureGridSensorMetadata], SimpleSensor[TemperatureGrid, None, TemperatureGridSensorMetadata, TemperatureGridSensorMetadata]

build()[source]#

Initialize all shared metadata needed to update all noisy sensors.

Time-related state (delays_ts, jitter_ts) is pushed by Sensor.build(); this method adds the imperfection-parameter state.

classmethod reset(shared_metadata: TemperatureGridSensorMetadata, current_ground_truth_data_T: Tensor, envs_idx)[source]#

Reset the sensor.

This method is called by SensorManager when the scene is reset by scene.reset().

Parameters:
  • shared_metadata (SharedSensorMetadata) – The shared metadata for the sensor class.

  • shared_ground_truth_cache (torch.Tensor) – The shared ground truth cache for the sensor class.

  • envs_idx (array_like) – The indices of the environments to reset. The envs_idx should already be sanitized by SensorManager.

JointTorque#

测量每个选定执行器输出轴上传出的广义作用量:转动自由度对应力矩,移动自由度对应力。由于它读取的是约束求解后的作用量,外部接触会以关节载荷变化的形式隐式体现出来。

class genesis.options.sensors.options.JointTorque(*, history_length: int = 0, delay: float = 0.0, jitter: float = 0.0, draw_debug: bool = False, entity_idx: int = -1, resolution: tuple[float, ...] | float = 0.0, bias: tuple[float, ...] | float = 0.0, noise: tuple[float, ...] | float = 0.0, random_walk: tuple[float, ...] | float = 0.0, link_idx_local: int = 0, pos_offset: tuple[float, float, float] = (0.0, 0.0, 0.0), euler_offset: tuple[float, float, float] = (0.0, 0.0, 0.0), dofs_idx_local: tuple[int, ...] | None = None) → None[source]#

Actuator output effort sensor for rigid entities (torque for revolute DOFs, force for prismatic DOFs).

Models the generalized effort at each joint’s gearbox output shaft:

actuator_force = tau_control - armature * qacc + tau_frictionloss + tau_damping

where qacc is the constraint-solved joint acceleration, armature the per-DOF armature inertia, tau_frictionloss the Coulomb friction constraint effort (negative when opposing motion), and tau_damping = -damping * vel the viscous passive effort. Gravity, Coriolis and contact loads are thus captured implicitly.

Parameters:
  • entity_idx (int) – Scene-level index of the RigidEntity to sense. Must be >= 0.

  • dofs_idx_local (array-like[int] | None, optional) – Local DOF indices within the entity. None (default) selects all DOFs.

class genesis.engine.sensors.joint_torque.JointTorqueSensor(options: JointTorque, idx: int, shared_context: None, shared_metadata: JointTorqueSensorMetadata, manager: SensorManager)[source]#

Bases: SimpleSensor[JointTorque, None, JointTorqueSensorMetadata]

Measures the generalized effort transmitted from each actuator to its joint output shaft (torque for revolute DOFs, force for prismatic DOFs).

The reading is the commanded actuator effort minus the gearbox losses, derived from Newton’s 3rd law at the gearbox interface:

actuator_force = tau_control - armature * qacc + tau_frictionloss + tau_damping

where tau_damping = -damping * vel is the viscous passive effort. Gravity, Coriolis and contact loads are captured implicitly through the constraint-solved acceleration qacc.

build()[source]#

Initialize all shared metadata needed to update all noisy sensors.

Time-related state (delays_ts, jitter_ts) is pushed by Sensor.build(); this method adds the imperfection-parameter state.

另请参阅#