Skip to main content

Integrate Stereolabs ZED Cameras with Foxglove

With Foxglove, you can stream data from any of the Stereolabs ZED cameras:

  • ZED Mini
  • ZED 2
  • ZED 2i
  • ZED X series

The ZED Foxglove Integration utilizes Stereolabs' ZED SDK and Foxglove SDK to stream real-time image and point cloud data from ZED cameras to Foxglove. Both Python and C++ implementations are available.

Installation

note

If you are using ROS, launch ZED ROS 2 wrapper, and run Foxglove Bridge, as described in ROS 2 Documentation.

ZED SDK Installation

  1. Download the ZED SDK for Ubuntu
  2. Install zstd:
    sudo apt install zstd
  3. Run the installer:
    chmod +x ZED_SDK_UbuntuXX_cudaYY.Y_vZ.Z.Z.zstd.run
    ./ZED_SDK_UbuntuXX_cudaYY.Y_vZ.Z.Z.zstd.run
tip

For up-to-date instructions on ZED SDK and CUDA installation, refer to the Stereolabs documentation.

ZED Foxglove Integration Setup

Python Installation

  1. Clone the repository:

    git clone https://github.com/stereolabs/zed-foxglove.git
    cd zed-foxglove
  2. Navigate to the Python directory:

    cd python/
  3. Install Python dependencies using Poetry (recommended):

    # Install Poetry if you haven't already
    curl -sSL https://install.python-poetry.org | python3 -

    # Install dependencies
    poetry install

    Or using pip:

    pip install foxglove-sdk>=0.4.0 numpy>=2.0 opencv-python>=4.10 requests>=2.31
  4. Install ZED Python API: The project includes the ZED Python wheel. Install it with:

    pip install pyzed-5.0-cp310-cp310-linux_x86_64.whl

Usage

Running the Python Application

cd python/

# Stream to Foxglove via WebSocket
poetry run python main.py --ws

# Record to MCAP file
poetry run python main.py --mcap output.mcap

# Both streaming and recording
poetry run python main.py --ws --mcap output.mcap

Command Line Options

OptionDescriptionDefault
--wsEnable WebSocket server for live streamingDisabled
--mcap <file>Output MCAP file nameoutput.mcap (C++), disabled (Python)
--help, -hShow help message-

Visualize Depth Camera Data in Foxglove

To visualize the ZED camera data in Foxglove, run the application with the --ws option, as described in the previous section, and follow these steps.

Make sure you are on the same network as your robot. In Foxglove, select Open connection from the dashboard or left-hand menu.

Select open connection

Select Foxglove WebSocket in the Open a new connection dialog, then enter the URL to your websocket server (ws://localhost:8765 by default):

Foxglove WebSocket dialog

Click "Open" to connect.

Visualize Camera Feed

Add an Image panel to your layout by clicking the Add panel button in the top left corner and selecting the Image panel.

Add image panel

Configure the panel by selecting the appropriate image topic from the Topic dropdown in the panel settings.

To visualize RGB camera feed, select image_0 topic. To visualize the depth field, select depth_0.

Select Image panel

Visualize Point Cloud

Add a 3D panel to your layout by clicking the Add panel button in the top left corner and selecting the 3D panel.

Add 3D panel

Enable visibility of the point_cloud_0 in the topic section. Select zed_0 as the display frame.

Set up 3D panel

Learn More