Omni.syntheticdata.sensors.get_rgb() issue

Error Log:
future: <Task finished coro=<InsDroneExtension._capture_frame() done, defined at e:\insov\inssimulation\exts\ins.sim.drone\ins\sim\drone\> exception=ValueError(‘cannot reshape array of size 0 into shape (0,0,newaxis)’)>
Traceback (most recent call last):
File “e:\insov\inssimulation\exts\ins.sim.drone\ins\sim\drone\”, line 165, in _capture_frame
data = syn.sensors.get_rgb(vp)
File “e:\insov\inssimulation\app\extscore\omni.syntheticdata\omni\syntheticdata\scripts\”, line 108, in get_rgb
return np.frombuffer(data, np.uint8).reshape(h, w, -1)
ValueError: cannot reshape array of size 0 into shape (0,0,newaxis)


        self._render_sub = self._usd_context.get_rendering_event_stream(
                                              name="ins drone render event",

    async def _capture_frame(self, vp, vp_name):
        global frame_count
        # await self._usd_context.next_frame_async(vp.get_id())
        await syn.sensors.next_sensor_data_async(vp.get_id())
        data = syn.sensors.get_rgb(vp)
        outFile = pathlib.Path(
            self._capture_save_dir).joinpath(vp_name + "_" + str(frame_count) +
        cv2.imwrite(str(outFile), cv2.cvtColor(data, cv2.COLOR_RGB2BGR))
        print(f"capture frame:{frame_count} ")
        frame_count = frame_count + 1

    def _on_render(self, render_event):
        global loop_count
        if not omni.timeline.get_timeline_interface().is_playing():
        frameNo = render_event.payload["frame_number"]
        viewId = render_event.payload["viewport_handle"]
        for viewport in view_port_factory.get_instance_list():
            vp = view_port_factory.get_viewport_window(viewport)
            vp_name = view_port_factory.get_viewport_window_name(viewport)
            if vp.get_id() == viewId:
                    f"Exec python frame:{frameNo} completed loop:{loop_count} id:{viewId} vp_name:{vp_name} "

                asyncio.ensure_future(self._capture_frame(vp, vp_name))
        loop_count = loop_count + 1

sometimes it works well, sometimes print this error log, how can I fix this?

Why print this error log? It seems current viewport not ready for read pixels.
What is NEW_FRAME event means? It is means payload[“viewport_handle”] new frame render end or begin render?
And How can I wait a viewport render end?

I fixed it by call enable_sensors before get_rgb, I don’t know if it is a correct way to solve this error log.