Hello,
I’m trying to get timestamps of lidar points from RtxSensorCpuIsaacCreateRTXLidarScanBuffer and use custom writer to populate PointCloud2 with timestamp and intensity, along with x,y,z for each point. As a basis I took a standard example standalone_examples/api/isaacsim.ros2.bridge/rtx_lidar.py
and added my own writer:
writer = rep.writers.get(“RtxLidar” + “ROS2PublishPointCloudCustom”)
where
class RtxLidarROS2PublishPointCloudCustom(Writer):
def init(self, topic_name: str, frame_id: str):
super().init()self.name = “RtxLidarROS2PublishPointCloudCustom”
self.topic_name = topic_name
self.frame_id = frame_id
self.annotators.append(AnnotatorRegistry.get_annotator(
"RtxSensorCpuIsaacCreateRTXLidarScanBuffer",
init_params={
"outputTimestamp": True,
"keepOnlyPositiveDistance": True,
}
))
self.annotators.append(AnnotatorRegistry.get_annotator("IsaacReadTimes"))
def write(self, data):
try:
info = data.get("RtxSensorCpuIsaacCreateRTXLidarScanBuffer").get("info")
timestamp = info.get("timestamp")
frameNumber = data.get("IsaacReadTimes").get("frameNumber")
simTime = data.get("IsaacReadTimes").get("simulationTime")
with open('otimestamp.txt', 'a') as f:
with np.printoptions(threshold=np.inf):
print(frameNumber, simTime, '\n', timestamp, '\n', file=f)
...
rep.WriterRegistry.register(RtxLidarROS2PublishPointCloudCustom)
In the documentation it’s stated that a timestamp is in nanoseconds counting from the simulation start. However, the bare output of RtxSensorCpuIsaacCreateRTXLidarScanBuffer “timestamp” field displays rather odd values. Here is the snippet of the output file I stream this info to, in the following form (see the code snippet above):
frameNumber simulationTime
[point_1_timestamp, point_2_timestamp, … point_n_timestamp]
51 0.03333333507180214
[16488270206394833508 16488270206394833508 16488270206394833508
16488270206394833508 16488270206394833508 16488270206394833508
16488270206394833508 16488270206394833508 16488285238780373008
16488285238780373008 16488285238780373008 16488285238780373008
16488285238780373008 16488285238780373008 16488285238780373008
16488285238780373008 16488300271165912508 16488300271165912508
…
52 0.05000000260770321
[16488270206394833508 16488270206394833508 16488270206394833508
16488270206394833508 16488270206394833508 16488270206394833508
16488270206394833508 16488270206394833508 16488285238780373008
16488285238780373008 16488285238780373008 16488285238780373008
16488285238780373008 16488285238780373008 16488285238780373008
16488285238780373008 16488300271165912508 16488300271165912508
16488300271165912508 16488300271165912508 16488300271165912508
…
Please, could you clarify on this?