Skip to content

Remove PID whitelist in startDevice (let librealsense gate which cameras are supported) - #3532

Merged
Nir-Az merged 1 commit into
realsenseai:ros2-developmentfrom
remibettan:enable-all-rs-devices
Jun 30, 2026
Merged

Nir-Az merged 1 commit into
realsenseai:ros2-developmentfrom
remibettan:enable-all-rs-devices

Conversation

@remibettan

Copy link
Copy Markdown
Collaborator

Summary

Removes the hard-coded PID whitelist (and the D555-over-DDS special case) inside RealSenseNodeFactory::startDevice(). The wrapper now instantiates BaseRealSenseNode for any device that reaches startDevice(), deferring the "is this a RealSense camera I support?" question to the installed librealsense2.

Why

Every path that reaches startDevice() is already gated by librealsense itself:

Path Source of _device
Live enumeration (_query_thread) RSContextSingletonWrapper::getInstance().query_devices()
Hot-plug callback (changeDeviceCallback) rs2::event_information::get_new_devices()
Bag playback RSContextSingletonWrapper::getInstance().load_device(rosbag_filename)

None of these can produce a non-RealSense device. So the wrapper's switch-over-PID was a redundant second filter — but a fragile one: every new camera model required adding its PID to the wrapper before it would work, even if the librealsense version on the machine already supported it. This was the motivation for the D555/DDS special case (DDS devices report PRODUCT_ID as the literal string \"DDS\" rather than a hex PID, so the whitelist couldn't match by PID and had to fall through a name-based override).

What changes

  • Delete the switch(pid) { case RS400_PID: ... default: ROS_FATAL_STREAM(\"Unsupported device!\") } block.
  • Delete the connection_type == \"DDS\" && device_name.find(\"D555\") special case.
  • Replace with a single ROS_INFO_STREAM announcing the device that's starting.

No public API change. Net diff is +7 / -43 in one file (realsense_node_factory.cpp).

Effects

  • Newly-released cameras work as soon as the user's installed librealsense2 enumerates them — no wrapper rebuild required.
  • Devices that librealsense doesn't enumerate at all never reach startDevice(), so the old \"Unsupported device!\" fatal path is unreachable by construction.
  • If a future librealsense were to enumerate something the wrapper's BaseRealSenseNode truly can't drive, the failure now surfaces from the BaseRealSenseNode constructor / publishTopics() path (already wrapped in the existing try/catch (rs2::backend_error&) below) rather than from a wrapper-side fatal.

🤖 Generated with Claude Code

@remibettan
remibettan requested a review from Nir-Az June 29, 2026 11:55

@Nir-Az Nir-Az left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@Nir-Az
Nir-Az merged commit e842887 into realsenseai:ros2-development Jun 30, 2026
8 of 9 checks passed
@remibettan
remibettan deleted the enable-all-rs-devices branch June 30, 2026 07:48
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