I followed the 7.2.4 Publishing Camera’s Data to publish the depth topic of a created camera and found that the depth value is set according to the unit of the scene and its type is uint8. However, my scene range is beyond the 255, the depth image cannot show the far away things. I wonder how to change the dtype of the published depth to float to get a larger range, or how to publish the exact depth in meters.
Below is part of my code
def publish_depth(camera: Camera, freq):
# The following code will link the camera's render product and publish the data to the specified topic name.
render_product = camera._render_product_path
step_size = int(60/freq)
topic_name = camera.name+"_depth"
queue_size = 1
node_namespace = ""
frame_id = camera.prim_path.split("/")[-1] # This matches what the TF tree is publishing.
rv = omni.syntheticdata.SyntheticData.convert_sensor_type_to_rendervar(
sd.SensorType.DistanceToImagePlane.name
)
writer = rep.writers.get(rv + "ROS2PublishImage")
writer.initialize(
frameId=frame_id,
nodeNamespace=node_namespace,
queueSize=queue_size,
topicName=topic_name
)
writer.attach([render_product])
# Set step input of the Isaac Simulation Gate nodes upstream of ROS publishers to control their execution rate
gate_path = omni.syntheticdata.SyntheticData._get_node_path(
rv + "IsaacSimulationGate", render_product
)
og.Controller.attribute(gate_path + ".inputs:step").set(step_size)
return
camera = Camera(prim_path="/World/turtlebot3_burger/base_link/Camera",
resolution=(1280,720),
frequency=30)
camera.initialize()
publish_depth(camera, 30)