ROS2 DDS Discovery - Participant Filtering

Hard ROS2 Core 0% pass rate

Practice the ROS2 DDS Discovery - Participant Filtering coding problem in ROS2 Core. Browser-based execution with automated grading — no local ROS install required. 0% of engineers pass this challenge.

Problem Statement

In ROS2, nodes discover each other automatically via DDS (Data Distribution Service). This discovery is scoped by the ROS_DOMAIN_ID — nodes in different domains are completely invisible to each other. This is how you isolate a robot fleet, a test environment, or a secure subsystem.

Requirements

  • Create a node named secure_node
  • Declare a parameter domain_id with a default value of 0
  • Read the ROS_DOMAIN_ID environment variable using os.environ.get("ROS_DOMAIN_ID", "0")
  • On startup, log exactly: "Operating in Domain ID: X" where X is the domain ID value
  • Also log: "Participant filtering active: secure_node is isolated to this domain"

Input/Output Format

Output (console logs on startup):

[secure_node]: Operating in Domain ID: 42
[secure_node]: Participant filtering active: secure_node is isolated to this domain

How Domain ID Works

Robot A (DOMAIN_ID=0) ←—cannot see—→ Robot B (DOMAIN_ID=1)
Robot A (DOMAIN_ID=0) ←—can see——→  Robot C (DOMAIN_ID=0)

Setting different domain IDs is the simplest way to run multiple independent ROS2 systems on the same network without interference.

⚠️ Common Pitfalls

  • os.environ.get("ROS_DOMAIN_ID", "0") returns a string — don't forget int() if you need to compare numerically
  • Forgetting import os at the top of your file
  • Domain ID must be an integer between 0 and 101 (ROS2 Humble restriction)

📚 Helpful Resources

Frequently asked questions

What is the ROS2 DDS Discovery - Participant Filtering practice problem?

It is a hands-on ROS2 Core challenge on SimuCode where you implement and run ROS2 code in the browser with runtime-verified tests.

How do I practice ROS2 DDS Discovery - Participant Filtering online?

Open this page, sign in, and solve the problem in the built-in IDE. Your solution is graded against real ROS2 execution checks.

What skills does ROS2 DDS Discovery - Participant Filtering test?

This Hard problem focuses on ROS2 Core skills used in robotics interviews and production systems.