CARLA ue5-dev: how to change ROS_DOMAIN_ID #9828
Replies: 1 comment
---------------------------------------------------SAME FOR UPDATED SOURCE CODE---------------------------------------------------Carla Unreal ue5-devEngine version: 5.5.4Ubuntu 24.04This time we have Jazzy JaliscoDefine the same config file headerLibCarla/source/carla/ros2/ROS2Config.h Define the config file cpp separately not in ROS2.cppLibCarla/source/carla/ros2/ROS2Config.cpp Modify hard coded filesIn this version we have only 3 files to modify:LibCarla/source/carla/ros2/publishers/PublisherImpl.h modify as below LibCarla/source/carla/ros2/subscribers/SubscriberImpl.h modify as below LibCarla/source/carla/ros2/subscribers/BasicSubscriber.cpp modify as below Modify CMAKE LISTWe also need to modify CmakeLists to add the config file into compiler path Ros2Native/LibCarlaRos2Native/CMakeLists.txt just after the add this: After modifying the all files run below command to build NOTE: By default it is still 0, we just need to assign domain id before launching the CARLA and use the same domain id in all terminals to isolate our topics in that domain... Example usage: Run the level and in another clean terminal: we will get: In case your Carla Build fails, do below if necessary:The below is not related to domain id setup but for some reason experienced this after some settings, may be after installing the Jazzy, Unreal compiler and Ubuntu compiler mismatched command started to fail. It started to throw this carla_studio_example_tool error: It has been resolved by modifying Toolchain.cmake CMake/Toolchain.cmake replace this: with: |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Platform: Ubuntu 22.04 - ue5-dev branch built from source
Ros Humble already installed.
ROS_DOMAIN_ID is hard coded and by default set to 0.
All publisher and subscribers in ros2 folder (LibCarla/source/carla/ros2/) which have
factory->create_participant(0, pqos)needs to be modified.
First we need to define a config file like this in ros2 folder
LibCarla/source/carla/ros2/ROS2Config.h
Declare it in ROS2.cpp
/LibCarla/source/carla/ros2/ROS2.cpp
In ros2 {...}
Then modify all the code containing
create_participant(0, pqos)by adding#include "carla/ros2/ROS2Config.h"We can find all files that has
create_participant(0, pqos), with this command running from CARLA root::~/CarlaUE5$
grep -R "create_participant(0" -n LibCarla/source/carla/ros2Note that some files have it defined in multiple places, change all places.
Example of implementation:
LibCarla/source/carla/ros2/publishers/BasicPublisher.cpp
Another example:
LibCarla/source/carla/ros2/subscribers/CarlaEgoVehicleControlSubscriber.cpp:
After modifying the all files run below command to build
NOTE: By default it is still 0, we just need to assign domain id before launching the CARLA and use the same domain id in all terminals to isolate our topics in that domain...
Example usage:
from CARLA root :~/CarlaUE5$
Run the level and in another clean terminal:
we will get:
/clock
/parameter_events
/rosout
/clock is coming from CARLA 💯
Remember in all terminal dealing with ros, needs to be exported with same domain id, it can be added to ./bashrc to make the terminal having it by start up, if it is constant all the time as well.
All reactions