Hi, I’m trying to build up an environment that equips sensor on the fingertip, and I found that the force sensor was canceled in 2023.1, the contact sensor and effort sensor are supported. If I just need to know the force from on direction, what’s different between there two sensors?
And 2), I’m trying to build up the env with contact sensor, I build the simple code for testing:
from omni.isaac.sensor import ContactSensor
import numpy as np
from omni.isaac.sensor import _sensor
class ContactSensorView:
"""the isaac sim extensions have no contact sensor view for tactile sensor"""
def __init__(self):
self._spawn_prim_path: str = None
self._contact_sensor_interface = _sensor.acquire_contact_sensor_interface()
def spawn_single(
self,
prim_path: str,
sensor_name: str,
name: str,
translation: np.ndarray = np.array([0, 0, 0]),
radius: float = 0.001,
):
self.sensor = ContactSensor(
prim_path=prim_path+sensor_name,
name=name,
frequency=60,
translation=translation,
radius=radius,
)
print("[INFO] spawn on single contact sensor successful.")
def get_sensor_data(
self,
prim_path,
):
print("------")
print("[INFO] sensor value:", self.sensor.get_current_frame())
print("[INFO] sensor validation:", self.sensor.is_valid())
print("[INFO] sensor radius:", self.sensor.get_radius())
# print("[INFO] sensor frequency:", self.sensor.get_frequency())
# return value
# return self._contact_sensor_interface.get_sensor_reading(
# prim_path,
# use_latest_data = True,
# ).value
The get_frequency() function can not work (sensor period = 0) and I can not get the contact value:
------
[INFO] sensor value: {'time': 0, 'physics_step': 0}
[INFO] sensor validation: True
[INFO] sensor radius: -1.0
Traceback (most recent call last):
File "/Orbit/source/standalone/demo/play_arms.py", line 207, in <module>
main()
File "/Orbit/source/standalone/demo/play_arms.py", line 192, in main
tac_sensor.get_sensor_data(prim_path=test_pos+sensor_name)
File "/Orbit/source/standalone/demo/contactsensor.py", line 44, in get_sensor_data
print("[INFO] sensor frequency:", self.sensor.get_frequency())
File "/.local/share/ov/pkg/isaac_sim-2023.1.0/exts/omni.isaac.sensor/omni/isaac/sensor/scripts/contact_sensor.py", line 173, in get_frequency
return int(1.0 / self._isaac_sensor_prim.GetSensorPeriodAttr().Get())
ZeroDivisionError: float division by zero
Thanks!