Skip to content

fix(BuildTools): forward --ros2 and --dds-middleware to UE4 editor command line - #9665

Merged
Blyron merged 1 commit into
carla-simulator:ue4-devfrom
JArmandoAnaya:fix/issue-9511-ros2-launch
Apr 14, 2026
Merged

fix(BuildTools): forward --ros2 and --dds-middleware to UE4 editor command line#9665
Blyron merged 1 commit into
carla-simulator:ue4-devfrom
JArmandoAnaya:fix/issue-9511-ros2-launch

Conversation

@JArmandoAnaya

@JArmandoAnaya JArmandoAnaya commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

PR: fix(BuildTools): forward --ros2 and --dds-middleware to UE4 editor command line

Branch: fix/issue-9511-ros2-launch
Base: ue4-dev


Description

Fixes #9511

This PR is blocked on #9645.

When running make launch ARGS="--ros2", the --ros2 flag is consumed by BuildCarlaUE4.sh
for build-time configuration (OptionalModules.ini) but never forwarded to the UE4 editor
process. At runtime, CarlaSettings.cpp checks FParse::Param(TEXT("-ros2")) on the command
line, which always fails because the flag is missing.

This PR adds a forwarding block after the argument-parsing loop in both build scripts:

BuildCarlaUE4.sh:

  • New DDS_MIDDLEWARE variable and --dds-middleware getopt option
  • After parsing, appends --ros2 and --dds-middleware=<value> to EDITOR_FLAGS

BuildCarlaUE4.bat:

  • After parsing, appends --ros2 to EDITOR_FLAGS when USE_ROS2 is true
  • No --dds-middleware on Windows (only FastDDS is supported)

After the fix, make launch ARGS="--ros2" produces:

UE4Editor CarlaUE4.uproject -vulkan --ros2

And make launch ARGS="--ros2 --dds-middleware=cyclonedds" produces:

UE4Editor CarlaUE4.uproject -vulkan --ros2 --dds-middleware=cyclonedds

Where has this been tested?

  • Platform: Ubuntu 22.04
  • ROS2 verification: osrf/ros:humble-desktop container, ros2 topic list confirms
    /clock and all CARLA topics are published
  • Unreal Engine: 4.26

Script argument-parsing verified with 6 unit tests covering all flag combinations
(--ros2 only, --dds-middleware only, both, neither, combined with --editor-flags).

Possible Drawbacks

None. The forwarding is additive and only activates when --ros2 or --dds-middleware is
explicitly passed. Existing workflows without these flags are unaffected.


This change is Reviewable

@update-docs

update-docs Bot commented Apr 9, 2026

Copy link
Copy Markdown

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would update our CHANGELOG.md based on your changes.

@JArmandoAnaya
JArmandoAnaya changed the base branch from ue4-dev to ue5-dev April 10, 2026 09:44
@JArmandoAnaya
JArmandoAnaya changed the base branch from ue5-dev to ue4-dev April 10, 2026 09:44
@JArmandoAnaya
JArmandoAnaya marked this pull request as ready for review April 10, 2026 09:45
@JArmandoAnaya
JArmandoAnaya requested a review from a team as a code owner April 10, 2026 09:45
@LuisPovedaCano LuisPovedaCano self-assigned this Apr 10, 2026

@LuisPovedaCano LuisPovedaCano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The Windows CI/CD failure is not caused by this PR's changes.
The cause is that the branch is 2 commits behind ue4-dev and is missing commit 364fd34
fatal error C1083: Cannot open include file: 'carla/ros2/dds/DDSMiddleware.h': No such file or directory
To fix it, just update the branch against current ue4-dev

@JArmandoAnaya
JArmandoAnaya force-pushed the fix/issue-9511-ros2-launch branch from 2ba4adb to 28d7910 Compare April 13, 2026 16:50
@JArmandoAnaya

Copy link
Copy Markdown
Contributor Author

Hello! Done, I already rebased from ue4-dev.

@JArmandoAnaya

Copy link
Copy Markdown
Contributor Author

It looks like Windows CI is still failing, but I saw the error, and it doesn't seem related to this PR or the ROS2 fixes.

@Blyron
Blyron merged commit e7ca6f4 into carla-simulator:ue4-dev Apr 14, 2026
1 of 2 checks passed
@JArmandoAnaya
JArmandoAnaya deleted the fix/issue-9511-ros2-launch branch April 14, 2026 06:55
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.

3 participants