Python API#
Authoring (USD prim)
Authoring wrapper for an Isaac contact sensor USD prim. |
|
Authoring wrapper for an Isaac IMU sensor USD prim. |
|
Authoring wrapper for an Isaac raycast sensor USD prim. |
Sensors (runtime)
Runtime wrapper for an Isaac contact sensor with frame-based data access. |
|
Effort sensor reading data. |
|
Sensor for measuring joint effort (torque/force). |
|
Runtime wrapper for an Isaac IMU sensor with frame-based data access. |
|
Joint state sensor reading data for all DOFs of an articulation. |
|
Sensor for reading all DOF joint states from an articulation. |
|
Runtime wrapper for an Isaac raycast sensor with frame-based data access. |
Sensors#
- class ContactSensor(
- path: str | Contact,
Bases:
_PhysicsSensorRuntimeRuntime wrapper for an Isaac contact sensor with frame-based data access.
Wraps a
Contactauthoring object and owns the C++IContactSensorCarbonite interface. Exposesget_data()for a structured per-step dictionary,get_sensor_reading()for the cachedContactSensorReading, andget_raw_data()for raw contact records.- Parameters:
path – Either a string USD path to an existing IsaacContactSensor prim, or a pre-built
Contactauthoring object. To create a new prim, useContact.create().
Example:
from isaacsim.sensors.experimental.physics import Contact, ContactSensor sensor = ContactSensor( Contact.create( "/World/Robot/foot/contact_sensor", min_threshold=1.0, max_threshold=1000.0, radius=0.05, ) ) frame = sensor.get_data() if frame["in_contact"]: print(f"Contact force: {frame['force']}")
- add_raw_contact_data_to_frame() None#
Enable raw contact data in frame output.
After calling this,
get_data()will include a"contacts"list with detailed per-contact information.
- get_data() dict#
Get the current contact sensor data as a structured frame.
- Returns:
"in_contact": Whether contact is detected."force": Contact force magnitude."time": Simulation time of reading."physics_step": Physics step number."number_of_contacts": Number of contact points."contacts": Raw contact data if enabled viaadd_raw_contact_data_to_frame.
- Return type:
Frame data containing
- get_raw_data() list[dict[str, object]]#
Get raw contact data for the sensor’s parent body.
- Returns:
Raw contact dictionaries containing body0, body1, position, normal, impulse, time, and dt fields. Empty when the sensor is invalid.
- get_sensor_reading() ContactSensorReading#
Get the latest cached contact sensor reading.
- Returns:
Reading with contact state and force value. Returns an invalid reading if the sensor is disabled or the prim is invalid.
- on_physics_step(step_dt: float) None#
Called by
_SensorStepManagerafter each physics step.Reads the latest C++ sensor reading and caches it locally.
- Parameters:
step_dt – Duration of the physics step in seconds.
- remove_raw_contact_data_from_frame() None#
Disable raw contact data in frame output.
Removes the
"contacts"key from frame output to reduce overhead.
- property authoring_object: _PhysicsSensorAuthoring#
Authoring object encapsulated by this sensor.
- class EffortSensorReading(
- is_valid: bool = False,
- time: float = 0,
- value: float = 0,
Bases:
objectEffort sensor reading data.
- Parameters:
is_valid – Whether this reading contains valid data.
time – Simulation time when the reading was taken.
value – Effort (torque/force) value at the joint.
- class EffortSensor(path: str, enabled: bool = True)#
Bases:
_PhysicsSensorRuntimeBaseSensor for measuring joint effort (torque/force).
Owns the C++
IEffortSensorCarbonite interface directly and maintains a Python-side circular buffer of readings for historical access.- Parameters:
path – USD path to the joint, formatted as articulation_path/joint_name.
enabled – Whether the sensor is initially enabled.
Example
from isaacsim.sensors.experimental.physics import EffortSensor # Create sensor for a robot joint sensor = EffortSensor("/World/Robot/joint_1") # Read joint effort reading = sensor.get_sensor_reading() if reading.is_valid: print(f"Joint torque: {reading.value}")
- change_buffer_size(new_buffer_size: int) None#
Change the size of the sensor reading buffer.
- Parameters:
new_buffer_size – New buffer size (number of readings to store).
- get_data() dict#
Get the current effort sensor data as a structured frame.
- Returns:
"value": Effort (torque/force) value at the joint."is_valid": Whether the reading contains valid data."time": Simulation time of the reading."physics_step": Physics step number.
- Return type:
Frame data containing
- get_sensor_reading() EffortSensorReading#
Get the current effort sensor reading.
- Returns:
Reading with effort value and validity state.
- class IMUSensor(
- path: str | _PhysicsSensorAuthoring,
Bases:
_PhysicsSensorRuntimeRuntime wrapper for an Isaac IMU sensor with frame-based data access.
Wraps an
IMUauthoring object and owns the C++IImuSensorCarbonite interface. Exposesget_data()for a structured per-step dictionary andget_sensor_reading()for the raw C++ struct.- Parameters:
path – Either a string USD path to an existing IsaacImuSensor prim, or a pre-built
IMUauthoring object. To create a new prim, useIMU.create().
Example:
from isaacsim.sensors.experimental.physics import IMU, IMUSensor # Wrap an existing IsaacImuSensor prim sensor = IMUSensor("/World/Robot/body/imu") # Create a new sensor with custom parameters sensor = IMUSensor( IMU.create( "/World/Robot/body/imu", linear_acceleration_filter_size=5, ) ) frame = sensor.get_data() print(f"Linear acceleration: {frame['linear_acceleration']}")
- get_data(read_gravity: bool = True) dict#
Get the current IMU sensor data as a structured frame.
- Parameters:
read_gravity – If
True, include gravity in acceleration readings.- Returns:
"linear_acceleration": Linear acceleration[x, y, z]."angular_velocity": Angular velocity[x, y, z]."orientation": Orientation as[w, x, y, z]quaternion."time": Simulation time of reading."physics_step": Physics step number.
- Return type:
Frame data containing
- get_sensor_reading(read_gravity: bool = True) object#
Get the current IMU sensor reading as the raw C++ struct.
- Parameters:
read_gravity – Whether to include gravity in the reading.
- Returns:
The C++
ImuSensorReadingstruct directly. Access fields viareading.linear_acceleration_x/_y/_z,reading.angular_velocity_x/_y/_z, andreading.orientation_w/_x/_y/_z(no aggregateorientationaccessor — read the four scalar fields). For a[w, x, y, z]numpy array, useget_data()instead.
- on_physics_step(step_dt: float) None#
Called after each physics step. Override for custom per-step logic.
- Parameters:
step_dt – Physics step duration in seconds.
- property authoring_object: _PhysicsSensorAuthoring#
Authoring object encapsulated by this sensor.
- class JointStateSensorReading(
- is_valid: bool = False,
- time: float = 0.0,
- dof_names: list[str] | None = None,
- positions: ndarray | None = None,
- velocities: ndarray | None = None,
- efforts: ndarray | None = None,
- dof_types: ndarray | None = None,
- stage_meters_per_unit: float = 0.0,
Bases:
objectJoint state sensor reading data for all DOFs of an articulation.
- Parameters:
is_valid – Whether this reading contains valid data.
time – Simulation time when the reading was taken.
dof_names – List of DOF name strings in articulation order.
positions – DOF positions array (rad for revolute, m for prismatic).
velocities – DOF velocities array (rad/s or m/s).
efforts – DOF efforts array (Nm or N).
dof_types – Per-DOF type: 0 = rotation (revolute), 1 = translation (prismatic).
stage_meters_per_unit – Stage meters per USD unit for SI conversion.
- class JointStateSensor(path: str, enabled: bool = True)#
Bases:
_PhysicsSensorRuntimeBaseSensor for reading all DOF joint states from an articulation.
Reads positions, velocities, and efforts for every DOF in the articulation via the C++
IJointStateSensorCarbonite interface. Analogous to a ROS2 JointState message.- Parameters:
path – USD path to the articulation root prim.
enabled – Whether the sensor is initially enabled.
Example
from isaacsim.sensors.experimental.physics import JointStateSensor sensor = JointStateSensor("/World/Robot") # After playing the simulation: reading = sensor.get_sensor_reading() if reading.is_valid: for name, pos in zip(reading.dof_names, reading.positions): print(f"{name}: {pos:.4f} rad")
- get_data() dict#
Get the current joint state as a structured frame.
- Returns:
"dof_names": List of DOF names in articulation order."positions": Per-DOF positions (rad or m)."velocities": Per-DOF velocities (rad/s or m/s)."efforts": Per-DOF efforts (Nm or N)."dof_types": Per-DOF type (0 = revolute, 1 = prismatic)."stage_meters_per_unit": Stage meters per USD unit."is_valid": Whether the reading contains valid data."time": Simulation time of the reading."physics_step": Physics step number.
- Return type:
Frame data containing
- get_sensor_reading() JointStateSensorReading#
Get the current joint state reading for all DOFs.
- Returns:
Reading with DOF names, positions, velocities, efforts, and validity.
- class RaycastSensor(
- path: str | _PhysicsSensorAuthoring,
Bases:
_PhysicsSensorRuntimeRuntime wrapper for an Isaac raycast sensor with frame-based data access.
Wraps a
Raycastauthoring object and owns the C++IRaycastSensorCarbonite interface. Exposesget_data()for a structured per-step dictionary andget_sensor_reading()for the raw C++ struct.- Parameters:
path – Either a string USD path to an existing IsaacRaycastSensor prim, or a pre-built
Raycastauthoring object. To create a new prim, useRaycast.create().
Example:
from isaacsim.sensors.experimental.physics import Raycast, RaycastSensor sensor = RaycastSensor( Raycast.create( "/World/Robot/body/raycast", ray_origins=[[0, 0, 0]], ray_directions=[[1, 0, 0]], ) ) frame = sensor.get_data() print(f"Depths: {frame['depths']}")
- get_data() dict#
Get the current raycast sensor data as a structured frame.
- Returns:
"depths": Per-ray depth values."hit_positions": Per-ray hit positions as Nx3 array."hit_normals": Per-ray surface normals as Nx3 array."hit_prim_paths": Per-ray hit prim USD paths."time": Simulation time of reading."physics_step": Physics step number.
- Return type:
Frame data containing
- get_sensor_reading() object#
Get the current raycast sensor reading as the raw C++ struct.
- Returns:
The C++
RaycastSensorReadingstruct. Access fields viareading.depths,reading.hit_positions, etc.
- on_physics_step(step_dt: float) None#
Called after each physics step. Override for custom per-step logic.
- Parameters:
step_dt – Physics step duration in seconds.
- property authoring_object: _PhysicsSensorAuthoring#
Authoring object encapsulated by this sensor.