Skip to content

Instantly share code, notes, and snippets.

@peci1
Last active April 21, 2025 21:48
Show Gist options
  • Save peci1/52aea17faf5f7e33c8096b75dc9bcd2f to your computer and use it in GitHub Desktop.
Save peci1/52aea17faf5f7e33c8096b75dc9bcd2f to your computer and use it in GitHub Desktop.
ROS 2 migration pain points

Launch

  • Where the hell do I find complete docs for XML launch files?
  • use_sim_time hell (i.e. no support for global parameters)
  • $(dirname) is broken and unreliable (ros2/launch#618)
  • ugly testing for nonempty XML launch args ($(eval 'bool(\'$(var var_name)\')'))
  • in Python launch, launch_arguments of IncludeLaunchDescription ingest booleans as 'true'/'false', i.e. strings!
    • launch_arguments=[('use_sim_time', 'true'),]
    • and the error you get if you pass an actual boolean is super cumbersome
  • cannot use parameters which are lists of dicts or other non-trivial types (ros2/ros2#1380)
    • the error you get is difficult to understand
  • I haven't found any docs on writing custom launch actions (and it took me quite some time to get a little into it)
    • what's missing at minimum is a doc that would tell what are all the steps needed to register the action
      • setup.cfg, make and install as a Python package even if it's a C++ one otherwise, add the decorator...
  • No XSD schema for launch_ros with all its actions, only for launch base:
  • Setting <arg value> in an <include> will also overwrite the arg in the rest of the launch file (ros2/launch#620 (comment))
    • Workaround: wrap each <include> within its own <group>.
    • It is described in the migration guide, but its meaning is not really obvious to people who want to dive into ROS 2 without prior knowledge:
      • Available in ROS 1, included content was scoped. In ROS 2, it’s not. Nest includes in group tags to scope them.

rclpy

QoS

  • I haven't found any complete documentation about qos_overrides parameter. There are some bits and pieces, but e.g. no docs page explains to you that deadline is in nanoseconds.

CLI tools

  • ros2 topic hz is unusable because it is in Python and it deserializes all messages (https://discourse.ros.org/t/rmw-zenoh-binaries-for-rolling-jazzy-and-humble/41395/18)
  • tab completion of ros2 topic is much worse than ROS 1. Also, the pregenerated message content is incorrect and cannot be used as is
  • CLI tools silently ignore RMW_IMPLEMENTATION variable and only talk to the running daemon. So if you first launch something with one RMW and then want to run something else with another RMW, all CLI tools still silently use the first RMW. To solve that, call ros2 daemon stop.

package types

ros_gz

  • server can be launched as a composable node, but the client can't (need to use Executable)
  • topic bridges cannot be launched as composable nodes with the bridge specification passed as arg/parameter (only through YAML config)
    • there is no way how the YAML config of a bridge could be parametrized by world and robot name, which makes these configs practically useless (gazebosim/ros_gz#717)
  • topic bridges do not allow easy setting of QoS profiles (but that can be overcome by setting qos_overrides manually)
    • quite important for /clock bridge!
  • it is quite difficult to understand how changing a sensor frame_id works, because you have to use gz_frame_id, but that is an undocumented SDF element.
  • <export>ing Gazebo resource paths in package.xml no longer works

Components

  • component_container is single-threaded (it even rins its own load/unload callbacks on the single thread)! Use component_container_mt.
@christophebedard
Copy link

christophebedard commented Apr 21, 2025

package types

  • what is a preferred package type for message-only packages? do they need to use ament_cmake? this is a quite common task, so it'd be great to have this documented

They do have to be CMake packages (and thus use ament_cmake). It's mentioned here: https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Custom-ROS2-Interfaces.html#create-a-new-package

Note that it is, and can only be, a CMake package, but this doesn’t restrict in which type of packages you can use your messages and services. You can create your own custom interfaces in a CMake package, and then use it in a C++ or Python node, which will be covered in the last section.

This might not be visible enough, though. Maybe we can make it a reST note.

@fujitatomoya
Copy link

component_container is single-threaded (it even rins its own load/unload callbacks on the single thread)! Use component_container_mt.

or component_container_isolated with single or multi threads?

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