Skip to content

Fix lazy publishing#774

Open
chameau5050 wants to merge 1 commit intoluxonis:humblefrom
arlyx-technologies:humble
Open

Fix lazy publishing#774
chameau5050 wants to merge 1 commit intoluxonis:humblefrom
arlyx-technologies:humble

Conversation

@chameau5050
Copy link

Overview

Author: Olivier Demers

Issue

Issue link (if present):
Issue description:
Related PRs

Changes

ROS distro: Humble
List of changes:

  • Fix the lazy publishing feature

Testing

Hardware used: OAK-D-PRO-W-POE
Depthai library version: 3

Visuals from testing

Add screenshots/gifs/videos from RVIZ or other visualizers demonstrating the effect of the changes when applicable.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates BridgePublisher’s “lazy publishing” behavior so that when lazy publishing is disabled, messages are still published even if there are no subscribers.

Changes:

  • Publish the main ROS message even with zero subscribers when _lazyPublisher is disabled.
  • Publish the camera info message even with zero subscribers when _lazyPublisher is disabled.
Comments suppressed due to low confidence (1)

depthai_bridge/include/depthai_bridge/BridgePublisher.hpp:247

  • When _lazyPublisher is false, this condition is always true even if _isImageMessage is false (e.g., Image publisher without cameraName). In that case _camInfoManager / _cameraInfoPublisher are never initialized, so this will dereference a null pointer and crash. Gate camera-info publication on _isImageMessage (and/or check the pointers) in addition to the lazy/subscriber logic.
            if(!_lazyPublisher || infoSubCount > 0) {
                auto localCameraInfo = _camInfoManager->getCameraInfo();
                localCameraInfo.header.stamp = currMsg.header.stamp;
                localCameraInfo.header.frame_id = currMsg.header.frame_id;
                _cameraInfoPublisher->publish(localCameraInfo);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants