Fused_cameras sample code problems, not sure if I'm doing something wrong or it's not updated

Hello,

So I’m trying to get two cameras working using the fused_cameras sample, however I am running into a number of problems due to code and I’m not sure if it’s because the sample is not updated or if I’m doing something wrong. I am posting this because I haven’t found any other post with problems similar to mine.

So first up is the code on lines 140-141, it gives the following error:
TypeError: init() missing 3 required positional arguments: ‘_params’, ‘_is_tracking_on’, and ‘_body_format’

 viewer = gl.GLViewer()
    viewer.init()

I have tried to solve this in the following way, using:

viewer.init(camera_info.camera_configuration.calibration_parameters.left_cam, True, body_tracking_parameters)

Which brings me to another error:

AttributeError: ‘GLViewer’ object has no attribute ‘update_bodies’

On line 159, code

        if fusion.process() == sl.FUSION_ERROR_CODE.SUCCESS:
            # Retrieve detected objects
            fusion.retrieve_bodies(bodies, rt)
            # for debug, you can retrieve the data send by each camera, as well as communication and process stat just to make sure everything is okay
            # for cam in camera_identifiers:
            #     fusion.retrieveBodies(single_bodies, rt, cam);
            viewer.update_bodies(bodies)

which I ‘fixed’ using the following code:

 # Create ZED objects filled in the main loop
    bodies = sl.Bodies()
    image = sl.Mat()

    display_resolution = sl.Resolution(min(camera_info.camera_configuration.resolution.width, 1280),
                                       min(camera_info.camera_configuration.resolution.height, 720))

    single_bodies = [sl.Bodies()]

    body_runtime_param = sl.BodyTrackingRuntimeParameters()
    body_runtime_param.detection_confidence_threshold = 40

    while viewer.is_available():
        for serial in senders:
            zed = senders[serial]
            if zed.grab() == sl.ERROR_CODE.SUCCESS:
                zed.retrieve_bodies(bodies, body_runtime_param)

        if fusion.process() == sl.FUSION_ERROR_CODE.SUCCESS:
            # Retrieve detected objects
            fusion.retrieve_bodies(bodies, rt)
            zed.retrieve_image(image, sl.VIEW.LEFT, sl.MEM.CPU, display_resolution)
            viewer.update_view(image, bodies)

With this it finally stops giving errors and it loads up a black screen which shows nothing even as I walk in front of the cameras. So there is obviously something going wrong, and I just want to know if there is something I am doing wrong, and any tips on how I could move forward.

Thanks

Hi, I’m not sure you use the right version of the SDK and python module. Can you install 4.0.3 ?

Hello,

I currently have SDK 4.0.3 and the python module I had downloaded the python module from get_python_api.py file I found on samples.

Small update, I managed to fix it by updating the ogl.viewer script, someway I seemed to have an older one, so I looked around on GitHub until I found an updated one, so it now works.