Hey everyone:
I’m trying to acquire the contact sensor data from Isaac sim.
First I add the sensor in isaac sim gui as the following:
Then I write the code in my task.py
The followings are my code:
from omni.isaac.sensor import _sensor
...
self._cs = _sensor.acquire_contact_sensor_interface()
...
sensor_data = self._cs.get_sensor_readings("/World/final6_only_hand/__6_2/__6_2/Contact_Sensor")
and the output is:
[]
and I also tried the function: get_contact_sensor_raw_data
but not work.
So how can I get the data from the contact sensor?
Thanks in advance!
Can you try following steps?
-
Make sure that contact sensor is set up correctly in the scene. Make sure its position, orientation, and other settings.Contact Sensor — Omniverse Robotics documentation
-
Ensure sensor path in your code matches the exact hierarchy of the contact sensor in your scene. You can do so by inspecting the scene hierarchy in Isaac Sim.
-
Update the simulation steps if needed. Sometimes, sensor data may not be available immediately due to simulation steps being too low.
-
Run the simulation and check the output of sensor_data. If the contact sensor is set up correctly and simulation is running then you should see the sensor readings in the sensor_data variable.
from omni.isaac.sensor import _sensor
# Acquire the contact sensor interface
contact_sensor_interface = _sensor.acquire_contact_sensor_interface()
# Define the sensor path
sensor_path = "/World/final6_only_hand/__6_2/__6_2/Contact_Sensor"
# Run the simulation (make sure to start the simulation before trying to get sensor readings)
# Get sensor readings
sensor_data = contact_sensor_interface.get_sensor_readings(sensor_path)
# Print sensor data
print("Sensor Data:", sensor_data)
Make sure to start the simulation before trying to get sensor readings. Let us know if you still see the issues.
Can you post a screenshot of your stage window filtered by Rigid Body, and filtered by Collision API?
I want to check if the scene setup is correct.