carla-simulator / ros-bridge

ROS bridge for CARLA Simulator
MIT License
523 stars 431 forks source link

Duplicate sensor names and type, causes "failed to create topic in Cyclone DDS" #636

Open andrewbest-tri opened 2 years ago

andrewbest-tri commented 2 years ago

When running the ROS bridge against foxy using cyclone, or galactic I suppose, I am running into a duplicate topic error.

The problem occurs when multiple sensors (or actors) try to create the same topic with a different type. I am not yet sure which sensors are creating duplicates, but we have a test that spawns one of everything and it consistently fails on sensor creation.

exception in thread Thread-1:
TraceTraceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/[OBFUSCATED]install/carla_ros_bridge/lib/python3.8/site-packages/carla_ros_bridge/actor_factory.py", line 96, in _update_thread
    self.update_available_objects()
  File "/[OBFUSCATED]install/carla_ros_bridge/lib/python3.8/site-packages/carla_ros_bridge/actor_factory.py", line 114, in update_available_objects
    self._create_object_from_actor(carla_actor)
  File "/[OBFUSCATED]install/carla_ros_bridge/lib/python3.8/site-packages/carla_ros_bridge/actor_factory.py", line 256, in _create_object_from_actor
    obj = self._create_object(carla_actor.id, carla_actor.type_id, name,
  File "/[OBFUSCATED]install/carla_ros_bridge/lib/python3.8/site-packages/carla_ros_bridge/actor_factory.py", line 403, in _create_object
    actor = ImuSensor(uid, name, parent, spawn_pose, self.node,
  File "/[OBFUSCATED]install/carla_ros_bridge/lib/python3.8/site-packages/carla_ros_bridge/imu.py", line 52, in __init__
    self.imu_publisher = node.new_publisher(Imu, self.get_topic_prefix(), qos_profile=10)
  File "/[OBFUSCATED]install/ros_compatibility/lib/python3.8/site-packages/ros_compatibility/node.py", line 175, in new_publisher
    return self.create_publisher(
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/node.py", line 1144, in create_publisher
    publisher_capsule = _rclpy.rclpy_create_publisher(
_rclpy.RCLError: Failed to create publisher: failed to create topic, at /tmp/binarydeb/ros-foxy-rmw-cyclonedds-cpp-0.7.8/src/rmw_node.cpp:1872, at /tmp/binarydeb/ros-foxy-rcl-1.1.13/src/rcl/publisher.c:180

It's related to https://github.com/ros2/rmw_cyclonedds/issues/111 but adding multiple types for a topic is definitely not supported.

andrewbest-tri commented 1 year ago

@germanros1987 This is the issue we discussed.

Every sensor of a given type (i..e. camera) for a given actor gets the same name when 1) passive mode is on 2) register all sensors is on

The end result is crashes and confusion. Ideally, we'd be able to provide some naming scheme to the bridge to de-duplicate. As it stands all cameras are called /hero/front and will causes crashes in cyclone DDS. It's also confusing for us downstream as we get multiple feeds on the same topic.