Skip to content

Comments

map ROS_LOCALHOST_ONLY to UXRCE_DDS_PTCFG#26547

Open
varadVaidya wants to merge 1 commit intoPX4:mainfrom
varadVaidya:ros-localhost-only-ptcfg-env
Open

map ROS_LOCALHOST_ONLY to UXRCE_DDS_PTCFG#26547
varadVaidya wants to merge 1 commit intoPX4:mainfrom
varadVaidya:ros-localhost-only-ptcfg-env

Conversation

@varadVaidya
Copy link

@varadVaidya varadVaidya commented Feb 21, 2026

In SITL startup, mirror ROS_LOCALHOST_ONLY into UXRCE_DDS_PTCFG so PX4 and ROS middleware locality policy stay aligned with environment-based bringup.
Also document ROS_LOCALHOST_ONLY as an env override for UXRCE_DDS_PTCFG.

Solved Problem

When running PX4 SITL with ROS 2, ROS_LOCALHOST_ONLY and PX4 UXRCE_DDS_PTCFG can become misaligned unless set manually.
That mismatch causes DDS discovery/data flow failure from ROS 2 (e.g. missing /fmu/out/* topics).

Fixes #N/A

Solution

  • In ROMFS/px4fmu_common/init.d-posix/rcS, map ROS_LOCALHOST_ONLY to UXRCE_DDS_PTCFG during SITL startup:
    • if ROS_LOCALHOST_ONLY is set and equals "1": UXRCE_DDS_PTCFG=1
    • if ROS_LOCALHOST_ONLY is set and is anything else: UXRCE_DDS_PTCFG=0
    • if ROS_LOCALHOST_ONLY is unset: leave parameter default behavior unchanged
  • Update docs/en/middleware/uxrce_dds.md to document ROS_LOCALHOST_ONLY override and update example command.

Changelog Entry

For release notes:

Bugfix: SITL startup now maps ROS_LOCALHOST_ONLY to UXRCE_DDS_PTCFG.
Documentation: Added ROS_LOCALHOST_ONLY env override in uxrce_dds docs and updated example command.

Alternatives

  • Keep manual param set UXRCE_DDS_PTCFG in scripts.

Test coverage

Tested with SITL (gz_x500, headless), MicroXRCEAgent UDP 8888, ROS_DOMAIN_ID=42.

Host ROS_LOCALHOST_ONLY PX4 ROS_LOCALHOST_ONLY -> UXRCE_DDS_PTCFG Result
0 0 PASS: /fmu/out/* visible and echo succeeds
1 1 PASS: /fmu/out/* visible and echo succeeds
1 0 FAIL (expected): ROS side only sees /parameter_events and /rosout
0 1 FAIL (expected): ROS side only sees /parameter_events and /rosout

Echo command used:

ros2 topic echo --once --no-daemon /fmu/out/vehicle_status_v1
--qos-reliability best_effort --qos-durability transient_local

Context

This keeps env-based SITL bringup minimal and deterministic: setting ROS_LOCALHOST_ONLY directly drives PX4 uXRCE locality mode.

@varadVaidya varadVaidya marked this pull request as ready for review February 21, 2026 12:14
@varadVaidya
Copy link
Author

If this is accepted on main, I can open follow-up backport PRs for older maintained release branches

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant