Stuck on a ROS 2 problem? Find it by symptom below. Most guides include numbers measured in a ros:jazzy container, and the reproduction code is on GitHub. New guides appear here as soon as they go live.
Install and build
- colcon test "1 package had test failures": test_flake8, test_pep257 and test_copyright in an ament_python package, measured
Why a fresh ament_python package passes colcon test, which flake8, pep257 and copyright errors appear once you add a node, what each fix changes, and how a pip… - Multiple ROS 2 Distros on One Machine: Humble, Jazzy, Kilted
Ubuntu 24.04 apt can add Kilted or Rolling next to Jazzy, not Humble; source one distro per shell, and mixed distros or RMWs are unsupported. - Duplicate package names not supported (colcon) and "already built in one or more underlay workspaces": copies, ignore files and --allow-overriding, measured
Why colcon stops with exit 1 when two folders share a package name, which ignore files hide a copy (COLCON_IGNORE, AMENT_IGNORE, CATKIN_IGNORE, not lowercase), when --paths helps, and… - CMake Error: The current CMakeCache.txt directory is different than the directory where CMakeCache.txt was created (colcon, moved or mounted workspace), measured
Why colcon fails after a ROS 2 workspace is moved or mounted at another path, why a cp -r copy passes but builds the original sources, and which… - SetuptoolsDeprecationWarning: setup.py install is deprecated in colcon build: harmless, hidden by current colcon, and which pip setuptools versions break ament_python, measured
The setup.py install and easy_install warnings appeared only with colcon-core 0.15.2, not 0.21.3, and builds and ros2 run still worked. Pip setuptools 58.2.0 failed on Jazzy and Lyrical,… - "Could not find a package configuration file provided by" in ROS 2 colcon build: five causes on Humble, Jazzy and Lyrical, measured
What causes the CMake find_package error in an ament_cmake package: a package missing from package.xml (rosdep reports success and installs nothing), apt-get update skipped in Docker, /opt/ros not… - ROS 2 "module 'em' has no attribute 'BUFFERED_OPT'" and "No module named 'em'": colcon building interfaces with a venv Python, measured
Why rosidl_generate_interfaces fails when CMake picks your venv Python: empy 4 on Humble, missing em, catkin_pkg, lark, numpy and setuptools, which fixes worked (deactivate, empy==3.3.4, both Python executable… - colcon build: "listing git files failed - pretending there aren't any" in ament_python packages (measured)
The message comes from pip-installed setuptools_scm, not ROS, and the build still succeeds. Measured on Humble, Jazzy and Lyrical: when it appears, the one setuptools_scm case that really… - Failed to fetch packages.ros.org 404 Not Found: ROS 2 apt update
apt update clears the ROS 2 404 only when it actually downloads a new package list: look for Get, not Hit or an error, then recount the Failed… - ROS 2 EXPKEYSIG F42ED6FBAB17C654 apt update fix: ros2-apt-source
Your copy of the same ROS key expired. Install ros2-apt-source and delete the old ros2.list and keyring, or apt stops on a Signed-By conflict. - MoveIt 2 colcon build RAM: Default Build Fails at 8GB, Sequential Peaks at 2.4GB (Measured)
A default colcon build of MoveIt 2 (Jazzy, 41 packages) was killed at an 8GB cap and peaked at 8.7GiB at 16GB; a sequential build peaked at 2.4GiB… - How Much RAM Does colcon build Need? Nav2 Built at 16, 8 and 4GB
Default colcon build of Nav2 failed at 4GB and peaked at 7.8GiB of 8GiB; a sequential build peaked at 2.7GiB and finished at 4GB. - ROS 2 Humble EOL Is May 2027: Humble vs Jazzy vs Lyrical, Which Distro to Use (2026)
As of November 2026, Iron is past EOL, Kilted ends this month and Humble has 6 months left (May 2027); for longer projects use Jazzy (30 months, until… - ros2: command not found on Jazzy? local_setup.bash vs setup.bash (measured)
In a fresh shell, install/local_setup.bash adds only your overlay and no ros2 command; install/setup.bash also loads the underlay it was built on. - colcon build Slow? What Overlays, COLCON_IGNORE and --symlink-install Actually Save, Measured on ROS 2 Jazzy
On ROS 2 Jazzy, a no-change colcon build still cost time per package, and switching one CMake flag cost more than ignoring two packages saved. - colcon build --executor sequential still runs make -jN: measured compilers, memory and build time
In measured runs, colcon --executor sequential built one package at a time but kept make -j2; only MAKEFLAGS=-j1 got it down to one compiler.
Topics and QoS
- Failed to populate field in ros2 topic pub and service call: YAML forms that work, measured
Exact ros2 topic pub and ros2 service call YAML errors on Humble, Jazzy and Lyrical: missing space after colon, wrong or flat fields, arrays, byte[] vs uint8[], header… - "Could not determine the type for the passed topic" in ros2 topic echo: publisher timing, the daemon, domain ID, custom messages, RMW and discovery range, measured
ros2 topic echo exited after about 1 s instead of waiting for a publisher. Passing the type made it wait and receive. Also: a daemon that misses new… - ros2 bag convert db3 to MCAP in ROS 2: missing topics, empty bag
Add all_topics: true and include_hidden_topics: true to the output YAML, then compare ros2 bag info Count per topic; exit code 0 does not prove a full copy. - ROS 2 "frame does not exist" after ros2 bag play: /tf_static, transient_local and the QoS override, measured
When late tf2 listeners and tf2_echo get /tf_static from ros2 bag play and when they don't: VOLATILE player QoS, playback already ended, --start-offset. Includes the override YAML, --loop… - ROS 2 topic list works but topic echo prints nothing in Docker --net=host: Fast DDS shared memory, measured
Two containers with --net=host: the topic is listed, the publisher matches, and 0 of 100 messages arrive. --ipc=host on both, a shared /dev/shm or FASTDDS_BUILTIN_TRANSPORTS=UDPv4 (even on Humble,… - "Requesting incompatible QoS. No messages will be sent to it" in ROS 2: RELIABILITY, DURABILITY, DEADLINE and LIVELINESS mismatches, measured
Which publisher and subscriber QoS pairs deliver and which print the incompatible QoS warning, from BEST_EFFORT sensor data with a RELIABLE subscriber to TRANSIENT_LOCAL and deadline mismatches. Plus… - Is ros2 topic hz accurate at 1 kHz? hz and bw vs a C++ message counter, measured up to 10 kHz
ros2 topic hz matched a C++ subscriber within 0.2% at 400 Hz and 1 kHz on Humble and Jazzy, and only topped out near 5 kHz on 2… - Does ROS 2 traffic leave the machine? ROS_LOCALHOST_ONLY vs ROS_AUTOMATIC_DISCOVERY_RANGE, measured on eth0
On one machine only DDS discovery (3-4 KB per 10 s) reached eth0; the message data never did. ROS_LOCALHOST_ONLY=1 or ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST cut it to 0 with Fast DDS… - ROS 2 Nodes Can't See Each Other? ROS_AUTOMATIC_DISCOVERY_RANGE
If either node has ROS_AUTOMATIC_DISCOVERY_RANGE=OFF, nothing connects; across hosts, LOCALHOST also needs ROS_STATIC_PEERS on one side. - Gazebo Shows Real Time Factor 1.0. Did Your ROS 2 Control Loop Meet Its Deadline? Measured on Jazzy
In a ROS 2 Jazzy container, /clock held real time factor 1.0 while a 100 Hz callback missed its 10 ms deadline 20 times in 5 s. RTF… - ROS 2 Liveliness vs Deadline: Which One Tells You a Sensor Topic Stopped?
On ROS 2 Jazzy with Fast DDS, a stalled sensor topic fired only deadline events; Automatic liveliness stayed alive until the driver process was killed. - ROS 2 'Message Filter dropping message': Find the Mismatched Clock with One Subtraction
Subtract the latest tf stamp from the laser stamp: a gap of billions of seconds, and its sign, shows which ROS 2 node has use_sim_time set wrong. - ROS 2 transient_local: how many old messages does a late subscriber actually get? (measured)
Depth behaved as documented. A 0.45 s lifespan delivered 4 samples instead of 5 in every run, because history arrives after discovery.
Time and simulation
- Subtraction leads to negative time in ROS 2 rclpy (use_sim_time)
rclpy now() is 0 until the first /clock, so now() - Duration fails even if Gazebo starts at 100 s; skip when now.nanoseconds - Gazebo real_time_factor: how slow for a slow ROS 2 node
Keep Gazebo real_time_factor at or below sensor period / worst-case processing time: a node taking up to 0.25 s on a 16 Hz camera needs 0.25. - Can't subtract times with different clock types in ROS 2 rclpy
rclpy Time() is a 0 ns SYSTEM_TIME value while get_clock().now() and Time.from_msg() are ROS_TIME; create times with the node clock's clock_type.
Frames and tf
- ROS 2 tf2 "Lookup would require extrapolation into the future", "into the past" and "target_frame does not exist": lookup_transform timing, measured
Why lookup_transform at now() failed 1,800 of 1,800 times at 10, 50 and 100 Hz, what Time(), a timeout and wait_for_transform_async cost in milliseconds, why a timeout fails… - Transform PointCloud2 frame in ROS 2 Python, keep intensity
Rebuild with the original fields, point_step and a new base_link Header, or use do_transform_cloud; xyz-only create_cloud silently drops intensity. - ROS 2 tf Frame Offset Doubled? Check static_transform_publisher
A backwards ROS 2 static transform with no rotation puts the child exactly 2x the offset away; with rotation the ratio varies, and under odom the tree breaks.
Control and learning
- ROS 2 node shutdown: Ctrl+C, SIGTERM, "rcl_shutdown already called" and launch's 5-second escalation (measured on Humble, Jazzy, Lyrical)
Catch KeyboardInterrupt and ExternalShutdownException, clean up in finally, end with rclpy.try_shutdown(). Measured: rclpy.shutdown() errors on Humble/Jazzy, SIGTERM raises RCLError on Lyrical, with rclpy.init() only works on Lyrical, and…
Basics
- AssertionError: The 'data' field must be of type 'float' in rclpy: Humble asserts, Jazzy and Lyrical abort at publish, measured
Why int, numpy.float32, time.time() and rclpy Duration fail in ROS 2 message fields, why Jazzy and Lyrical skip the check unless ROS_PYTHON_CHECK_FIELDS=1 and then abort in convert_from_py, which… - print() and std::cout not showing in ros2 launch: output='screen', emulate_tty, PYTHONUNBUFFERED and pipe buffering, measured
Why print() and std::cout vanish or arrive late under ros2 launch: output='log' by default, then 8 KiB (Python), 128 KiB (Python 3.14 on Lyrical) and 4 KiB (C++)… - terminate called after throwing an instance of 'std::bad_weak_ptr' in ROS 2: shared_from_this() in node constructors, image_transport, tf2_ros and components, measured
Why shared_from_this() in an rclcpp node constructor aborts with bad_weak_ptr, and which fixes worked on Humble, Jazzy and Lyrical: passing this, init() after make_shared, a one-shot timer, on_configure.… - "Waiting for an action server to become available" in ros2 action send_goal, and rclpy action results that never arrive: causes and fixes, measured
Wrong name, namespace, remap, wrong type, other ROS_DOMAIN_ID, a server that never spins, rejected, canceled or killed goals, --timeout, discovery delay, and rclpy executor deadlocks in callbacks. Measured… - "ValueError: generator already executing" and rclpy service calls that deadlock in callbacks: executors and callback groups, measured
Which rclpy patterns raise generator already executing (Humble) or Executor is already spinning (Jazzy, Lyrical), why call() and await deadlock in the default callback group, and which fixes… - ros2 node list shows killed nodes: ros2 daemon stale entries, --no-daemon and daemon restart, measured
A node killed with kill -9 stayed in ros2 node list for about 20 s with Fast DDS and 6 to 8 s with Cyclone DDS; Ctrl-C and… - "Included launch description missing required argument" in ROS 2: launch_arguments, .items(), argument leaks, typos and booleans, measured
Why a required DeclareLaunchArgument fails even when the parent declares it or you pass it on the CLI, what a missing .items() prints, how values leak through IncludeLaunchDescription… - ROS 2 camera_info Stereo Baseline: Tx in P Matrix, B = -Tx/fx'
CameraInfo has no baseline field: on the right camera_info, B = -p[3]/p[0] (-Tx/fx', both from P), and depth from disparity is Z = -p[3]/d. - "waiting for service to become available" in ros2 service call, and wait_for_service returning False: causes and fixes, measured
Wrong name, namespace, remap, wrong type, other ROS_DOMAIN_ID, mixed RMW, a server that never spins or already exited: what the CLI, ros2 service list -t and node info… - "WARNING: Be aware that there are nodes in the graph that share an exact name" in ROS 2: what breaks and how to rename, measured
Two ROS 2 nodes with the same name: ros2 param get answered from either one, param set changed both, lifecycle and action calls reached both, topics kept working.… - qt.qpa.xcb: could not connect to display: rviz2 and rqt in Docker, from X11 auth to OpenGL errors, measured
Why rviz2 aborts in Docker with could not connect to display or Authorization required, why xhost +local: did nothing on a bare Xvfb, which GL gaps cause Invalid… - "Cannot be set because it was not declared": ros2 param set and ParameterNotDeclaredException in ROS 2, measured
ros2 param set and get_parameter errors for undeclared, wrong-type and read-only parameters in rclpy and rclcpp, why undeclared YAML, -p and launch values are dropped silently, and what… - Failed to find a free participant index for domain 0: Cyclone DDS limits on Humble, Jazzy and Lyrical, measured
On one host, Cyclone DDS stopped at 9 ROS 2 processes on Humble over loopback and at 32 on Jazzy and Lyrical. Raising MaxAutoParticipantIndex worked on all three;… - "Cannot locate rosdep definition for" in ROS 2 rosdep install: --ignore-src, ROS_DISTRO, wrong keys, pip keys and custom sources, measured
What causes rosdep's Cannot locate rosdep definition error: a workspace package without --ignore-src, ROS_DISTRO unset, python-numpy instead of python3-numpy, or a custom key with no source. Also why… - "No executable found" from ros2 run and "not found on the libexec directory" for ament_python: entry_points, setup.cfg and --symlink-install, measured
Where ros2 run looks for a Python node, and what put it elsewhere: a missing or misnamed entry point, a missing setup.cfg that sends the script to bin/,… - "A module that was compiled using NumPy 1.x cannot be run in NumPy 2.x" and "_ARRAY_API not found" in ROS 2 cv_bridge: pip NumPy 2, OpenCV wheels and the fixes, measured
Why apt cv_bridge breaks after pip pulls NumPy 2 (import error, segfault, or KeyError: 16 from OpenCV 5), which fixes worked (pip uninstall numpy, numpy - ROS 2 "Failed to parse global arguments" and "Cannot have a value before ros__parameters": params YAML and -p errors, measured
What each rcl params-file and -p error means, from missing ros__parameters and tab indentation to InvalidParameterTypeException for 1 vs 1.0, plus the two mistakes that fail silently: a… - ros2 launch: "file was not found in the share directory of package" - the install step, stale copies and --symlink-install (measured)
ros2 launch only searches install//share/, never src/. Missing data_files, a glob that matches nothing, or no install(DIRECTORY launch) in CMake all give this error. Plus stale copies and… - ros2 run ignores your conda or venv: No module named 'torch' and the #!/usr/bin/python3 fix (measured)
colcon writes #!/usr/bin/python3 into Python node scripts, so ros2 run never sees packages installed in a conda env or venv. Measured on Humble and Jazzy: setup.cfg [build_scripts] executable… - Gazebo high resolution camera slow in ROS 2: image bandwidth
An rgb8 image topic carries width x height x 3 x fps bytes (4512x4512 at 19 Hz = 1160 MB/s), and Gazebo renders a camera only once something… - ament_target_dependencies deprecated in Kilted, removed in Lyrical: fix "Unknown CMake command" with target_link_libraries on every ROS 2 distro
Lyrical removed ament_target_dependencies. Replace it with target_link_libraries(target PUBLIC rclcpp::rclcpp ${std_msgs_TARGETS}); tested on Humble, Jazzy, Kilted and Lyrical, plus the three ways the fix still fails. - ROS 2 ROSInterruptException: rate.sleep() after rclpy.shutdown()
rate.sleep() wakes about 1 ms after rclpy.shutdown() and raises ROSInterruptException; Ctrl+C gives KeyboardInterrupt, so catch both and call try_shutdown(). - rclpy and asyncio: no running event loop, hung service calls, and the thread bridge that works
await asyncio.sleep() in an rclpy callback raises 'no running event loop'. await call_async() hung on a SingleThreadedExecutor until the callback was in a ReentrantCallbackGroup. For real asyncio, run… - Convert a ROS 2 .db3 bag to MCAP (and play Jazzy bags in Humble)
ros2 bag convert with storage_id: mcap works once Humble has ros-humble-rosbag2-storage-mcap; delete the empty output folder a failed run leaves. Jazzy bags fail in Humble with yaml-cpp bad… - ros2 bag record from a ROS 2 launch file: missing first messages
Use ExecuteProcess; the bag starts only when the recorder subscribes, so you lose more than Hz × timer delay, and with --use-sim-time everything before /clock. - No module named 'rclpy' or 'rclpy._rclpy_pybind11' in ROS 2
For No module named 'rclpy', source the setup file matching your shell in that terminal; for _rclpy_pybind11, use the system python3, not conda's. - ROS 2 LaunchConfiguration value as int: why '2'+'5' gives 25
Launch joins substitution lists as strings, so '2' and '5' become '25' (int 25 as a node parameter); add with PythonExpression([a, ' + ', b]) instead. - ROS 2 bag record split: --max-bag-size vs --max-bag-duration
ros2 bag record splits at whichever of -b or -d is hit first: size wins when -b divided by your data rate is shorter than -d, otherwise duration. - 16GB vs 32GB RAM for Programming: Measured RAM by Task
Only measured numbers under hard memory caps: 7B local LLM 6.3GiB, Nav2 build 8.1GiB, MoveIt 2 8.7GiB (fails at 8GB), 14B LLM 13.6GiB. Where 16GB and 32GB split. - Docker Desktop Memory Usage on Mac: Measured on an 8GB MacBook
Three runs of Docker Desktop 4.73 on an 8GB Intel MacBook: three idle containers show 85MiB in docker stats but add 320 to 472MiB on the Mac, and… - ROS 2 Python PointCloud2 to xyz NumPy array: read_points_numpy
In ROS 2 Python use read_points_numpy(msg, field_names=['x','y','z']); skip_nans drops NaN rows only when is_dense is False, so filter with np.isfinite. - Ollama RAM Requirements: 3B, 7B and 14B Measured at 4, 8 and 16GB
27 Ollama runs of Qwen2.5 3B/7B/14B under 4, 8 and 16GB RAM caps, CPU only: 8GB runs up to 7B (peak 6.2GiB); 14B needed 13.6GiB at 16GB. Speeds… - ROS 2 depth image pixel to 3D point (XYZ) with camera_info K
X = (u - cx)*Z/fx, Y = (v - cy)*Z/fy with fx=K[0], cx=K[2], fy=K[4], cy=K[5] and Z in metres (16UC1 depth is mm); depth is Z, not ray… - ROS 2 rclpy rate.sleep() Blocks Forever: Why and How to Fix
rclpy rate.sleep() waits for a timer callback only an executor runs: spin in another thread or use MultiThreadedExecutor(num_threads=2). - ROS 2 rclpy publish() Slow With Large Custom Message Arrays
Split Foo[] into uint64[] + uint32[]: rclpy publish() of 10,000 elements dropped from about 10 ms to 0.25 ms on ROS 2 Jazzy. - Gymnasium check_env "share an object" error in ROS 2 robot envs
Your env returns the same NumPy array every step, so every buffer slot holds the latest value; return self._q.copy(), not obs[:] or np.asarray(obs).