Omniverse custom writer

Hey everyone,
maybe you can help me.

I work at an extension, where i programmed a remote UI for driving the Jetbot inside my environment:

The last step is, when the train mode is activated by pressing the tainings buttom, that the camera of the Jetbot collects the images and save them and in the same time, to collect the current speed values of the Jetbot wheels prims and save them together with the image IDs into a csv file.

I noticed that i can’t use the Basicwriter of Omniverse so i tried to adapt all necessary functions i need to copy the basicwriter and to extend it for my own purpose and i face some issues:

current writer:


As shown here, the counter jumps sometimes several numbers. How can i fix this issue?