sl.Camera.get_streaming_device_list() Did not finish

I am attempting to implement a way to publish/stream cameras in one thread, and then start a fusion instance in a seperate thread.

To do this i have the first task which i wrote as such:

class CameraPublishTask(ObservationTask):
    def __init__(self, config, redis_handler, task_name: str = "Camera") -> None:
        super().__init__(config, redis_handler, task_name)

    def loop(self):
        print(f"Entering Loop: {self.task_name}")
        cameras = Camera.find_and_build(self.config)
        for camera in cameras:
            s,p = camera.enable_streaming()
            camera.start_publishing()
        while True and self.is_running:
            for camera in cameras:
                if camera.can_capture:
                    image = camera.capture()
                    

The second task I want to look like so:

class FusionTask(ObservationTask):
    def __init__(self,config,redis_handler, task_name: str = "Fusion") -> None:
        super().__init__(config,redis_handler, task_name)

  
    def loop(self):
        print(f"Entering Loop: {self.task_name}")
 
        self.is_running = True
        streaming_props = sl.Camera.get_streaming_device_list()
        self.fusion = sl.Fusion()
        self.fusion.init(self.config.parse_fusion_params())
        self.fusion.enable_positionnal_tracking(self.config.parse_fusion_params_tracking())

 
        for cam in streaming_props:
          
            cam_params = self.config.parse_communication_params()
            cam_params.set_for_local_network(port=cam.port,ip=cam.ip)

            translation = sl.Translation(0,0,0)
            transform = sl.Transform()
            transform.set_translation(translation)
            cam_id = sl.CameraIdentifier(cam.serial_number)
            status = self.fusion.subscribe(
                uuid=cam_id,
                communication_parameters=cam_params,
                pose=transform

            )
            logging.info(f"Subscribed to Camera {cam_id} with status {status}")
        
        while True and self.is_running:
           # DO the thing
        
        self.fusion.close()
            

Logs:

INFO:root:GPS capture started
INFO:root:Camera capture started
INFO:root:Found cameras: [24837248]
WARNING:root:No cameras matched, defaulting to first camera
INFO:root:Camera 24837248 initialized
INFO:root:Camera 24837248:  Configuration Successful
INFO:root:Camera 24837248: Streaming enabled: SUCCESS
INFO:root:Camera 24837248: Started publishing SUCCESS

How do i start camera streaming so that i can use sl.Camera.get_streaming_device_list() in other thread/proces?

Hi @fdunbar,

I believe there has been a misunderstanding on the usage of the Fusion API.

In your case, you wish to fuse multiple cameras’ positional tracking and GNSS to be fused by the fusion module in separate threads.

In the camera thread, you only require:

  • To call the Camera.start_publishing() method which will start the communication between the Camera and Fusion module
  • To call the Camera.grab() and Camera.getPosition() methods in order to retrieve data from the camera and publish this data to the Fusion module.

You do not need to call the enable_streaming method, this enables the SDK’s streaming module, which allows sending image and IMU data over the local network, this does not involve the Fusion module.

In the Fusion thread, you need to:

  • replace the set_from_local_network method to set_for_shared_memory. The Fusion module will communicate data through shared memory, this workflow is recommended for an intra-process program like your.
  • Get the serial numbers of the cameras from your program. The get_streaming_device_list is again a method from the SDK Streaming module, we do not currently have a discovery of publishers for the Fusion module. Currently, you have to keep track of the camera serial numbers yourself and set them as parameters to the Fusion.

Best,
Matthew