Hello, I have created a function to save images from two cameras pre-created in usd file. This function will be called after every update. There is only one default viewport. When i run the code, the viewport will change to camera_third from perspective in a few seconds. But it will not change to camera_first. So two images saved are both saved with camera_third. How to solve this problem ? PPPPlease
def save_image(self):
camera_first_path = "/ur5/eef_link/Camera_first"
camera_third_path = "/ur5/Camera_third"
vp_api = get_active_viewport()
# save image from camera_first
vp_api.set_active_camera(camera_first_path)
time.sleep(0.5)
file_path = os.path.join(
self.data_path + f'/random_{self.generate_num}' + f'/epoch_{self._action_sequence_index}',
'Camera_first')
capture_viewport_to_file(vp_api, file_path)
# save image from camera_third
vp_api.set_active_camera(camera_third_path)
time.sleep(0.5)
file_path = os.path.join(
self.data_path + f'/random_{self.generate_num}' + f'/epoch_{self._action_sequence_index}',
'Camera_third')
capture_viewport_to_file(vp_api, file_path)