Hello everyone,
I started looking at Isaac Sim’s sensors using the sensor examples. While setting up the LIDAR works fine for me, I am running into problems with the Generic Range Sensor, even though it looks quite similar in most parts.
Creating the generic prim works fine, but afterwards it does not work. No line shows up and the data I get from the sensor is always the same, no matter if I move and rotate the sensor or put an object in front of it.
For context: I am trying to simulate a simple static optical sensor that should detect when an object passes by on a conveyor. The sensor should be visualised by a laser, like the lidar sensor.
Here is my code snippet for creating the generic. Getting the location might be a bit compilcated, but it worked for the lidar sensor. The function is called by a ui button at the moment.
def _create_generic(self):
# setup
stage = omni.usd.get_context().get_stage()
self.genericPath = “/World/Generic”
# delete generic instance if created earlyer
if get_prim_at_path(self.genericPath):
delete_prim(self.genericPath)
# Sensor should be created on predefined cube location in model
#I create a prim on genericPath on location to override it with the Gerneric
prim = stage.GetPrimAtPath("/World/roller_conveyor/Cube")
xformCache = UsdGeom.XformCache(Usd.TimeCode.Default())
transform = xformCache.GetLocalToWorldTransform(prim)
translation = transform.ExtractTranslation()
xformPrim = UsdGeom.Xform.Define(stage, self.genericPath)
xformPrim.AddTranslateOp().Set(translation)
# create sensor
self.generic = RangeSensorSchema.Generic.Define(stage, Sdf.Path(self.genericPath))
self.generic.CreateMinRangeAttr().Set(0.2)
self.generic.CreateMaxRangeAttr().Set(1.5)
self.generic.CreateDrawPointsAttr().Set(False)
self.generic.CreateDrawLinesAttr().Set(True)
self.generic.CreateEnabledAttr().Set(True)
self.generic.CreateStreamingAttr().Set(False)
self.generic.CreateSamplingRateAttr().Set(10)
self.generic.GetDrawLinesAttr().Set(True)
self.generic.GetDrawPointsAttr().Set(False)
self.generic.GetEnabledAttr().Set(False)
self.generic.GetMaxRangeAttr().Set(0.02)
self.generic.GetMinRangeAttr().Set(1.5)
I then got the data with the function get_linear_depth_data() of _range_sensor.acquire_generic_sensor_interface().
Can anyone help me get the sensor working? Any help would be appreciated. Thank you!
Best regards,
Nico
