Zed Node crashes when disabling spatial mapping in ROS2

Hi!
When calling the ROS2 service “zed/enable_mapping” to disable mapping it sometimes leads to the Zed node crashing. Im calling the service like this

class MyClass():
    def __init__(self, node, **kwargs):
        self.enable_mapping_service = self.node.create_client(SetBool, "zed/enable_mapping")

        if not self.enable_mapping_service.wait_for_service(timeout_sec=5.0):
            self.node.get_logger().error("Service 'zed/enable_mapping' not available")
            self.enable_mapping_service = None


    def enable(self):
        self.enable_mapping_service.call_async(SetBool.Request(data=True))

    def disable(self):
        self.enable_mapping_service.call_async(SetBool.Request(data=False))

Calling the disable and enable functions repeatedly with around a 10 second interval gives these logs before crashing:

[component_container_isolated-9] [INFO] [1754922963.946083442] [my_namespace.zed]: ** Enable Spatial Mapping service called **
[component_container_isolated-9] [INFO] [1754922963.946181910] [my_namespace.zed]: Starting Spatial Mapping
[component_container_isolated-9] [INFO] [1754922963.946208888] [my_namespace.zed]: === Starting Spatial Mapping ===
[component_container_isolated-9] [2025-08-11 14:36:03 UTC][ZED][INFO] init
[component_container_isolated-9] [INFO] [1754922966.792117701] [my_namespace.zed]:  * Resolution: 0.1 m
[component_container_isolated-9] [INFO] [1754922966.792217162] [my_namespace.zed]:  * Max Mapping Range: 6 m
[component_container_isolated-9] [INFO] [1754922966.792235882] [my_namespace.zed]:  * Map point cloud publishing rate: 1 Hz
[component_container_isolated-9] [INFO] [1754922976.837201099] [my_namespace.zed]: ** Enable Spatial Mapping service called **
[component_container_isolated-9] [INFO] [1754922976.837297775] [my_namespace.zed]: Stopping Spatial Mapping
[ERROR] [component_container_isolated-9]: process has died [pid 1814970, exit code -11, cmd '/opt/ros/humble/lib/rclcpp_components/component_container_isolated --use-level info --ros-args -r __node:=zed_container -r __ns:=/my_namespace']

Hi @oscar,

Thank you for reporting this, could you run the ZED_Diagnostic tool so that we can have more information on your setup, and can you share the version of the zed-ros2-wrapper you are using + config file?

Hi,
Unfortunatly I can’t upload the diagnostic results as it says “Sorry, new users can not upload attachments”, but I’m on Ubuntu 22.04.4 LTS on a Nvidia Jetson Orin Nano and running in a Docker Container. Im using the latest zed-ros2-wrapper from GitHub master branch and the ZED SDK from (https://download.stereolabs.com/zedsdk/5.0/l4t36.4/jetsons).

Im using the standard configuration with the following param override:

/**:
  ros__parameters:
    mapping:
      mapping_enabled: false # True to enable mapping and fused point cloud pubblication
    body_tracking:
      bt_enabled: false # True to enable Body Tracking
      model: 'HUMAN_BODY_MEDIUM' # 'HUMAN_BODY_FAST', 'HUMAN_BODY_MEDIUM', 'HUMAN_BODY_ACCURATE'
      body_format: 'BODY_18' # 'BODY_18','BODY_34','BODY_38'
      allow_reduced_precision_inference: false # Allow inference to run at a lower precision to improve runtime and memory usage
      max_range: 15.0 # [m] Defines a upper depth range for detections
      body_kp_selection: 'FULL' # 'FULL', 'UPPER_BODY'
      enable_body_fitting: false # Defines if the body fitting will be applied
      enable_tracking: true # Defines if the object detection will track objects across images flow
      prediction_timeout_s: 0.5 # During this time [sec], the skeleton will have OK state even if it is not detected. Set this parameter to 0 to disable SDK predictions
      confidence_threshold: 50.0 # [DYNAMIC] - Minimum value of the detection confidence of skeleton key points [0,99]
      minimum_keypoints_threshold: 5 # [DYNAMIC] - Minimum number of skeleton key points to be detected for a valid skeleton

Hi,
Do you have any updates on this issue? I Have attached the ZED diagnostic results.

Den ons 13 aug. 2025 kl 09:30 skrev Gabriel (Stereolabs) support@stereolabs.com:

Hi,

Thank you for sending the information, we have everything on our side to reproduce. I have logged this issue internally to be fixed in the zed ros2 wrapper. This is most likely an unprotected concurrent access issue.

Hi again,

Do you have any updates on this bug? Will it be fixed in an upcoming release?