Skip to content

Conversation

@berndgassmann
Copy link
Contributor

@berndgassmann berndgassmann commented Nov 21, 2025

Description

Extend ROS2 support Step 3: Rework ROS2 handling

This commit is extending the built-in ROS2 support of CARLA:

  • the internal interface is simplified and object oriented to allow
    easier ROS2 extensions in future and reduce code duplication
  • the sensor/actor stream existing for the TCP counterparts are used
    in a shared manner, which results in lower processing overhead and
    requires little individual code changes for ROS2 within UE-sensors
  • enable Boost and Asio exceptions for FastDDS to ensure properly
  • additional service interfaces are provided to control CARLA directly
    from ROS2 (Map, Blueprint and Episode handling, Spawn/DestroyObject)
  • convenient interfaces previously available via carla_ros_bridge are
    provided (e.g. pseudo sensors, object messages, traffic light/sign,
    actor/sensor lists)
  • new interfaces like e.g. CarlaVehicleTelemetryData, V2X,
    SynchronizationWindow,WeatherControl
  • get detailed vehicle meshes as exact ground truth for e.g. LiDAR
    perception
  • Vehicle publisher implements a variety of individual publishers to
    mimick also old ROS-bridge convenient publisher:
    • CarlaVehicleInfo
    • CarlaVehicleControlStatus
    • Speed
    • Odometry
    • Object
    • ObjectWithCovariance
    • VehicleTelemetryData
  • Vehicle subscribers:
    • VehicleControlSubscriber
    • AckermannControlSubscriber,
    • SetTransformSubscriber
  • use of c++17 to support std::sample() usage
  • Dynamic switching on ROS visibility is possible for all actors now
  • Default startup behavior is selectable by ROS2TopicVisibility
    parameter in DefaultGame.ini: If true, then all and every topic that
    is currently offered by the implementation is visible from the
    beginning. If false, then only the sensors/actors created via the
    Client- or ROS-Interface are visible by defaults. Others can be
    activated via EnableForRos() calls (this allows for disabling
    interfaces e.g. for leaderboard)
  • ensure multiple service calls at once are working:
    • qos history kind eprosima::fastdds::dds::KEEP_ALL_HISTORY_QOS
    • qos reliablility kind
      eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS
    • qos durability kind
      eprosima::fastdds::dds::TRANSIENT_LOCAL_DURABILITY_QOS
      for reader, writer, topic
  • add set_transform() call to RGB Cameras
  • add odometry publisher to walkers
  • filter out invalid bounding boxes observed on a few traffic signs
    using bounding box transmission within object data

Where has this been tested?

  • Platform(s): ...Ubuntu 22.04 and 24.04 (with some 24.04 adaptions which come on a separate PR)
  • Python version(s): ...3.10, 3.12
  • Unreal Engine version(s): ...4.26
  • ROS2 version(s): humble (22.04), kilted (24.04)

Possible Drawbacks

Some features of the old ros-brigde which are client only code are not yet implemented (lane invasion sensor, enable_autopilot) at server side, but are kept available by the carla_ros_client node which deploys a tiny subset of the former carla_ros_bridge to provide the ros2 interfaces via the carla python client.

  • the set_velocity interface (set movement via Twist) is currently not supported; is that used at all?
    Did not recognize any other interface that might be missing yet.

This change is Reviewable

Introduced a fine grained ServerSynchronization mechanism, where each
synchonization participant is treated independently and interacts
with the synchronization of the carla-server individually. If a client
is disconnected (or dies) the synchronization state of all participants
registered via that client are dropped, i.e. the server will continue
running in case the participants of that client were the only ones
demanding synchronous mode.

The synchronization interface provides means of a time window, up to
which the server is allowed to run. Like this, every client can prevent
the carla-server to run too fast depending on their individual speed.
There is no sync-master anymore. Every client decides for its own if
it requires synchronization or not.

Drawback of this change: some existing code might have to be changed
(see removal of synchronous_master in generate_traffic.py).
Update RPC lib version for windows build

Ensure tick calls are ignored if sync mode is not active.
And prevent client changes of fixed_delta_seconds triggering warning
message.
@berndgassmann berndgassmann force-pushed the mai/ue4-extend-ros2-step3 branch from 99dfc13 to 26a6111 Compare November 30, 2025 00:10
@berndgassmann
Copy link
Contributor Author

Rebased to the (hopefully) fixed step2 commit.
And reverted some unnecessary interface changes on ROS side to allow maximum compatibility to the previous ros_bridge behavior.
Currently mainly some features implemented at CARLA client side are missing e.g. lane invasion, set_autopilot (because traffic manager is handled by client).

on non synchronous mode
This commit is extending the built-in ROS2 support of CARLA:
- the internal interface is simplified and object oriented to allow
  easier ROS2 extensions in future and reduce code duplication
- the sensor/actor stream existing for the TCP counterparts are used
  in a shared manner, which results in lower processing overhead and
  requires little individual code changes for ROS2 within UE-sensors
- enable Boost and Asio exceptions for FastDDS to ensure  properly
- additional service interfaces are provided to control CARLA directly
  from ROS2 (Map, Blueprint and Episode handling, Spawn/DestroyObject)
- convenient interfaces previously available via carla_ros_bridge are
  provided (e.g. pseudo sensors, object messages, traffic light/sign,
  actor/sensor lists)
- new interfaces like e.g. CarlaVehicleTelemetryData, V2X,
  SynchronizationWindow,...
- get detailed vehicle meshes as exact ground truth for e.g. LiDAR
  perception
- Vehicle publisher implements a variety of individual publishers to
  mimick also old ROS-bridge convenient publisher:
  + CarlaVehicleInfo
  + CarlaVehicleControlStatus
  + Speed
  + Odometry
  + Object
  + ObjectWithCovariance
  + VehicleTelemetryData
- Vehicle subscribers:
  + VehicleControlSubscriber
  + AckermannControlSubscriber,
  + SetTransformSubscriber
- use of c++17 to support std::sample() usage
- Dynamic switching on ROS visibility is possible for all actors now
- Default startup behavior is selectable by ROS2TopicVisibility
  parameter in DefaultGame.ini: If true, then all and every topic that
  is currently offered by the implementation is visible from the
  beginning. If false, then only the sensors/actors created via the
  Client- or ROS-Interface are visible by defaults. Others can be
  activated via EnableForRos() calls (this allows for disabling
  interfaces e.g. for leaderboard)
- ensure multiple service calls at once are working:
  + qos history kind eprosima::fastdds::dds::KEEP_ALL_HISTORY_QOS
  + qos reliablility kind
    eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS
  + qos durability kind
    eprosima::fastdds::dds::TRANSIENT_LOCAL_DURABILITY_QOS
    for reader, writer, topic
- add set_transform() call to RGB Cameras
- add odometry publisher to walkers
- filter out invalid bounding boxes observed on a few traffic signs
using bounding box transmission within object data
@berndgassmann berndgassmann force-pushed the mai/ue4-extend-ros2-step3 branch from 26a6111 to 3de7c09 Compare December 1, 2025 09:26
Update telemetry data of VehiclePublisher within process messages step
This ensures that the vehicle/wheel data in the engine can not be updated
while gathering the data

Improve object classification to match existing base-class blueprint patterns.

Reduce some ROS2 log output severity
@berndgassmann berndgassmann marked this pull request as ready for review December 3, 2025 17:31
@berndgassmann berndgassmann requested a review from a team as a code owner December 3, 2025 17:31
@berndgassmann
Copy link
Contributor Author

When this is merged, also the updated carla_msgs should be merged into the dev branch
carla-simulator/ros-carla-msgs#24

Then we should create also dev branch within the ros-bridge repository that we don't mess up the master with the development changes.

After the carla_msgs have been merged I can update the ros-bridge PR with the correct carla_msgs commit here:
carla-simulator/ros-bridge#762

berndgassmann added a commit to Motor-Ai/carla-simulator-carla that referenced this pull request Jan 2, 2026
* Extend ROS2 support Step 2: Fine grained ServerSynchronization (carla-simulator#9450)

* Extend ROS2 support Step 2: Fine grained ServerSynchronization

Introduced a fine grained ServerSynchronization mechanism, where each
synchonization participant is treated independently and interacts
with the synchronization of the carla-server individually. If a client
is disconnected (or dies) the synchronization state of all participants
registered via that client are dropped, i.e. the server will continue
running in case the participants of that client were the only ones
demanding synchronous mode.

The synchronization interface provides means of a time window, up to
which the server is allowed to run. Like this, every client can prevent
the carla-server to run too fast depending on their individual speed.
There is no sync-master anymore. Every client decides for its own if
it requires synchronization or not.

Drawback of this change: some existing code might have to be changed
(see removal of synchronous_master in generate_traffic.py).

* Fix Windows build and smoke tests

Update RPC lib version for windows build

Ensure tick calls are ignored if sync mode is not active.
And prevent client changes of fixed_delta_seconds triggering warning
message.

* Client needs to wait for next tick

on non synchronous mode

* Fix libpng (see carlagx's carla-simulator#9469 and berndgassmann's carla-simulator#9451). (carla-simulator#9477)

* Fix issues with running the cosmos transfer server docker image due to outdate dependencies (carla-simulator#9456)

* fix dockerfile for changes to vllm and transformers (carla-simulator#229)

nvidia-cosmos/cosmos-transfer1#229
nvidia-cosmos/cosmos-transfer1#210

* fix for outdated packages, use new commit hash

* Fix docker error due to issues regarding the current working directory. (carla-simulator#9484)

---------

Co-authored-by: MarcelPiNacy-CVC <169088301+MarcelPiNacy-CVC@users.noreply.github.com>
Co-authored-by: 0graph <50416380+0graph@users.noreply.github.com>
Instead of /carla/map /carla/world_info is published as was done in
original ROS bridge since quite some time.

Ensure, that the map data is quieried within ProcessMessages()
Limit history size to 1
Make publisher transient local
Because it's too large AND incorrect for animated vehicles. Would
require more sophisticated handling to make it proper published in a
separate topic.

Ensure vehicle telemetry publisher publishes updates.

Add carla_version to CarlaWorldInfo.

Add trigger_volume to TrafficLightPublisher and fix publishing of wrong
entry in TrafficLightsPublisher
Fix: Always publish TFs of sensors
Previously TFs of sensors were only published if subscribers were
connected, because TF publishing for sensors relied on active sensor
streams.
Moved sensor handling code from ROS2 class to UeWorldPublisher to be
able to publish TFs of sensors while updating the actors when required.

Fix: Consider rotation on ROS2 SpawnObject calls
Fix: Ensure topics (i.e. rarely updated with transient local) are
actually published at DDS level, even if no subscribers are connected at
publishing time
Fix: Publish also the sensor data with transient local to be most
compatible with any receiver configuration. I.e. ensure receivers are
able to apply a history size to prevent from frame drops on high system
loads.
Fix: Internal order on object publishing: first update the object data,
then publish (previously data of the last frame were published)
Fix: Consider ros_frame_id and ros_publish_tf blueprint parameters

Added Verbose Logging and moved logs recurring on every frame to verbose

Added publishing of EnvironmentObjects.

Allow more flexible Object publishing to support dynamic objects, barely
changing dynamic objects (traffic signs, lights) as well as static
Environment Objects.

Replaced publishing of object data of individual traffic_lights/signs by
a grouped object publisher for those (commented the old individual
publishing behavior by #ifdef) and removed the covariance object
publishing version of these.

Expand CarlaActorInfo.msg data to give the user more insights into actor
configuration.

Expand CarlaEgoVehicleTelemetryData.msg to transport the vehicles light
state flags
Already register the sensor-actors when collecting the sensor
information to ensure respective parent sensors are already registered
at construction time of the actual sensor publisher. This can happen if
sensors are nested in some hierarchy.

Fix emulated actor name definition of EnvironmentObject that the
base_type reflects the type of the object (car, traffic_light, etc.)
instead of the object_type. Now it is identical to the other actors.
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.

2 participants