OrbbecSDK ROS2 Wrapper

repository·v2-main·Indexed 43 days ago

https://github.com/orbbec/orbbecsdk_ros2

A ROS 2 wrapper for Orbbec cameras, including Gemini, Femto, Astra, and LiDAR series. Supports Foxy, Humble, and Jazzy distributions. Provides functionality for managing camera streams, reading/writing calibration parameters, retrieving device information, and configuring time synchronization. Includes specialized support for Net cameras (Femto Mega, Gemini 335Le) and GMSL cameras (Gemini 335Lg), as well as performance benchmarking and multi-camera synchronization verification tools.

Tokens
8.6K
Snippets
19
Records
31
Agent score
54%

What's inside OrbbecSDK ROS2

  1. Available OrbbecSDK_ROS2 Examples

    v2-main

    The orbbec_camera package provides several sample launch configurations and tools to demonstrate different camera interfaces and performance testing capabilities. Depending on your hardware (Femto Mega, Gemini 335Le, or Gemini 335Lg) and your goal (benchmarking or synchronization verification), you can use the following examples:

    | Name | Description | Experience Level |
    | :--- | :--- | :--- |
    | Net_camera | How to use Net camera in OrbbecSDK_ROS2 (Only Femto Mega and Gemini 335Le) | ⭐️ |
    | Gmsl_camera | How to use GMSL camera (Only Gemini 335Lg) | ⭐️ |
    | Benchmark | Benchmark the performance of various OrbbecSDK_ROS2 camera configurations | ⭐️⭐️ |
    | Multi_camera_synced_verification_tool | Verify the synchronization accuracy of multi-camera synchronization | ⭐️⭐️⭐️ |
  2. Understand the output folders of config_frameMatch.py

    v2-main

    The config_frameMatch.py tool categorizes synchronized multi-camera data into three distinct folders based on frame matching and timing thresholds:

    • matchFrames: Contains data where frames are successfully constrained within a half-frame interval.
    • notMatchFrames: Contains unmatched data that is not constrained within a half-frame interval.
    • abnormal: Contains data within a group that exceeds the configured tspRangeThreshold setting.
  3. Select the correct OrbbecSDK ROS2 branch

    v2-main

    The repository provides two main branches depending on your hardware and design requirements:

    • v2-main: The default branch. Recommended for new designs and modern Orbbec devices (e.g., Gemini 430, Gemini 301, Gemini 330, Femto, Astra 2, and LiDAR devices).
    • main (v1.x): Use this branch for legacy OpenNI devices or if you are maintaining older projects.

    Note: LiDAR devices require version v2.6.3 or later. If you are migrating an existing project from the main branch to v2-main, refer to the official migration guide.

  4. Choose the correct branch based on your device

    v2-main

    Orbbec provides two main branches for the ROS 2 wrapper. Choosing the correct one is critical for device support:

    • v2-main branch (v2.x): The default recommendation for new designs. It supports newer product series like Gemini 430, Gemini 301, Gemini 330, Gemini 2, Femto, and Astra 2.
    • main branch (v1.x): Use this branch if you are using older OpenNI compatible devices that are not supported by the v2-main branch.

    If you are migrating an existing project from the main branch to the v2-main branch, refer to the official Migration Guide.

  5. Quickstart: Launching the camera and visualizing in RViz2

    v2-main

    Follow these steps to verify your camera connection and visualize data:

    1. Check connection and launch the node (Terminal 1):
      source ~/ros2_ws/install/setup.bash
      ros2 run orbbec_camera list_devices_node # Verify camera is detected
      ros2 launch orbbec_camera gemini_330_series.launch.py # Launch specific series
    2. **Open RViz2** (Terminal 2):
       ```bash
    source ~/ros2_ws/install/setup.bash
    rviz2

    In RViz2, add the desired topics to visualize the data.

    1. Inspect topics and services (Terminal 3):
      source ~/ros2_ws/install/setup.bash
      ros2 topic list
      ros2 topic echo /camera/depth/camera_info
      ros2 service call /camera/get_sdk_version orbbec_camera_msgs/srv/GetString '{}'
    
    ```bash
    # Terminal 1: Launch camera
    source ~/ros2_ws/install/setup.bash
    ros2 run orbbec_camera list_devices_node
    ros2 launch orbbec_camera gemini_330_series.launch.py
    
    # Terminal 2: Visualize
    source ~/ros2_ws/install/setup.bash
    rviz2
    
    # Terminal 3: Inspect
    ros2 topic list
    ros2 topic echo /camera/depth/camera_info
  6. Quickstart: Launch and Verify Orbbec Camera

    v2-main

    Follow these steps to launch your camera and visualize the data in RViz2.

    1. Check connection and launch the camera node (Terminal 1):
      source ~/ros2_ws/install/setup.bash
      ros2 run orbbec_camera list_devices_node # Verify connection
      ros2 launch orbbec_camera gemini_330_series.launch.py # Launch specific series
    
    2. **Launch RViz2 for visualization** (Terminal 2):
       ```bash
    source ~/ros2_ws/install/setup.bash
    rviz2
    1. Inspect data (Terminal 3):
      • List topics: ros2 topic list
      • Echo a topic (e.g., camera info): ros2 topic echo /camera/depth/camera_info
      • Call a service (e.g., get SDK version): ros2 service call /camera/get_sdk_version orbbec_camera_msgs/srv/GetString '{}'
    # Terminal 1: Launch
    source ~/ros2_ws/install/setup.bash
    ros2 run orbbec_camera list_devices_node
    ros2 launch orbbec_camera gemini_330_series.launch.py
    
    # Terminal 2: Visualize
    source ~/ros2_ws/install/setup.bash
    rviz2
    
    # Terminal 3: Inspect
    ros2 topic list
    ros2 topic echo /camera/depth/camera_info
    ros2 service call /camera/get_sdk_version orbbec_camera_msgs/srv/GetString '{}'
  7. Run the Gemini_435Le_example_node

    v2-main

    To interact with an Orbbec camera using the Orbbec SDK in ROS2, you can run the 435le_example_node. This node provides an interactive menu in the terminal to manage camera parameters, streams, and device information.

    After building your workspace, execute the following command:

    ros2 run orbbec_camera 435le_example_node

    Once running, you can select features from the following menu:

    1. Write camera parameters
    2. Read camera parameters
    3. Enable camera streams
    4. Disable camera streams
    5. Get device info
    6. Show device status
    7. Set Color AE ROI
    8. Exit
  8. Install udev rules (Required for Linux)

    v2-main

    To allow the Orbbec camera to be correctly recognized by the system without requiring root privileges for every operation, you must install the udev rules.

    For Binary Installation:

    sudo cp /opt/ros/$ROS_DISTRO/share/orbbec_camera/udev/99-obsensor-libusb.rules /etc/udev/rules.d/
    sudo udevadm control --reload-rules && sudo udevadm trigger

    For Source Installation:

    cd ~/ros2_ws/src/OrbbecSDK_ROS2/orbbec_camera/scripts
    sudo bash install_udev_rules.sh
    sudo udevadm control --reload-rules && sudo udevadm trigger

    Warning: If you skip this step, device access will fail due to permission issues unless you run your ROS 2 nodes with sudo.

    # For Source Installation
    cd ~/ros2_ws/src/OrbbecSDK_ROS2/orbbec_camera/scripts
    sudo bash install_udev_rules.sh
    sudo udevadm control --reload-rules && sudo udevadm trigger
  9. Install udev rules (Mandatory for Linux)

    v2-main

    To ensure Orbbec cameras are recognized correctly and to avoid permission issues, you must install the udev rules. If this step is skipped, device access will fail unless run with sudo.

    If installed via Binary Package:

    sudo cp /opt/ros/$ROS_DISTRO/share/orbbec_camera/udev/99-obsensor-libusb.rules /etc/udev/rules.d/
    sudo udevadm control --reload-rules && sudo udevadm trigger

    If built from Source:

    cd ~/ros2_ws/src/OrbbecSDK_ROS2/orbbec_camera/scripts
    sudo bash install_udev_rules.sh
    sudo udevadm control --reload-rules && sudo udevadm trigger
    # For Binary Installation
    sudo cp /opt/ros/$ROS_DISTRO/share/orbbec_camera/udev/99-obsensor-libusb.rules /etc/udev/rules.d/
    sudo udevadm control --reload-rules && sudo udevadm trigger
    
    # For Source Installation
    cd ~/ros2_ws/src/OrbbecSDK_ROS2/orbbec_camera/scripts
    sudo bash install_udev_rules.sh
    sudo udevadm control --reload-rules && sudo udevadm trigger
  10. Install OrbbecSDK ROS2 from Source

    v2-main

    To build the wrapper from source in a colcon workspace, follow these steps:

    1. Create a workspace and clone the repository into the src directory:
      mkdir -p ~/ros2_ws/src
      cd ~/ros2_ws/src
      git clone https://github.com/orbbec/OrbbecSDK_ROS2.git
      cd OrbbecSDK_ROS2
      git checkout v2-main
    2. Build the workspace using `colcon` with Release mode enabled:
       ```bash
    cd ~/ros2_ws
    colcon build --event-handlers console_direct+ --cmake-args -DCMAKE_BUILD_TYPE=Release
    mkdir -p ~/ros2_ws/src
    cd ~/ros2_ws/src
    git clone https://github.com/orbbec/OrbbecSDK_ROS2.git
    cd OrbbecSDK_ROS2
    git checkout v2-main
    cd ~/ros2_ws
    colcon build --event-handlers console_direct+ --cmake-args -DCMAKE_BUILD_TYPE=Release
  11. Install OrbbecSDK ROS2 dependencies

    v2-main

    Before installing the OrbbecSDK ROS2 wrapper, ensure ROS 2 is installed and then install the following system and ROS dependencies:

    sudo apt install libgflags-dev nlohmann-json3-dev \
    ros-$ROS_DISTRO-image-transport ros-${ROS_DISTRO}-image-transport-plugins ros-${ROS_DISTRO}-compressed-image-transport \
    ros-$ROS_DISTRO-image-publisher ros-$ROS_DISTRO-camera-info-manager \
    ros-$ROS_DISTRO-diagnostic-updater ros-$ROS_DISTRO-diagnostic-msgs ros-$ROS_DISTRO-statistics-msgs ros-$ROS_DISTRO-xacro \
    ros-$ROS_DISTRO-backward-ros libdw-dev libssl-dev mesa-utils libgl1 libgoogle-glog-dev

    To enable ROS 2 auto-completion, run:

    eval "$(register-python-argcomplete3 ros2)"
    eval "$(register-python-argcomplete3 colcon)"
  12. Comply with libjpeg-turbo licensing requirements

    v2-main

    The libjpeg-turbo component in this repository is covered by three compatible licenses: the IJG License (for the libjpeg API and associated programs), the Modified (3-clause) BSD License (for the TurboJPEG API and build system), and the zlib License (for SIMD extensions).

    Depending on how you distribute the software, you must follow these compliance rules:

    1. Distributing modified source code

    • Do not remove existing copyright or license notices.
    • Add your own copyright notice to the header of every file you modify.
    • Include the IJG README file without altering its text.

    2. Distributing binaries or statically linked applications

    • Include this attribution message in your product documentation: This software is based in part on the work of the Independent JPEG Group.
    • If using the TurboJPEG API, you must also include the full text of the Modified BSD License in your product documentation.

    3. General Restrictions

    • No Endorsement: You cannot use the names of the IJG, the libjpeg-turbo Project, or its contributors for advertising or publicity without specific prior written permission.
    • No Warranty: The software is provided "as is" without any warranties or liability for damages.