Skip to content
Tech Interview Prep
Technical interview guide

ROS (Robot Operating System) Fundamentals

The de facto standard middleware for robotics software: nodes, topics, and services that let components communicate.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed
Relevant for
Robotics Engineer

Scope: ROS 2 Rolling node, topic, service, action, QoS, executor, callback-group, lifecycle, tf2, parameter, security, rosbag2, and composition documentation reviewed 2026-09-04.

Overview

Curated: · Written: · Reviewed:

ROS (Robot Operating System) Fundamentals

In one line

ROS 2 is middleware that lets robot components exchange typed topics, services and actions over DDS. Reach for it whenever you split a robot into components and must say how they connect, when their callbacks run, and what happens when a peer is slow, late or gone.

Key definitions

  • Node: a graph participant with one coherent responsibility and lifecycle, not an OS process.
  • Topic: one-to-many asynchronous stream governed by QoS. It has no requester, so you cannot prove anyone consumed it.
  • Service: bounded request/response. The caller blocks or times out.
  • Action: goal, feedback, cancellation and result. It is five DDS endpoints under a state machine.
  • QoS: per-endpoint policies. The publisher's offer must satisfy the subscriber's request or no data flows.
  • Executor and callback group: the executor runs ready callbacks. Mutually exclusive groups serialize, reentrant groups allow overlap.
  • Lifecycle node: a managed node with explicit unconfigured, inactive, active and finalized states.

How it works

Discovery is peer-to-peer over DDS, with no master. Publisher and subscriber endpoints match per topic, and QoS compatibility decides whether data flows. The executor then runs callbacks one at a time within each mutually exclusive group, so one blocking callback delays everything queued behind it. Timers do not queue missed ticks: a 10 ms timer blocked by an 80 ms callback fires once when the executor frees up.

sensor QoS: best-effort, depth 5 blocks on disk stall camera node mapper recorder visualizer recorder callback group

Worked late-joiner trace: a 50 Hz publisher with KEEP_LAST 1 and VOLATILE loses all 100 samples published during the 2 s before a subscriber joins. Switch to TRANSIENT_LOCAL with depth 1 and the subscriber gets one retained sample at match. Transient-local replays state, not history, and a retained stale command must never become valid just because it was retained.

When to use and when not to

ChoiceUse whenAvoid when
Topiccontinuous streams, state, eventsyou need a reply or proof of consumption
Serviceshort bounded query within the caller's timeoutlong work or continuous data
Actioncancellable long task that needs feedbacka one-shot query
Transient locala late joiner needs current statethe message is a command that could be stale
Best-effort, shallow depthsensor streams over lossy linkscommands and configuration that must arrive
Separate callback group or processa blocking or independent callbackshared state with no locking
Composition in one processcopy-heavy pipelinesyou need crash isolation or separate resources

Traps interviewers probe

  1. Mismatched QoS fails silently. A publisher offering BEST_EFFORT never reaches a RELIABLE subscriber, and there is no error, only a log warning. Fix: compare offered and requested policies with ros2 topic info -v before debugging code.
  2. A blocking callback starves timers and other subscriptions. Fix: give the slow callback its own mutually exclusive group on a MultiThreadedExecutor, or move it to its own process, and hand off to a bounded queue.
  3. Reliable does not mean on time. Retransmission adds delay and still fails under partition. Fix: best-effort with shallow depth for sensors, plus a deadline to detect staleness.
  4. An absolute remap ignores the namespace. A topic remapped to /shared/image stays there under __ns:=/front, while relative names follow the namespace. Fix: confirm the real endpoints with ros2 node info.
  5. Reentrant groups race on shared state. Fix: guard shared state with a mutex, or put the callbacks in one mutually exclusive group. For safety watchdogs, measure elapsed time on a steady clock, since a stepped system clock can make a 100 ms timeout fire early or late.

Interview tips

Opening: "Streams go on topics and cancellable long work goes on actions. I set QoS per contract, then check the executor and callback budget, time and frame authorities, and what happens on failure."

Expected follow-ups:

  • How do you test QoS mismatch before deployment? Run integration tests over every offered and requested pair, plus late joins, loss and reconnect.
  • How do you make a restart idempotent for physical effects? Do not replay stale goals, and gate publishers, timers and actuators behind activation.
  • How do you secure a multi-robot deployment? Use DDS security with least-privilege policy per domain, topic and action. A namespace is not an authorization boundary.

30-second outline:

  1. Name the interface for each flow and why: topic, service or action, by delivery semantics.
  2. State QoS per contract: sensor streams best-effort with shallow depth, commands reliable, state transient-local only where a stale value is harmless.
  3. Place callbacks: which group, executor or process, so control never waits on I/O.
  4. Name the authorities: one publisher per dynamic transform edge, and a steady clock for timeouts.
  5. State the failure behavior: lifecycle gates activation, and the actuator stops when the watchdog expires.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.