I’m trying to change the timestamp of ros camera topic from simulator time to cpu time, and I did the following:
def publish_rgb(self, camera: Camera, freq):
render_product = camera.get_render_product_path()
step_size = int(1)
topic_name = camera.prim_path.split(“/”)[-1] + self._camera_topic
queue_size = 1
node_namespace = “”
frame_id = camera.prim_path.split(“/”)[-1]
rv = omni.syntheticdata.SyntheticData.convert_sensor_type_to_rendervar(sd.SensorType.Rgb.name)
writer = rep.writers.get(rv + "ROS1PublishImage")
writer.initialize(
frameId=frame_id,
nodeNamespace=node_namespace,
queueSize=queue_size,
topicName=topic_name,
)
writer.attach([render_product])
# Modify the graph to add a CPU time provider for the timestamp
keys = og.Controller.Keys
(graph, nodes, _, _) = og.Controller.edit(
{"graph_path": f"/World/{camera.prim_path.split('/')[-1]}_rgb_graph", "evaluator_name": "execution"},
{
keys.CREATE_NODES: [
("OnPlaybackTick", "omni.graph.action.OnPlaybackTick"),
("ReadTimes", "omni.isaac.core_nodes.IsaacReadTimes"), # Use IsaacReadTimes for CPU time
("ReadRenderProduct", "omni.syntheticdata.SyntheticDataRenderProduct"),
("PublishImage", "omni.isaac.ros_bridge.ROS1PublishImage"),
],
keys.SET_VALUES: [
("PublishImage.inputs:topicName", topic_name),
("PublishImage.inputs:frameId", frame_id),
("ReadRenderProduct.inputs:renderProductPath", render_product),
],
keys.CONNECT: [
("OnPlaybackTick.outputs:tick", "ReadRenderProduct.inputs:execIn"),
("OnPlaybackTick.outputs:tick", "ReadTimes.inputs:execIn"),
("ReadRenderProduct.outputs:image", "PublishImage.inputs:image"),
("ReadTimes.outputs:execOut", "PublishImage.inputs:execIn"),
("ReadTimes.outputs:systemTime", "PublishImage.inputs:timeStamp"), # Connect system time here
],
},
)
return
however it doesn’t work as expected and I’m wondering is there something I might doing incorrectly here?